Skip to contents

Enables method chaining syntax for animations: square$animate$shift(RIGHT)$set_color(RED) produces an animation that simultaneously shifts and recolors the square.

This is used internally by MObject$animate (active binding).

Public fields

mobject

The mobject to animate

run_time

Animation duration

rate_func

Easing function

Methods


Method new()

Create an AnimationBuilder

Usage

AnimationBuilder$new(mobject, run_time = 1, rate_func = "smooth")

Arguments

mobject

The mobject to animate

run_time

Duration

rate_func

Easing function


Method record()

Record a method call for later playback

Usage

AnimationBuilder$record(method_name, ...)

Arguments

method_name

Name of the method

...

Arguments to the method


Method build()

Build the animation from recorded calls

Usage

AnimationBuilder$build()

Returns

An Animation object


Method shift()

Animate a shift

Usage

AnimationBuilder$shift(direction)

Arguments

direction

Direction vector


Method move_to()

Animate a move_to

Usage

AnimationBuilder$move_to(point)

Arguments

point

Target position


Method rotate()

Animate a rotation

Usage

AnimationBuilder$rotate(angle, ...)

Arguments

angle

Angle in radians

...

Additional args


Method scale()

Animate a scale

Usage

AnimationBuilder$scale(factor, ...)

Arguments

factor

Scale factor

...

Additional args


Method set_color()

Animate a color change

Usage

AnimationBuilder$set_color(color)

Arguments

color

New color


Method set_fill()

Animate fill change

Usage

AnimationBuilder$set_fill(color = NULL, opacity = NULL)

Arguments

color

Fill color

opacity

Fill opacity


Method set_stroke()

Animate stroke change

Usage

AnimationBuilder$set_stroke(color = NULL, width = NULL, opacity = NULL)

Arguments

color

Stroke color

width

Stroke width

opacity

Stroke opacity


Method set_opacity()

Animate set_opacity

Usage

AnimationBuilder$set_opacity(opacity)

Arguments

opacity

New opacity


Method next_to()

Animate next_to

Usage

AnimationBuilder$next_to(other, direction = RIGHT, buff = MED_SMALL_BUFF)

Arguments

other

Target mobject or position

direction

Direction

buff

Buffer distance


Method to_edge()

Animate to_edge

Usage

AnimationBuilder$to_edge(edge, buff = MED_LARGE_BUFF)

Arguments

edge

Edge direction

buff

Buffer


Method clone()

The objects of this class are cloneable with this method.

Usage

AnimationBuilder$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.