PlutoUI.jl
PlutoUI.jl copied to clipboard
Clock limit
I like the Clock feature a lot. But is there a possibility to set an end point? Now, when I let the clock run, it will eventually error, given that it tries to go on even when there are no more data to plot. Looping back would be an alternative.
You can loop using mod1:
@bind i Clock()
let
data_index = mod1(i, length(data))
plot(data[data_index])
end
But a stopping feature would be nice.
Thanks -- works perfectly!
Op wo 23 sep. 2020 om 11:42 schreef Fons van der Plas < [email protected]>:
You can loop using mod1:
@bind i Clock()
let data_index = mod1(i, length(data)) plot(data[data_index])end
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fonsp/PlutoUI.jl/issues/45#issuecomment-697254342, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFACLG3GRMSVP24HNIOQ5LSHG7H5ANCNFSM4RWWH63A .
This is a nice solution for now. However, mod1 throws an error until the clock is started, because the bound variable is nothing.
So for my animation in Pluto, I used something like
data_index = mod1( (i |> isnothing) ? 1 : i, length(data))
so that the first frame of the animation is displayed until "Start" is clicked.