Skip to content Skip to sidebar Skip to footer

How Do I Change The Interval Between Frames (python)?

So I'm making an animation in python using matplotlib.animation, and I want the time between each frame to change on every frame. According to everything I've found so far, the 'in

Solution 1:

You can change ani.event_source.interval, like the following code

defanimate(i):

    line1.set_data(x1[:i], y1[:i])
    line1a.set_data(x1[i], y1[i])
    line2.set_data(x2[:i], y2[:i])
    line2a.set_data(x2[i], y2[i])
    lines =  [line1, line1a, line2, line2a]
    tt=ti[i]
    ani.event_source.interval = tt
    return lines,

Warning: it seems not compatible with GIF file.

Post a Comment for "How Do I Change The Interval Between Frames (python)?"