Hi @danielgafni,
You could try controlling the animation with an ipywidget Play
widget (See https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20List.html#Play-(Animation)-widget) instead of the for loop.
I don’t know if there’s a plotly FigureWidget
example that does this, but here’s an example notebook from the bqplot project that uses the Play button and a slider to animate a plot (https://nbviewer.jupyter.org/github/bloomberg/bqplot/blob/master/examples/Applications/Wealth%20of%20Nations.ipynb). Your year_changed
function would call your set_surface
function.
-Jon