indication¶
Attention animations: drawing the viewer’s eye to something.
These are the “look here” effects. Indicate() swells a Mob and flashes its
color; Wiggle() shakes it; Blink() flickers it; FocusOn()
dims everything else and closes a spotlight onto a point; the passing-flash
family runs a highlight along an outline.
Each is an animated function returning a Mob, so it composes with the animation
contexts like any other change – put several in a Sync to indicate
things together, or a Lag to sweep across them.
there_and_back() and wiggle() are the rate functions behind them, and
are useful on their own as easing arguments.
Functions
- ApplyWave(mob, direction=tensor([0., 1., 0.]), amplitude=0.2, ripples=1, time_width=1.0, runtime=2.0, wave_func=<function smooth>)[source]¶
Ripple a wave across a Mob’s geometry, left to right.
The Mob’s own points are displaced, so it flexes like a flag rather than moving as a rigid body, and it returns to its original shape at the end.
Animation
Recorded as an animation of
runtimeseconds, regardless of the enclosing context’s runtime.- Parameters:
mob – The Mob to ripple.
direction – Direction points are displaced in, shape
(*, 3). Defaults toUP. The wave always travels along x; this is which way the Mob bulges.amplitude (float) – Peak displacement, in world units. Defaults to
0.2.ripples (int) – How many oscillations pass through the Mob. Defaults to
1.time_width (float) – Width of the wave as a fraction of the Mob. Defaults to
1.0.runtime (float) – Runtime of the ripple, in seconds. Defaults to
2.0.wave_func – Easing applied to the wave’s shape. Defaults to
easings.smooth.
- Returns:
The Mob that was passed in.
- Return type:
- Blink(mob, time_on=0.5, time_off=0.5, blinks=1, hide_at_end=False)[source]¶
Flash a Mob on and off.
Visibility is switched instantly rather than faded, so the Mob blinks crisply. Each cycle costs
time_on + time_offseconds.Animation
Recorded as an animation whose runtime comes from these parameters rather than the enclosing context. Opacity is driven through the Mob’s color, so parts with their own colors keep them.
- Parameters:
mob – The Mob to blink.
time_on (float) – Seconds visible per cycle. Defaults to
0.5.time_off (float) – Seconds hidden per cycle. Defaults to
0.5.blinks (int) – How many on/off cycles to perform. Defaults to
1.hide_at_end (bool) – Whether to leave the Mob hidden when the blinking stops. Defaults to False, which leaves it visible.
- Returns:
The Mob that was passed in.
- Return type:
- Circumscribe(mob, shape=None, fade_in=False, fade_out=False, time_width=0.3, buff=0.2, color=Color([1., 1., 0., 0., 1.]), runtime=1.0, stroke_width=3)[source]¶
Trace an outline around a Mob to single it out.
A frame is drawn around the Mob and then removed, so the highlight is a gesture rather than a lasting box.
fade_inandfade_outchoose between four behaviours: neither traces a passing flash around the frame, both fades the whole frame in and out, and either one alone combines a fade with drawing or erasing the outline.Animation
Recorded as an animation of
runtimeseconds, regardless of the enclosing context’s runtime. The frame is created and despawned around it, so nothing is left in the scene.- Parameters:
mob – The Mob to circumscribe.
shape – Outline shape:
Rectangle,SquareorCircle(the classes themselves, not instances). Defaults toNone, meaning a rectangle around the Mob’s bounding box.fade_in (bool) – Whether the frame fades in. Defaults to False.
fade_out (bool) – Whether the frame fades out. Defaults to False.
time_width (float) – Length of the travelling segment when neither fade is used, as a fraction of the outline. Defaults to
0.3.buff (float) – Gap between the Mob and the outline, in world units. Defaults to
0.2.color – Color of the outline. Defaults to
YELLOW.runtime (float) – Runtime of the whole gesture, in seconds. Defaults to
1.0.stroke_width (float) – Thickness of the outline. Defaults to
3.
- Returns:
The Mob that was passed in.
- Return type:
- Raises:
ValueError – If
shapeis notRectangle,Square,CircleorNone.
- Flash(point_or_mobject, line_length=0.2, num_lines=12, flash_radius=0.1, line_stroke_width=3, color=Color([1., 1., 0., 0., 1.]), time_width=1.0, runtime=1.0)[source]¶
Burst short lines outwards from a point, like a spark or a ping.
Lines are arranged radially in the screen plane and each one flashes outwards, marking a moment at a location.
Animation
Recorded as an animation of
runtimeseconds, regardless of the enclosing context’s runtime. The lines are created instantly beforehand and removed by their own flashes.- Parameters:
point_or_mobject – A Mob to flash around – its center is used – or a point of shape
(*, 3).line_length (float) – Length of each line, in world units. Defaults to
0.2.num_lines (int) – How many lines to arrange around the point. Defaults to
12.flash_radius (float) – Distance from the point at which the lines begin, in world units. Defaults to
0.1.line_stroke_width (float) – Thickness of each line. Defaults to
3.color – Color of the lines. Defaults to
YELLOW.time_width (float) – Fraction of each line visible at a time. Defaults to
1.0, i.e. the whole line.runtime (float) – Runtime of the burst, in seconds. Defaults to
1.0.
- Returns:
Whatever was passed in.
- Return type:
Mobor torch.Tensor
- FocusOn(focus_point, opacity=0.2, color=Color([0.5333, 0.5333, 0.5333, 0.0000, 1.0000]), runtime=2.0)[source]¶
Contract a large translucent disc onto a point, like a closing spotlight.
Draws the eye to one spot by shrinking a tinted circle down to nothing there. The circle is created and removed for you.
Animation
Recorded as an animation of
runtimeseconds, regardless of the enclosing context’s runtime. The spotlight is spawned and despawned instantly around it, so it costs no extra video time.- Parameters:
focus_point – A Mob to focus on – its center is used – or a point of shape
(*, 3).opacity (float) – Peak opacity of the disc as it closes in,
0to1. Defaults to0.2.color – Color of the disc. Defaults to
GRAY.runtime (float) – Runtime of the contraction, in seconds. Defaults to
2.0.
- Returns:
The spotlight Mob, already despawned.
- Return type:
- Indicate(mob, scale_factor=1.2, color=Color([1., 1., 0., 0., 1.]), runtime=1.0)[source]¶
Draw attention to a Mob by briefly growing and recoloring it.
The Mob swells and flashes color, then returns to exactly how it was – the standard “look here” gesture.
Animation
Recorded as an animation of
runtimeseconds, regardless of the enclosing context’s runtime. The scale pulse is relative to each part’s own size, so a composite Mob whose parts were scaled separately keeps its proportions.- Parameters:
mob – The Mob to indicate.
scale_factor (float) – How large the Mob grows at the peak, as a multiple of its current size. Defaults to
1.2.color – Color to flash. Defaults to
YELLOW.runtime (float) – Runtime of the whole gesture, in seconds. Defaults to
1.0.
- Returns:
The Mob that was passed in.
- Return type:
- ShowPassingFlash(mob, time_width=0.1, runtime=1.0)[source]¶
Run a bright segment along a curve, like a spark following a wire.
A short piece of the curve is visible at a time and travels from one end to the other, leaving nothing behind. Works on any Mob built from curves; for a composite, every curve in it flashes at once.
Animation
Recorded as an animation of
runtimeseconds, regardless of the enclosing context’s runtime. A transient stroke-only clone is spawned and despawned around the flash, so the Mob does not need to be spawned beforehand. A visible source Mob is hidden during the traversal and restored exactly afterwards.- Parameters:
mob – The curve, or a Mob containing curves, to flash along.
time_width (float) – Length of the travelling segment as a fraction of the curve. Defaults to
0.1; smaller values look like a sharper spark.runtime (float) – Runtime of the traversal, in seconds. Defaults to
1.0.
- Returns:
The Mob that was passed in.
- Return type:
- ShowPassingFlashWithThinningStrokeWidth(vmobject, n_segments=10, time_width=0.1, runtime=1.0)[source]¶
Run a tapering flash along a curve, like a comet with a tail.
Several passing flashes are layered, each thinner and longer than the last, so the travelling spark trails off behind itself instead of ending abruptly.
Animation
Recorded as an animation of
runtimeseconds, regardless of the enclosing context’s runtime. The layers are clones created instantly beforehand; the original Mob is untouched.- Parameters:
vmobject – The curve to flash along. Its
stroke_widthsets the thickest layer.n_segments (int) – How many layers to draw. Defaults to
10; more is smoother and slower.time_width (float) – Length of the leading segment as a fraction of the curve. Defaults to
0.1.runtime (float) – Runtime of the traversal, in seconds. Defaults to
1.0.
- Returns:
The Mob that was passed in.
- Return type:
- Wiggle(mob, scale_value=1.1, rotation_angle=0.06283185307179587, n_wiggles=6, scale_about_point=None, rotate_about_point=None, runtime=2.0)[source]¶
Shake a Mob back and forth, as if jostled.
The Mob rocks a few degrees either way while swelling slightly, then settles exactly where it started. Reads as “this thing is trying to get your attention” without moving it anywhere.
Animation
Recorded as an animation of
runtimeseconds, regardless of the enclosing context’s runtime. Position and orientation are rebuilt each frame from the pre-wiggle state, so nothing accumulates.- Parameters:
mob – The Mob to wiggle.
scale_value (float) – Peak size during the wiggle, as a multiple of the current size. Defaults to
1.1.rotation_angle (float) – Peak rocking angle, in radians – unusually for Algan, since this mirrors Manim’s signature. Defaults to
0.02 * pi(about 3.6 degrees).n_wiggles (int) – How many times the Mob rocks. Defaults to
6.scale_about_point – Point to scale around, shape
(*, 3). Defaults toNone, meaning scale in place.rotate_about_point – Point to rock around, shape
(*, 3). Defaults toNone, meaning rock in place.runtime (float) – Runtime of the whole wiggle, in seconds. Defaults to
2.0.
- Returns:
The Mob that was passed in.
- Return type:
- draw_step(mob, t, full_control_points)[source]¶
Internal: show one instant of a curve being drawn in.
Reveals the curve from its start up to progress
t.- Parameters:
mob – The bezier circuit being drawn.
t – Animation progress,
0to1, supplied per frame.full_control_points – The circuit’s complete control points, captured before the animation.
- passing_flash_step(mob, t, time_width, full_control_points)[source]¶
Internal: show one instant of a
ShowPassingFlash().Reveals a moving window of the curve, sliding from start to end.
- Parameters:
mob – The bezier circuit being flashed.
t – Animation progress,
0to1, supplied per frame.time_width – Width of the visible window as a fraction of the curve.
full_control_points – The circuit’s complete control points, captured before the flash.
- there_and_back(t, inflection=10.0)[source]¶
Rate function that eases out to 1 and back to 0.
Progress rises over the first half and returns over the second, which turns any animation into a there-and-back gesture.
- Parameters:
t – Animation progress,
0to1.inflection (float) – Steepness of the easing at the midpoint; larger is snappier. Defaults to
10.0.
- Returns:
Adjusted progress,
0at both ends and1in the middle.- Return type:
torch.Tensor
- undraw_step(mob, t, full_control_points)[source]¶
Internal: show one instant of a curve being erased.
The reverse of
draw_step(): the curve retreats towards its start.- Parameters:
mob – The bezier circuit being erased.
t – Animation progress,
0to1, supplied per frame.full_control_points – The circuit’s complete control points, captured before the animation.
- wiggle(t, wiggles=2)[source]¶
Rate function that oscillates, with the swing fading in and out.
A sine wave scaled by
there_and_back(), so the oscillation grows towards the middle and settles by the end rather than stopping mid-swing.- Parameters:
t – Animation progress,
0to1.wiggles (int) – How many half-oscillations to perform. Defaults to
2.
- Returns:
Signed oscillation, starting and ending at
0.- Return type:
torch.Tensor
- wiggle_step(mob, t, basis_0, location_0, scale_value, rotation_angle, n_wiggles, scale_about_point, rotate_about_point)[source]¶
Internal: place a Mob at one instant of a
Wiggle().Rebuilds the Mob’s basis and location from the values it had before the wiggle started, so the effect leaves no drift. Use
Wiggle().- Parameters:
mob – The Mob being wiggled.
t – Animation progress,
0to1, supplied per frame.basis_0 – The Mob’s basis before the wiggle began.
location_0 – The Mob’s location before the wiggle began.
scale_value – Peak scale, as a multiple of the original size.
rotation_angle – Peak rotation, in radians (converted internally to degrees).
n_wiggles – Number of half-oscillations.
scale_about_point – Point to scale around, or
Noneto scale in place.rotate_about_point – Point to rotate around, or
Noneto rotate in place.