Revert Transform.begin() to fix growing animations - use SpinInFromNothing in test_new_rendering

This commit is contained in:
Francisco Manríquez Novoa 2026-01-29 15:22:24 -03:00
commit 8dbc427a92
2 changed files with 18 additions and 23 deletions

View file

@ -8,32 +8,34 @@ class Test(Scene):
def first_section(self) -> None:
line = Line()
line.add_updater(lambda m, dt: m.rotate(PI * dt))
t = Tex(r"Math! $\sum e^{i\theta}$").add_updater(lambda m: m.next_to(line, UP))
tex = Tex(r"Math! $\sum e^{i\theta}$").add_updater(
lambda m: m.next_to(line, UP)
)
line.to_edge(LEFT)
self.add(line, t)
s = Square()
t = Tex(
self.add(line, tex)
square = Square()
tex = Tex(
"Hello, world!", stroke_color=RED, fill_color=BLUE, stroke_width=2
).to_edge(RIGHT)
self.add(t)
self.play(Create(t), Rotate(s, PI / 2))
self.add(tex)
self.play(Create(tex), Rotate(square, PI / 2))
self.wait(1)
self.play(FadeOut(s))
self.play(FadeOut(square))
@group
def three_mobjects(self) -> None:
sq = RegularPolygon(6)
c = Circle()
st = Star()
VGroup(sq, c, st).arrange()
hexagon = RegularPolygon(6)
circle = Circle()
star = Star()
VGroup(hexagon, circle, star).arrange()
self.play(
Succession(
Create(sq),
DrawBorderThenFill(c),
Create(st),
Create(hexagon),
DrawBorderThenFill(circle),
SpinInFromNothing(star),
)
)
self.play(FadeOut(VGroup(sq, c, st)))
self.play(FadeOut(VGroup(hexagon, circle, star)))
@group
def never_run(self) -> None:

View file

@ -191,14 +191,7 @@ class Transform(Animation):
def begin(self) -> None:
self.target_mobject = self.create_target()
if self.mobject.is_aligned_with(self.target_mobject):
self.target_copy = self.target_mobject
else:
# Use a copy of target_mobject for the align_data_and_family
# call so that the actual target_mobject stays
# preserved, since calling align_data will potentially
# change the structure of both arguments
self.target_copy = self.target_mobject.copy()
self.target_copy = self.target_mobject.copy()
self.mobject.align_data_and_family(self.target_copy)
super().begin()