mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
* Future Annotations * Delete template_twitter_post.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Apply suggestions from code review * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixed broken RTD Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
from manim import *
|
|
from manim.utils.testing.frames_comparison import frames_comparison
|
|
|
|
__module_test__ = "updaters"
|
|
|
|
|
|
@frames_comparison(last_frame=False)
|
|
def test_Updater(scene):
|
|
dot = Dot()
|
|
square = Square()
|
|
scene.add(dot, square)
|
|
square.add_updater(lambda m: m.next_to(dot, RIGHT, buff=SMALL_BUFF))
|
|
scene.add(square)
|
|
scene.play(dot.animate.shift(UP * 2))
|
|
square.clear_updaters()
|
|
|
|
|
|
@frames_comparison
|
|
def test_ValueTracker(scene):
|
|
theta = ValueTracker(PI / 2)
|
|
line = Line(ORIGIN, RIGHT)
|
|
line.rotate(theta.get_value(), about_point=ORIGIN)
|
|
scene.add(line)
|
|
|
|
|
|
@frames_comparison(last_frame=False)
|
|
def test_UpdateSceneDuringAnimation(scene):
|
|
def f(mob):
|
|
scene.add(Square())
|
|
|
|
s = Circle().add_updater(f)
|
|
scene.play(Create(s))
|
|
|
|
|
|
@frames_comparison(last_frame=False)
|
|
def test_LastFrameWhenCleared(scene):
|
|
dot = Dot()
|
|
square = Square()
|
|
square.add_updater(lambda m: m.move_to(dot, UL))
|
|
scene.add(square)
|
|
scene.play(dot.animate.shift(UP * 2), rate_func=linear)
|
|
square.clear_updaters()
|
|
scene.wait()
|