Emphasis¶
The film's code
import manimgx as m
class EmphasisHero(m.Scene):
def construct(self) -> None:
formula = m.MathTex("a^2", "+", "b^2", "=", "c^2", font_size=96)
self.add(formula)
self.play(m.Indicate(formula[0]))
self.play(m.Circumscribe(formula[2], color=m.YELLOW))
self.play(m.Flash(formula[4], color=m.YELLOW, flash_radius=0.8))
self.play(m.Wiggle(formula))
self.wait()
These animations change a mobject for a moment and give it back as it was: they point a viewer's eye at it while the voice talks about it.
Indicate ¶
Draw attention to a mobject: enlarge and color it for a moment.
It grows to scale_factor times its size in color, and comes back as it was
(eased by there_and_back).
mobjectThe mobject to indicate.
scale_factorHow many times its size it grows to.
colorThe color it turns.
run_timeHow long the animation plays, in seconds (default 1).
lag_ratioHow the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).
rate_funcHow the animation's progress runs with time: a function from [0, 1] to [0, 1] (default
smooth; see rate functions).reverse_rate_functionWhether to run the animation backward (default False).
nameA name for the animation.
removerWhether the mobject leaves the scene when the animation finishes (default False).
suspend_mobject_updatingWhether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.
introducerWhether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.
use_overrideWhether a mobject whose class plays another animation in place of this one does so (default True).
It also takes the transform keywords.
Source
src/manimgx/animation/motion.py
Circumscribe ¶
Draw attention to a mobject with a frame drawn around it.
The frame, a rectangle or a circle buff away from the mobject, flashes around it
(ShowPassingFlash); with fade_in it fades in and is
then undrawn, with fade_out it is drawn and then fades out, and with both it fades
in and out. It is gone when the animation finishes. run_time times the frame (1
second by default); the other options apply to the whole.
m.Circumscribe(mobject, shape=None, fade_in=False, fade_out=False, time_width=0.3, buff=SMALL_BUFF, color=PURE_YELLOW, stroke_width=DEFAULT_STROKE_WIDTH, **kwargs)
mobjectThe mobject to frame.
shapeThe frame's kind:
Rectangle(None, the default) orCircle; any other raises a ValueError.fade_inWhether the frame fades in.
fade_outWhether the frame fades out.
time_widthThe flashing stretch's length, as a fraction of the frame's, when it neither fades in nor out.
buffThe gap between the mobject and the frame, in scene units.
colorThe frame's color.
stroke_widthThe frame's width, in hundredths of a scene unit.
run_timeHow long the animation plays, in seconds (default 1).
lag_ratioHow the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).
rate_funcHow the animation's progress runs with time: a function from [0, 1] to [0, 1] (default
smooth; see rate functions).reverse_rate_functionWhether to run the animation backward (default False).
nameA name for the animation.
removerWhether the mobject leaves the scene when the animation finishes (default False).
suspend_mobject_updatingWhether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.
introducerWhether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.
use_overrideWhether a mobject whose class plays another animation in place of this one does so (default True).
It also takes the animation keywords.
Source
src/manimgx/animation/motion.py
Flash ¶
Flash lines out from a point, like a burst of light.
num_lines lines, line_length long and starting flash_radius from the point,
shoot outward as passing flashes (ShowPassingFlash),
and are gone when the animation finishes. The animation options go to each line's
flash.
pointThe point to flash from, or a mobject whose center to flash from.
line_lengthEach line's length, in scene units.
num_linesHow many lines.
flash_radiusHow far from the point the lines start, in scene units.
line_stroke_widthThe lines' width, in hundredths of a scene unit.
colorThe lines' color.
time_widthEach line's flash window, as a fraction of its length.
run_timeHow long the animation plays, in seconds (default 1).
lag_ratioHow the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).
rate_funcHow the animation's progress runs with time: a function from [0, 1] to [0, 1] (default
smooth; see rate functions).reverse_rate_functionWhether to run the animation backward (default False).
nameA name for the animation.
removerWhether the mobject leaves the scene when the animation finishes (default False).
suspend_mobject_updatingWhether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.
introducerWhether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.
use_overrideWhether a mobject whose class plays another animation in place of this one does so (default True).
It also takes the animation keywords.
Source
src/manimgx/animation/motion.py
FocusOn ¶
Close a spotlight in on a point.
A transparent disc covering the frame shrinks onto focus_point, turning color at
opacity as it closes, and is gone when the animation finishes; it follows a
mobject that moves. It runs 2 seconds.
focus_pointThe point to focus on, or a mobject whose center to focus on.
opacityThe disc's opacity at the end.
colorThe disc's color.
run_timeHow long the animation plays, in seconds (default 1).
lag_ratioHow the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).
rate_funcHow the animation's progress runs with time: a function from [0, 1] to [0, 1] (default
smooth; see rate functions).reverse_rate_functionWhether to run the animation backward (default False).
nameA name for the animation.
removerWhether the mobject leaves the scene when the animation finishes (default False).
suspend_mobject_updatingWhether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.
introducerWhether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.
use_overrideWhether a mobject whose class plays another animation in place of this one does so (default True).
It also takes the animation keywords.
Source
src/manimgx/animation/motion.py
Wiggle ¶
Wiggle a mobject: rock it back and forth while it swells and shrinks back.
It grows to scale_value times its size and back, while turning back and forth by
up to rotation_angle, n_wiggles swings in all, about its center or the given
points. It runs 2 seconds.
m.Wiggle(mobject, scale_value=1.1, rotation_angle=0.01 * TAU, n_wiggles=6, scale_about_point=None, rotate_about_point=None, **kwargs)
mobjectThe mobject to wiggle.
scale_valueHow many times its size it grows to, halfway through.
rotation_angleHow far it turns each way at most, in radians.
n_wigglesHow many swings it makes.
scale_about_pointThe point it grows about; None for its center.
rotate_about_pointThe point it turns about; None for its center.
run_timeHow long the animation plays, in seconds (default 1).
lag_ratioHow the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).
rate_funcHow the animation's progress runs with time: a function from [0, 1] to [0, 1] (default
smooth; see rate functions).reverse_rate_functionWhether to run the animation backward (default False).
nameA name for the animation.
removerWhether the mobject leaves the scene when the animation finishes (default False).
suspend_mobject_updatingWhether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.
introducerWhether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.
use_overrideWhether a mobject whose class plays another animation in place of this one does so (default True).
It also takes the animation keywords.
Source
src/manimgx/animation/motion.py
ShowPassingFlash ¶
Flash a stretch of a mobject's path along it, from its start to past its end.
A window, time_width of the path's length, travels along the mobject, which shows
only what lies inside it. The mobject joins the scene for the flash and leaves
it at the end, even if it was there before (flash a copy to keep the original); its
paths are whole again afterward.
mobjectThe mobject whose paths the window travels along.
time_widthThe window's length, as a fraction of the path's length.
run_timeHow long the animation plays, in seconds (default 1).
lag_ratioHow the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).
rate_funcHow the animation's progress runs with time: a function from [0, 1] to [0, 1] (default
smooth; see rate functions).reverse_rate_functionWhether to run the animation backward (default False).
nameA name for the animation.
removerWhether the mobject leaves the scene when the animation finishes (default False).
suspend_mobject_updatingWhether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.
introducerWhether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.
use_overrideWhether a mobject whose class plays another animation in place of this one does so (default True).
It also takes the animation keywords.
Source
src/manimgx/animation/motion.py
ShowPassingFlashWithThinningStrokeWidth ¶
Code
import manimgx as m
class ShowPassingFlashWithThinningStrokeWidthExample(m.Scene):
def construct(self) -> None:
circle = m.Circle(radius=2.5, color=m.YELLOW, stroke_width=16)
self.add(circle.copy().set_stroke(m.GREY, width=4))
self.play(
m.ShowPassingFlashWithThinningStrokeWidth(
circle, time_width=0.5, run_time=2
)
)
Flash a stretch of a mobject's path along it, with a tail that thins behind it.
n_segments passing flashes (ShowPassingFlash) of
copies of the mobject play together: their widths rise from none to the mobject's
stroke width as their windows shrink from time_width to none, so the flash is
widest at its head. The copies are gone when the animation finishes, and the mobject
itself is left as it is. The animation options go to each flash.
vmobjectThe mobject whose paths the flash travels along.
n_segmentsHow many flashes make it up.
time_widthThe tail's length, as a fraction of the path's length.
run_timeHow long the animation plays, in seconds (default 1).
lag_ratioHow the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).
rate_funcHow the animation's progress runs with time: a function from [0, 1] to [0, 1] (default
smooth; see rate functions).reverse_rate_functionWhether to run the animation backward (default False).
nameA name for the animation.
removerWhether the mobject leaves the scene when the animation finishes (default False).
suspend_mobject_updatingWhether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.
introducerWhether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.
use_overrideWhether a mobject whose class plays another animation in place of this one does so (default True).
It also takes the animation keywords.
Source
src/manimgx/animation/motion.py
Blink ¶
Blink a mobject: hide it and show it again, a number of times.
It shows for time_on seconds and hides for time_off, blinks times, then shows
again for time_on (or stays hidden, with hide_at_end). It is made fully opaque
to show it, and fully transparent to hide it.
mobjectThe mobject to blink.
time_onHow long it shows each time, in seconds.
time_offHow long it hides each time, in seconds.
blinksHow many times it blinks.
hide_at_endWhether it stays hidden at the end.
run_timeHow long the animation plays, in seconds (default 1).
lag_ratioHow the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).
rate_funcHow the animation's progress runs with time: a function from [0, 1] to [0, 1] (default
smooth; see rate functions).reverse_rate_functionWhether to run the animation backward (default False).
nameA name for the animation.
removerWhether the mobject leaves the scene when the animation finishes (default False).
suspend_mobject_updatingWhether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.
introducerWhether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.
use_overrideWhether a mobject whose class plays another animation in place of this one does so (default True).
It also takes the animation keywords.
Source
src/manimgx/animation/motion.py
Broadcast ¶
Send copies of a mobject spreading out from a point, one after another.
Each of n_mobs copies starts at focal_point, initial_width wide and at
initial_opacity, and grows like a ripple to the mobject's size, centered on
focal_point, as its opacity goes to final_opacity. They begin one after another
(lag_ratio 0.2, over 3 seconds), and leave the scene when the animation finishes,
unless given remover=False. The copies of a filled mobject fade as a whole, those
of an outline in their stroke. The mobject itself is not shown.
m.Broadcast(mobject, focal_point=ORIGIN, n_mobs=5, initial_opacity=1, final_opacity=0, initial_width=0.0, **kwargs)
mobjectThe ripples' shape, at its largest.
focal_pointWhere the ripples spread from.
n_mobsHow many copies.
initial_opacityThe copies' opacity at the start.
final_opacityThe copies' opacity at the end.
initial_widthThe copies' width at the start, in scene units.
run_timeHow long the animation plays, in seconds (default 1).
lag_ratioHow the parts of the mobject are staggered: each begins this fraction of its run after the one before it begins (default 0: all together; 1: one after another).
rate_funcHow the animation's progress runs with time: a function from [0, 1] to [0, 1] (default
smooth; see rate functions).reverse_rate_functionWhether to run the animation backward (default False).
nameA name for the animation.
removerWhether the mobject leaves the scene when the animation finishes (default False).
suspend_mobject_updatingWhether the mobject's updaters run beneath the animation (default True): they keep acting on the mobject, and each frame shows the animation applied to the result. If False, they act on the animated mobject itself.
introducerWhether the mobject joins the scene when the animation begins (default False); otherwise the play brings it in when the play begins, if the scene lacks it.
use_overrideWhether a mobject whose class plays another animation in place of this one does so (default True).
It also takes the animation keywords.
Source
src/manimgx/animation/motion.py