ManimCommunity / ManimCommunity/manim

Error with succession using Create's

Open
#3,558 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## 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:
```py
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
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Scene example with Succession, Write, FadeIn, and FadeOut, then inspect the mentioned _setup_scene function and the introducer handling. Confirm the intended scene membership during FadeIn and verify that the change preserves existing animation behavior and tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.