Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ManimCE 0.19.0 - caching issue #4160

Open
uwezi opened this issue Feb 7, 2025 · 1 comment
Open

ManimCE 0.19.0 - caching issue #4160

uwezi opened this issue Feb 7, 2025 · 1 comment

Comments

@uwezi
Copy link
Contributor

uwezi commented Feb 7, 2025

Description of bug / unexpected behavior

Rendering the scene below twice with caching enabled results in a false placement of one object at the end.
(follow-up of https://discord.com/channels/581738731934056449/1337379695628521513/1337379695628521513 )

Expected behavior

The second (and subsequent) rendering of the scene should result in the same output as the first rendering.

How to reproduce the issue

Code for reproducing the problem
class Sin2(Scene):
    def construct(self):
        ax = Axes(x_range=(-2, 2, 1), y_range=(-2, 2, 1), x_length=6)
        trigo_circle = Circle(radius=1.5)
        self.add(ax, trigo_circle, Dot(color=RED).shift(1.5*RIGHT))

        theta = ValueTracker(0)

        neg_point = always_redraw(
            lambda: Dot(
                trigo_circle.point_at_angle(-theta.get_value()),
                color=YELLOW
            )
        )

        neg_arc = always_redraw(
            lambda: Arc(radius=1.4, angle=-(theta.get_value() % TAU), stroke_width=2,
                color=YELLOW
            )
        )

        pos_neg = always_redraw(
            lambda: Tex(
                "$e^{-i \\theta}$",
                color=YELLOW
            ).move_to(0.6*neg_point.get_center())
        )

        self.add(pos_neg, neg_point, neg_arc)

        self.play(theta.animate(run_time=5).set_value(TAU))

        self.play(theta.animate(run_time=2).set_value(TAU+2.4))

        self.wait()

Additional media files

Images/GIFs

Result of the first rendering

Sin2.mp4

Result of the second rendering

Sin2.mp4

System specifications

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Windows 10
  • Python version (python/py/python3 --version): 3.13.0
@huguesdevimeux
Copy link
Member

huguesdevimeux commented Feb 8, 2025

Hi,

I don't have much time to investigate but that typically looks like a variation of #550.
Upon using a cached animation, Manim artificially sets up the global t (current timestamp) to be at the end of the animation. The issue might arise from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants