This works:
using PlotlyJS
layout = Layout(width = 500, height = 500)
layout[:title] = ""
layout[:showSendToCloud] = true
layout[:showLegend] = true
layout[:showEditInChartStudio] = true
f(frame) = if frame < 10; "0$frame"; else "$frame"; end
frame = 1
xyz = rand(frame, 3)
plots = cat(scatter3d(;x=xyz[:, 1],y=xyz[:, 2], z=xyz[:, 3], mode="markers",
marker=attr(color="red", size=1, symbol="circle",
line=attr(color="red", width=1))), dims = 1)
pl = plot(plots, layout;
options=Dict(:showLink => true, :toImageButtonOptions => Dict(:format=>"webp")))
display(pl)
let
for frame in 1:10
xyz = rand(10*frame+10, 3)
plots = cat(scatter3d(;x=xyz[:, 1],y=xyz[:, 2], z=xyz[:, 3], mode="markers",
marker=attr(color="red", size=3, symbol="circle",
line=attr(color="red", width=1))), dims = 1)
react!(pl, plots, pl.plot.layout)
sleep(0.5)
savefig(pl, "a$(f(frame)).png")
end
end
# Convert to a gif
# magick a*.png a.gif
Note that i use ImageMagick to convert the frames into an animation.