-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
unexpected behavior
When using Manim's Code object to animate code changes, animations are applied to the entire code block, even if only a single line is added.
Video
CodeAnimation.mp4
Expected behavior
The animation should be applied only to the newly added or modified line of code.
Actual behavior
The animation is applied to the entire code block, including unchanged lines, making it unclear which part of the code was modified.
Code:
from manim import *
class CodeAnimation(Scene):
def construct(self):
code1 = '''from manim import *
class Animation(Scene):
def construct(self):
square = Square(side_length=2.0, color=RED)
self.play(Create(square))
self.wait()
'''
code2 = '''from manim import *
class Animation(Scene):
def construct(self):
square = Square(side_length=2.0, color=RED)
square.shift(LEFT * 2)
self.play(Create(square))
self.wait()
'''
rendered_code1 = Code(
code=code1,
tab_width=4,
background="window",
language="Python",
font="Monospace",
style="one-dark",
line_spacing=1
)
rendered_code2 = Code(
code=code2,
tab_width=4,
background="window",
language="Python",
font="Monospace",
style="one-dark",
line_spacing=1
)
self.play(Write(rendered_code1))
self.wait()
self.play(Transform(rendered_code1, rendered_code2))
self.wait()System specifications
- Manim version: [v0.18.1]
- Python version: [3.10.3]
- Operating system: [Window 11]
Metadata
Metadata
Assignees
Labels
No labels