manim icon indicating copy to clipboard operation
manim copied to clipboard

Error with succession using Create's

Open Heidar-An opened this issue 1 year ago • 0 comments

Description of bug / unexpected behavior

When I have the following code inside a Scene,

circle = manim.Circle()
square = manim.Square()
self.play(manim.Succession(manim.Write(circle), manim.FadeIn(square), manim.

https://github.com/ManimCommunity/manim/assets/74025356/4eff7812-5c53-4da9-99fe-51c1dcd182f3


https://github.com/ManimCommunity/manim/assets/74025356/ba16d904-b0b6-4f48-8994-c0f481690e4f

FadeOut(square)))

The issue here is that the square is added to the scene before its animation is over. When it should only appear when it's FadeIn is there.

One fix from another bug issue here is adding introducer=True and while that works, it seems like

I was taking a look at the source code and this function in particular:

def _setup_scene(self, scene) -> None:
        if scene is None:
            return
        if self.is_introducer():
            for anim in self.animations:
                if not anim.is_introducer() and anim.mobject is not None:
                    scene.add(anim.mobject)

        self.scene = scene

I feel like this should be removed? I'd be happy to work on a bug fix for this, but if we removed it, than the user would get an error for an animation that hasn't previously added an mobject to the scene (and in my opinion, that's their fault for not having added the mobject to the scene beforehand)

If you think this change make sense, I'll fork the repo and see if removing the self.is_introducer() if statement block fixes the above issue (and still keeps the rest of the tests working as expected)

https://github.com/ManimCommunity/manim/assets/74025356/c2afc7c4-378e-4a23-a728-8e0a410b5b44

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):
  • RAM:
  • Python version (python/py/python3 --version):
  • Installed modules (provide output from pip list):
- OS: Windows 11 (but using WSL2)
- RAM 32GB
- Python 3.10.1
- manim 0.18.0

Heidar-An avatar Dec 29 '23 12:12 Heidar-An