Skip to content

Instantly share code, notes, and snippets.

@uwezi
Last active March 19, 2023 12:40
Show Gist options
  • Save uwezi/247c9f403ff4bad3d22011715513a9a5 to your computer and use it in GitHub Desktop.
Save uwezi/247c9f403ff4bad3d22011715513a9a5 to your computer and use it in GitHub Desktop.
[stacking objects] How to stack 2D-objects using z_index #manim #z_index #flash #animate
# https://discord.com/channels/581738731934056449/1021452642196668446/1021452642196668446
from manim import *
class MobsInFront(Scene):
def construct(self):
circ = Circle(radius=1,fill_color=PINK,fill_opacity=1,
stroke_color=PINK,stroke_opacity=1).set_z_index(2)
edge = Dot(circ.get_right())
anim = Flash(edge,color=BLUE,run_time=2,line_length=1)
circ.add_updater(
lambda l: l.become(
Circle(arc_center=[0,0,1],radius=1,fill_color=PINK,
fill_opacity=1,stroke_color=PINK,stroke_opacity=1)
)
)
self.add(circ)
self.play(anim)
self.wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment