This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-17
Channels
- # admin-announcements (4)
- # aws (26)
- # beginners (88)
- # boot (132)
- # cljs-dev (4)
- # cljsrn (35)
- # clojars (11)
- # clojure (41)
- # clojure-art (33)
- # clojure-austin (1)
- # clojure-chicago (4)
- # clojure-dev (3)
- # clojure-russia (2)
- # clojured (3)
- # clojurescript (9)
- # community-development (19)
- # datomic (34)
- # devcards (2)
- # editors-rus (4)
- # hoplon (29)
- # leiningen (4)
- # music (2)
- # off-topic (21)
- # om (69)
- # other-lisps (1)
- # perun (6)
- # re-frame (1)
- # reagent (9)
- # spacemacs (3)
- # yada (13)
How can I create a "ticker" component, that infinitely loops through a collection of strings, showing one string after another, in place, to a timer ? with-interval
I basically want to build a simple slideshow, but combining the state of a timer with clj sequence functions is bending my mind 🙃
Something like: (recur (fnext (cycle [a b c])))
?
I would like to use this timer to hide/show/animate images, so it wouldnt do to just swap an image-url string.. (need to preload?)
I imagine I might need a formula cell that tests "true" when the timer hits an interval...
I know there must be some simple elegant javelin-flavored way...:thinking_face:
@chromalchemy: you can use the clojure cycle
function to create an infinite cyclic list
:current-item "foo"
:current-item "bar"
:current-item "baz"
:current-item "foo"
:current-item "bar"
...
you can change it to loop over a new set of things like this whenver you get new things to loop over:
I would probably keep the things in a vector and then swap! On an index cell
Then make a formula cell that gets from the vector using the index
Or maybe rotate the vector on swap.. And a formula points at the first item. Probably better, no need to check bounds