diff --git a/manim/animation/composition.py b/manim/animation/composition.py index 1391dbfd1b..128066ba80 100644 --- a/manim/animation/composition.py +++ b/manim/animation/composition.py @@ -98,7 +98,8 @@ def _setup_scene(self, scene) -> None: anim._setup_scene(scene) def finish(self) -> None: - self.interpolate(1) + for anim in self.animations: + anim.finish() self.anims_begun[:] = True self.anims_finished[:] = True if self.suspend_mobject_updating: diff --git a/tests/module/animation/test_composition.py b/tests/module/animation/test_composition.py index 53d5767aae..8c5f044b2a 100644 --- a/tests/module/animation/test_composition.py +++ b/tests/module/animation/test_composition.py @@ -171,6 +171,24 @@ def test_animationgroup_is_passing_remover_to_nested_animationgroups(): assert polygon_animation.remover +def test_animationgroup_calls_finish(): + class MyAnimation(Animation): + def __init__(self, mobject): + super().__init__(mobject) + self.finished = False + + def finish(self): + self.finished = True + + scene = Scene() + sqr_animation = MyAnimation(Square()) + circ_animation = MyAnimation(Circle()) + animation_group = AnimationGroup(sqr_animation, circ_animation) + scene.play(animation_group) + assert sqr_animation.finished + assert circ_animation.finished + + def test_empty_animation_group_fails(): with pytest.raises(ValueError, match="Please add at least one subanimation."): AnimationGroup().begin()