This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-19
Channels
- # announcements (2)
- # babashka (53)
- # beginners (71)
- # calva (15)
- # clerk (4)
- # cljfx (1)
- # clojure (18)
- # clojure-europe (13)
- # clojure-nl (1)
- # clojure-norway (26)
- # clojure-uk (4)
- # datascript (2)
- # datomic (3)
- # emacs (4)
- # events (1)
- # fulcro (45)
- # honeysql (2)
- # hyperfiddle (6)
- # missionary (8)
- # reitit (2)
- # releases (2)
- # shadow-cljs (10)
- # squint (33)
- # xtdb (4)
I'm having a bit of trouble understanding image-view
. I have the following method which, as far as I understand, should draw the image found by find-sprite
using the appropriate color at the x,y coordinates I pass in. But it's sticking them in the top-left corner instead.
clojure
(defn draw-sprite
[{:keys [unit force x y]}]
{:fx/type :image-view
:image (cu/find-sprite unit)
:effect {:fx/type :blend
:top-input {:fx/type :color-input
:paint (force :color)
:x 0 :y 0 :width 100 :height 100}
:bottom-input {:fx/type :image-input
:source (cu/find-sprite unit)}
:mode :src-atop
:opacity 0.5}
:x x
:y y})
I'm not sure what I'm doing wrong here. When I replaced :x 0 :y 0
inside the :top-input
call with :x x :y y
, it just made the sprite white (like the color overlay was in the wrong place).