mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
MoveAlongPath animation
This commit is contained in:
parent
55fb146400
commit
2a711a37f8
1 changed files with 10 additions and 0 deletions
|
@ -126,6 +126,16 @@ class PhaseFlow(Animation):
|
||||||
)
|
)
|
||||||
self.last_alpha = alpha
|
self.last_alpha = alpha
|
||||||
|
|
||||||
|
class MoveAlongPath(Animation):
|
||||||
|
def __init__(self, mobject, path, **kwargs):
|
||||||
|
digest_config(self, kwargs, locals())
|
||||||
|
Animation.__init__(self, mobject, **kwargs)
|
||||||
|
|
||||||
|
def update_mobject(self, alpha):
|
||||||
|
n = self.path.get_num_points()-1
|
||||||
|
point = self.path.points[int(alpha*n)]
|
||||||
|
self.mobject.shift(point-self.mobject.get_center())
|
||||||
|
|
||||||
### Animation modifiers ###
|
### Animation modifiers ###
|
||||||
|
|
||||||
class ApplyToCenters(Animation):
|
class ApplyToCenters(Animation):
|
||||||
|
|
Loading…
Add table
Reference in a new issue