This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-23
Channels
- # announcements (2)
- # babashka (56)
- # beginners (30)
- # calva (79)
- # cider (5)
- # circleci (3)
- # clj-kondo (84)
- # cljfx (2)
- # cljsrn (3)
- # clojure (264)
- # clojure-czech (3)
- # clojure-europe (18)
- # clojure-spec (3)
- # clojurescript (12)
- # conjure (28)
- # cursive (5)
- # datomic (4)
- # deps-new (22)
- # fulcro (6)
- # graalvm (3)
- # jobs (1)
- # malli (1)
- # off-topic (23)
- # pathom (4)
- # portal (3)
- # practicalli (2)
- # quil (6)
- # reagent (20)
- # remote-jobs (3)
- # reveal (14)
- # ring (10)
- # shadow-cljs (5)
- # spacemacs (4)
- # xtdb (4)
I'm using Quil to teach someone clojure, and I really wanted to be able to just call drawing functions by themselves (so outside a draw function), to allow for more interactive exploration. Took me some figuring out so in case it's useful for anyone else:
(defn draw []
(Thread/sleep 100))
(q/defsketch mijn-sketch
:size [800 800]
:draw draw
:features [:keep-on-top])
(alter-var-root #'quil.applet/*applet* (constantly mijn-sketch))
Now you can just call any q/...
function at the top level. The Thread/sleep
is necessary because the animation thread will still be calling draw
in a loop, and only graphics that happen between the start/end of draw
will show up on the sketch.