Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions manim/animation/movement.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ class Homotopy(Animation):
Keyword arguments propagated to :meth:`.Mobject.apply_function`.
kwargs
Further keyword arguments passed to the parent class.

Examples
--------

.. manim:: HomotopyExample

class HomotopyExample(Scene):
def construct(self):
square = Square()

def homotopy(x, y, z, t):
if t <= 0.25:
progress = t / 0.25
return (x, y + progress * 0.2 * np.sin(x), z)
else:
wave_progress = (t - 0.25) / 0.75
return (x, y + 0.2 * np.sin(x + 10 * wave_progress), z)

self.play(Homotopy(homotopy, square, rate_func= linear, run_time=2))

"""

def __init__(
Expand Down
Loading