# Faster animation than with duration 0

Hi,

I have a plot with only one line of 6451 points
Above this line I have a marker that is animated following the line, like we can see in this example : Intro to animations in Python

Everything is working great, when I press play, the point starts to move along the line. But my issue is the speed. I need to make it as fast as the real data recorded.

I have set the frame duration and the transition duration to 0 but still it is not fast enough !

``````# Buttons
fig.update_layout(
method="animate",
args=[None, {"frame": {"duration": 0, "redraw": False}, "mode": "immediate", "transition": {"duration": 0}}])],
type='buttons',
showactive=False,
y=1,
x=1.12,
xanchor='right',
yanchor='top')])
`````` How can I make this even faster ?

Thanks

@zazoufumi The first example from Plotly link, you posted, is the oldest example of animation (the code was written just in the day of 2016 when plotly animation was released). At that time it wasn’t quite clear how it works. That example should have been removed from the site long ago.
I updated the first example and now it is very fast:

``````import plotly.graph_objects as go
import numpy as np
# Generate curve data
t = np.linspace(-1, 1, 100)
x = t + t ** 2
y = t - t ** 2
xm = np.min(x) - 1.5
xM = np.max(x) + 1.5
ym = np.min(y) - 1.5
yM = np.max(y) + 1.5
N = 25
s = np.linspace(-1, 1, N)
xx = s + s ** 2
yy = s - s ** 2

# Create figure
fig = go.Figure(
data=[go.Scatter(x=x, y=y,
mode="lines",
line=dict(width=2, color="blue")),
go.Scatter(x=[xx], y=[yy],
mode="markers",
marker=dict(color="red", size=10))])
fig.update_layout(width=600, height=450,
xaxis=dict(range=[xm, xM], autorange=False, zeroline=False),
yaxis=dict(range=[ym, yM], autorange=False, zeroline=False),
title_text="Kinematic Generation of a Planar Curve", title_x=0.5,
buttons = [
dict(
args = [None, {"frame": {"duration": 10, "redraw": False},
"fromcurrent": True, "transition": {"duration": 10}}],
label = "Play",
method = "animate",

)])])

fig.update(frames=[go.Frame(
data=[go.Scatter(
x=[xx[k]],
y=[yy[k]])],
traces=) # fig.data is updated by each frame
for k in range(N)])

fig.show()
``````
3 Likes