ManimCommunity / ManimCommunity/manim
ReplacementTransform and z_index issue
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 use the `ReplacementTransform(source_mobject, target_mobject)` function to transform a mobject, I find that `target_mobject.z_index` is unchanged, but the `target_mobject` will show as that `target_mobject.z_index` is changed to `source_mobject.z_index`.
Please see the code and gif below, I expect that the blue circle is above the red circle because the z_index of the blue circle is greater, but the result show that the blue circle is below the red circle.
## Expected behavior
The blue circle is above the red circle.
## How to reproduce the issue
Code for reproducing the problem
```py
from manim import *
class zIndexBug(Scene):
def construct(self):
circle = Circle(color=RED, fill_opacity=1).move_to(UP*0.5)
circle.set_z_index(3)
circle2 = Circle(color=BLUE, fill_opacity=1)
circle2.set_z_index(6)
circle3 = Circle(color=GREEN, fill_opacity=1).move_to(LEFT*3)
circle3.set_z_index(1)
self.play(FadeIn(circle3), FadeIn(circle))
self.play(ReplacementTransform(circle3, circle2))
```
## Additional media files
Images/GIFs

## Logs
Terminal output
```
PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR
```
## System specifications
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`):
```
PASTE HERE
```
LaTeX details
+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:
FFMPEG
Output of `ffmpeg -version`:
```
PASTE HERE
```
## Additional comments
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided Scene reproduction and inspect ReplacementTransform's handling of source_mobject and target_mobject z_index during the animation. Done means the blue target circle renders above the red circle according to its higher z_index, while the reported target_mobject.z_index behavior is consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100