-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Here's a Scene
from manim import *
class SquareToCircle(Scene):
def construct(self):
circle = Circle().set_fill(RED, opacity=1)
square = Square(side_length=1.7).set_fill(BLUE, opacity=1)
square.z_index = circle.z_index - 1
self.play(FadeIn(VGroup(circle, square))) # all good
self.play(ApplyMethod(circle.shift, UP)) # woops!
self.wait(1)And here's the output:
As you can see, the square comes on top of the circle at the end of the second animation. I was expecting the square to remain behind the circle throughout the video because of the line square.z_index = circle.z_index - 1. Is this intended behavior? Is this a known issue?
FWIW, I think currently there are two different systems living in manim. First, the Scene and Camera classes try to keep the mobjects in order, and then the order of rendering on screen is (or, used to be) taken from that order. But after the introduction of z_index in #122, all of that bookkeeping to try to maintain the order is unnecessary since at the last minute the mobjects are being sorted by their z_index. I believe it is the interaction of these two things that is causing the bug. We can perhaps take this opportunity to deprecate all of those bookkeeping operations and stick to the z_index.
cc @tony031218 as author of #122
