Add project palette assets and overrides
This commit is contained in:
parent
8f09b7b47f
commit
b41180db08
17 changed files with 470 additions and 87 deletions
|
|
@ -288,3 +288,33 @@
|
|||
(is (= [55 35] (clip/center grown nil :box)) "the symbol's middle moved")
|
||||
(is (= [25 35] (get-in grown [:symbols :main :nodes u :channels [:xform :anchor] :value]))
|
||||
"the instance's did not")))))
|
||||
|
||||
(deftest palette-context-is-inherited-keyed-and-overridable
|
||||
(let [palette (fn [id name a b]
|
||||
{:id id :name name :slots [{:hex a} {:hex b}]})
|
||||
mark {:id :mark :kind :rect :z "a1"
|
||||
:channels {[:geom :size] (ch/framed 2)
|
||||
[:style :color] (ch/framed 1)}}
|
||||
instance (fn [id child z]
|
||||
{:id id :kind :instance :z z :source {:symbol child}})
|
||||
document {:fps 30 :width 20 :height 20
|
||||
:palettes {:day (palette :day "Day" "#000000" "#112233")
|
||||
:flash (palette :flash "Flash" "#ffffff" "#aabbcc")}
|
||||
:default-palette :day
|
||||
:symbols
|
||||
{:main {:id :main :frames 4
|
||||
:palette (ch/keyed {0 :day 2 :flash} :hold)
|
||||
:nodes {:inherited (instance :inherited :drawing "a1")
|
||||
:fixed (assoc (instance :fixed :fixed "a2")
|
||||
:palette (ch/framed :day))}}
|
||||
:drawing {:id :drawing :frames 4 :nodes {:mark mark}}
|
||||
:fixed {:id :fixed :frames 4 :palette (ch/framed :flash)
|
||||
:nodes {:mark mark}}}}
|
||||
context (pal/compile document)
|
||||
resolve (clip/resolver document :main nil context nil)
|
||||
colors #(mapv :color (resolve %))]
|
||||
(is (= [1 1] (colors 0)) "both children start in the day bank")
|
||||
(is (= [3 1] (colors 2))
|
||||
"the inheriting child follows the lightning cut; an instance override wins")
|
||||
(is (= [17 34 51] (nth (:ramp context) 1)))
|
||||
(is (= [170 187 204] (nth (:ramp context) 3)))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue