Skip to content
Closed
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions manim/animation/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ def __init__(
raise TypeError(f"{self.__class__.__name__} only works for VMobjects.")
super().__init__(mobject, **kwargs)

def begin(self) -> None:
super().begin()
# Each frame is rebuilt from starting_mobject via pointwise_become_partial,
# so its updaters must also be suspended; otherwise they keep mutating the
# reference copy and leak back into the result, ignoring
# suspend_mobject_updating (#4763).
if self.suspend_mobject_updating and self.starting_mobject is not None:
self.starting_mobject.suspend_updating()

def interpolate_submobject(
self,
submobject: Mobject,
Expand Down
12 changes: 11 additions & 1 deletion tests/module/animation/test_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pytest

from manim import AddTextLetterByLetter, Text
from manim import RIGHT, AddTextLetterByLetter, Circle, Create, Text


def test_non_empty_text_creation():
Expand Down Expand Up @@ -32,3 +32,13 @@ def test_run_time_for_non_empty_text(config):
expected_run_time = np.max((1 / config.frame_rate, run_time_per_char)) * len(s.text)
anim = AddTextLetterByLetter(s, time_per_char=run_time_per_char)
assert anim.run_time == expected_run_time


def test_create_suspends_starting_mobject_updaters() -> None:
"""Create rebuilds from starting_mobject each frame; its updaters must pause too (#4763)."""
circle = Circle()
circle.add_updater(lambda m, dt: m.shift(RIGHT * dt))
anim = Create(circle, suspend_mobject_updating=True)
anim.begin()
assert anim.starting_mobject is not None
assert anim.starting_mobject.updating_suspended
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/test_graphical_units/test_updaters.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def f(mob):
scene.add(Square())

s = Circle().add_updater(f)
scene.play(Create(s))
scene.play(GrowFromCenter(s))


@frames_comparison(last_frame=False)
Expand Down
Loading