JuliaGizmos / Escher.jl

Composable Web UIs in Julia
https://juliagizmos.github.io/Escher.jl
Other
337 stars 63 forks source link

Display an animation of images without looping indefinitely #129

Closed cmey closed 8 years ago

cmey commented 8 years ago

I can create an event loop: eventloop = every(1/5) and then map over it:

map(eventloop) do _
    spy(images[it])
end

but what I'd like is to display the animation only once (when I click on a button). Is there a cool way to do that?

shashi commented 8 years ago

yep

function main(window)
    push!(window.assets, "widgets")
    switch = Signal(false)
    eventloop = fpswhen(switch, 30)

    vbox(
      checkbox() >>> switch, # could also be a togglebutton
      map(eventloop) do _
         ...
      end
    )
end

@dioptre here's an example for you