This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-13
Channels
- # announcements (3)
- # babashka (130)
- # beginners (73)
- # calva (22)
- # cider (46)
- # cljdoc (18)
- # cljs-dev (196)
- # cljsrn (18)
- # clojure (255)
- # clojure-europe (2)
- # clojure-finland (8)
- # clojure-gamedev (1)
- # clojure-germany (2)
- # clojure-losangeles (6)
- # clojure-nl (1)
- # clojure-spec (16)
- # clojure-uk (33)
- # clojurescript (32)
- # community-development (1)
- # conjure (40)
- # core-logic (11)
- # cursive (4)
- # datascript (8)
- # devcards (17)
- # emacs (21)
- # exercism (2)
- # fulcro (29)
- # funcool (15)
- # graalvm (18)
- # jobs (17)
- # jobs-rus (1)
- # lambdaisland (1)
- # lumo (1)
- # malli (19)
- # off-topic (15)
- # pathom (22)
- # quil (7)
- # re-frame (3)
- # reagent (3)
- # shadow-cljs (14)
- # spacemacs (41)
- # specter (2)
- # sql (5)
- # tree-sitter (1)
- # unrepl (16)
- # vscode (3)
- # xtdb (11)
- # yada (1)
The code is basically this:
(defn draw [state]
(q/background 255)
(let [mask (q/create-graphics (q/width) (q/height) :p3d)
drawing (q/create-graphics (q/width) (q/height) :p3d)]
(q/with-graphics mask
(q/background 255))
(q/with-graphics drawing
(q/no-stroke)
(q/fill 200)
(q/with-translation [(* 0.5 (q/width)) (* 0.5 (q/height))]
(q/rect 0 0 100 100)))
(q/mask-image drawing mask)
(q/image drawing 0 0)))
Since I'm just a mask and fill it white I would have expected whatever I draw on the second graphics to be fully visible, but it's not
Interesting stuff. I've never used a lot of these functions. As I'm sitting here trying to understand them, this is what I wrote. Does it make anything clear? I feel like it makes sense. (defn draw [state] (let [mask (q/create-graphics 300 300) drawing (q/create-graphics 300 300)] (q/with-graphics mask (q/triangle 50 200 150 50 150 200)) (q/with-graphics drawing (q/background 0) (q/no-stroke) (q/fill 255 0 0) (q/with-translation [100 100] (q/rect 0 0 100 150))) (q/image mask 0 0) (q/image drawing 300 0) (q/mask-image drawing mask) (q/image drawing 600 0)))
:size [900 300]