manim.utils.rate_functions

A selection of rate functions, i.e., speed curves for animations. Please find a standard list at https://easings.net/. Here is a picture for the non-standard ones

Non-standard rate functions

There are primarily 3 kinds of standard easing functions:

  1. Ease In - The animation has a smooth start.

  2. Ease Out - The animation has a smooth end.

  3. Ease In Out - The animation has a smooth start as well as smooth end.

Note

The standard functions are not exported, so to use them you do something like this: rate_func=rate_functions.ease_in_sine On the other hand, the non-standard functions, which are used more commonly, are exported and can be used directly.

RateFunctions1Example
class RateFunctions1Example(Scene):
    def construct(self):
        line1 = Line(3*LEFT, 3*RIGHT).shift(UP).set_color(RED)
        line2 = Line(3*LEFT, 3*RIGHT).set_color(GREEN)
        line3 = Line(3*LEFT, 3*RIGHT).shift(DOWN).set_color(BLUE)

        dot1 = Dot().move_to(line1.get_left())
        dot2 = Dot().move_to(line2.get_left())
        dot3 = Dot().move_to(line3.get_left())

        label1 = Tex("Ease In").next_to(line1, RIGHT)
        label2 = Tex("Ease out").next_to(line2, RIGHT)
        label3 = Tex("Ease In Out").next_to(line3, RIGHT)

        self.play(
            FadeIn(VGroup(line1, line2, line3)),
            FadeIn(VGroup(dot1, dot2, dot3)),
            Write(VGroup(label1, label2, label3)),
        )
        self.play(
            MoveAlongPath(dot1, line1, rate_func=rate_functions.ease_in_sine),
            MoveAlongPath(dot2, line2, rate_func=rate_functions.ease_out_sine),
            MoveAlongPath(dot3, line3, rate_func=rate_functions.ease_in_out_sine),
            run_time=7
        )
        self.wait()

Functions

double_smooth(t)[source]
Parameters

t (float) –

Return type

numpy.ndarray

ease_in_back(t)[source]
Parameters

t (float) –

Return type

float

ease_in_bounce(t)[source]
Parameters

t (float) –

Return type

float

ease_in_circ(t)[source]
Parameters

t (float) –

Return type

float

ease_in_cubic(t)[source]
Parameters

t (float) –

Return type

float

ease_in_elastic(t)[source]
Parameters

t (float) –

Return type

float

ease_in_expo(t)[source]
Parameters

t (float) –

Return type

float

ease_in_out_back(t)[source]
Parameters

t (float) –

Return type

float

ease_in_out_bounce(t)[source]
Parameters

t (float) –

Return type

float

ease_in_out_circ(t)[source]
Parameters

t (float) –

Return type

float

ease_in_out_cubic(t)[source]
Parameters

t (float) –

Return type

float

ease_in_out_elastic(t)[source]
Parameters

t (float) –

Return type

float

ease_in_out_expo(t)[source]
Parameters

t (float) –

Return type

float

ease_in_out_quad(t)[source]
Parameters

t (float) –

Return type

float

ease_in_out_quart(t)[source]
Parameters

t (float) –

Return type

float

ease_in_out_quint(t)[source]
Parameters

t (float) –

Return type

float

ease_in_out_sine(t)[source]
Parameters

t (numpy.ndarray) –

Return type

float

ease_in_quad(t)[source]
Parameters

t (float) –

Return type

float

ease_in_quart(t)[source]
Parameters

t (float) –

Return type

float

ease_in_quint(t)[source]
Parameters

t (float) –

Return type

float

ease_in_sine(t)[source]
Parameters

t (numpy.ndarray) –

Return type

float

ease_out_back(t)[source]
Parameters

t (float) –

Return type

float

ease_out_bounce(t)[source]
Parameters

t (float) –

Return type

float

ease_out_circ(t)[source]
Parameters

t (float) –

Return type

float

ease_out_cubic(t)[source]
Parameters

t (float) –

Return type

float

ease_out_elastic(t)[source]
Parameters

t (float) –

Return type

float

ease_out_expo(t)[source]
Parameters

t (float) –

Return type

float

ease_out_quad(t)[source]
Parameters

t (float) –

Return type

float

ease_out_quart(t)[source]
Parameters

t (float) –

Return type

float

ease_out_quint(t)[source]
Parameters

t (float) –

Return type

float

ease_out_sine(t)[source]
Parameters

t (numpy.ndarray) –

Return type

float

exponential_decay(t, half_life=0.1)[source]
Parameters
  • t (numpy.ndarray) –

  • half_life (float) –

Return type

numpy.ndarray

linear(t)[source]
Parameters

t (Union[numpy.ndarray, float]) –

Return type

Union[numpy.ndarray, float]

lingering(t)[source]
Parameters

t (float) –

Return type

float

not_quite_there(func=<function smooth>, proportion=0.7)[source]
Parameters
  • func (Callable[[float, Optional[float]], numpy.ndarray]) –

  • proportion (float) –

Return type

Callable[[float], numpy.ndarray]

running_start(t, pull_factor=- 0.5)[source]
Parameters
  • t (float) –

  • pull_factor (float) –

Return type

Iterable

rush_from(t, inflection=10.0)[source]
Parameters
  • t (float) –

  • inflection (float) –

Return type

numpy.ndarray

rush_into(t, inflection=10.0)[source]
Parameters
  • t (float) –

  • inflection (float) –

Return type

numpy.ndarray

slow_into(t)[source]
Parameters

t (numpy.ndarray) –

Return type

numpy.ndarray

smooth(t, inflection=10.0)[source]
Parameters
  • t (float) –

  • inflection (float) –

Return type

numpy.ndarray

squish_rate_func(func, a=0.4, b=0.6)[source]
Parameters
  • func (Callable[[float], Any]) –

  • a (float) –

  • b (float) –

Return type

Callable[[float], Any]

there_and_back(t, inflection=10.0)[source]
Parameters
  • t (float) –

  • inflection (float) –

Return type

numpy.ndarray

there_and_back_with_pause(t, pause_ratio=0.3333333333333333)[source]
Parameters
  • t (float) –

  • pause_ratio (float) –

Return type

numpy.ndarray

wiggle(t, wiggles=2)[source]
Parameters
  • t (float) –

  • wiggles (float) –

Return type

numpy.ndarray