mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Change rate_func to be used in submobject update
This allows for rate functions like overshoot and running start who have outputs outside of [0, 1] to still be used effectively.
This commit is contained in:
parent
b94e9f3a24
commit
4e7f06dea8
1 changed files with 3 additions and 3 deletions
|
@ -129,8 +129,7 @@ class Animation(object):
|
|||
|
||||
# Methods for interpolation, the mean of an Animation
|
||||
def interpolate(self, alpha: float) -> None:
|
||||
alpha = clip(alpha, 0, 1)
|
||||
self.interpolate_mobject(self.rate_func(alpha))
|
||||
self.interpolate_mobject(alpha)
|
||||
|
||||
def update(self, alpha: float) -> None:
|
||||
"""
|
||||
|
@ -166,7 +165,8 @@ class Animation(object):
|
|||
full_length = (num_submobjects - 1) * lag_ratio + 1
|
||||
value = alpha * full_length
|
||||
lower = index * lag_ratio
|
||||
return clip((value - lower), 0, 1)
|
||||
raw_sub_alpha = clip((value - lower), 0, 1)
|
||||
return self.rate_func(raw_sub_alpha)
|
||||
|
||||
# Getters and setters
|
||||
def set_run_time(self, run_time: float):
|
||||
|
|
Loading…
Add table
Reference in a new issue