Skip to content

run_time=tracker.time_until_bookmark("A") not working correctly with custom manim animations? #98

@Toughbook-CFC2

Description

@Toughbook-CFC2
class breathe(Animation):
    def __init__(self, mobject, cycles=1, size_factor=1.3, **kwargs):
        self.cycles = max(1, int(cycles))
        self.sizefactor = max(1, size_factor)
        self.OGscale = 1
        super().__init__(mobject, **kwargs)

    def interpolate_mobject(self, alpha):

#        if alpha < 4/10:
#            scale_factor = (1 + (self.sizefactor - 1) * alpha * 10/4)
#        elif alpha >= 4/10: 
#            scale_factor = (self.sizefactor - (self.sizefactor - 1) * (alpha - 4/10) * 10/6)

        self.mobject.shift(LEFT * alpha)

#        self.mobject.scale(scale_factor / self.OGscale)
#        self.OGscale = scale_factor

I wrote a custom animation that would scale a mobject up and then down again, to give it
some kind of breathing motion. The custom animation doesn't seem to stick to the timing of the
bookmark I put into the Text.
Even if I strip down the interpolation to one simple line like this, it
doesn't work and it always overshoots the point of the bookmark in the text.

If I use one of the standard
manim animations like Write it works as intended, an when I put a number into run_time like 2 for
example, my animation works as well. But when I put the voiceover timing together with the custom
animation it breaks.
I think that there is some issue that need handling for building custom animations
to make them compatible with manim voiceover.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions