ManimCommunity / ManimCommunity/manim

LaggedStartMap breaks object updaters

Open
#2,985 0 comments 0 reactions 0 assignees View on GitHub

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
The LaggedStartMap animation appears to break the behavior of object updaters.
See also https://discord.com/channels/581738731934056449/1028618360516259860

## Expected behavior
The initial animation of a mobject should not affect the useability of updaters.

## How to reproduce the issue
Code for reproducing the problem
This code works fine, the dot and line are animated using updaters following the values of three ValueTrackers

```py
class lagged(ThreeDScene):
def construct(self):
axes = ThreeDAxes()
cube = Cube(side_length=2, fill_opacity=0.3, stroke_width=0.2)
self.add(axes, cube)
x = ValueTracker(1)
y = ValueTracker(1)
z = ValueTracker(1)
orig = Dot3D(ORIGIN)
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)

dot = Dot3D(x.get_value()*RIGHT+y.get_value()*UP+z.get_value()*OUT)
dot.add_updater(lambda obj: obj.become(Dot3D(x.get_value()*RIGHT+y.get_value()*UP+z.get_value()*OUT)))

line = Line(start=ORIGIN, end=x.get_value()*RIGHT+y.get_value()*UP+z.get_value()*OUT)
line.add_updater(lambda obj: obj.become(Line(start=ORIGIN, end=x.get_value()*RIGHT+y.get_value()*UP+z.get_value()*OUT)))

self.play(FadeIn(orig),FadeIn(dot), LaggedStartMap(FadeIn, line))

self.play(x.animate.set_value(3), y.animate.set_value(-3), z.animate.set_value(3))
self.wait(2)
```
just swapping the sequence and type of initial animations for the **line** from LaggedStartMap to FadeIn and for the **dot** from FadeIn to LaggedStartMap breaks the animation, the line is still following the ValueTracker, but the dot remains stationary.

```py
class lagged(ThreeDScene):
def construct(self):
axes = ThreeDAxes()
cube = Cube(side_length=2, fill_opacity=0.3, stroke_width=0.2)
self.add(axes, cube)
x = ValueTracker(1)
y = ValueTracker(1)
z = ValueTracker(1)
orig = Dot3D(ORIGIN)
self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)

dot = Dot3D(x.get_value()*RIGHT+y.get_value()*UP+z.get_value()*OUT)
dot.add_updater(lambda obj: obj.become(Dot3D(x.get_value()*RIGHT+y.get_value()*UP+z.get_value()*OUT)))

line = Line(start=ORIGIN, end=x.get_value()*RIGHT+y.get_value()*UP+z.get_value()*OUT)
line.add_updater(lambda obj: obj.become(Line(start=ORIGIN, end=x.get_value()*RIGHT+y.get_value()*UP+z.get_value()*OUT)))

self.play(FadeIn(orig),FadeIn(line), LaggedStartMap(FadeIn, dot)) # the only change is in this line

self.play(x.animate.set_value(3), y.animate.set_value(-3), z.animate.set_value(3))
self.wait(2)
```

## System specifications

System Details

- OS Windows 10
- RAM:
- Python version 3.9.8
- Manim Community v0.16.0.post0

## Additional comments

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied ThreeDScene reproduction with Manim Community v0.16.0.post0, then inspect LaggedStartMap, FadeIn, and object updater behavior. The fix is complete when both the dot and line continue following their ValueTrackers after the initial animations.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.