idk
This commit is contained in:
parent
edca82cd5d
commit
664252e0fc
17 changed files with 373 additions and 112 deletions
|
|
@ -4,6 +4,7 @@
|
|||
[arthur.domain.channel :as ch]
|
||||
[arthur.domain.clip :as clip]
|
||||
[arthur.domain.leaf :as leaf]
|
||||
[arthur.domain.nest :as nest]
|
||||
[arthur.domain.node :as node]
|
||||
[arthur.domain.paint :as paint]
|
||||
[arthur.domain.pose :as pose]
|
||||
|
|
@ -362,3 +363,46 @@
|
|||
(is (= :night (clip/active-palette main)))
|
||||
(is (= (pal/render-index context :night 0)
|
||||
(pal/background-index context (clip/active-palette main))))))
|
||||
|
||||
(deftest a-palette-lane-can-blend-between-keyed-palettes
|
||||
(let [palette (fn [id color]
|
||||
{:id id :name (name id) :slots [{:hex color} {:hex color}]})
|
||||
mark {:id :mark :kind :rect :z "a1"
|
||||
:channels {[:geom :size] (ch/framed 2)
|
||||
[:style :color] (ch/framed 1)}}
|
||||
choice (assoc (ch/keyed {0 :day 4 :night} :linear) :semantic :palette)
|
||||
document {:fps 30 :width 20 :height 20
|
||||
:palettes {:day (palette :day "#000000")
|
||||
:night (palette :night "#ffffff")}
|
||||
:default-palette :day
|
||||
:symbols
|
||||
{:main {:id :main :frames 5 :palette-track :palettes
|
||||
:nodes {:drawing {:id :drawing :kind :instance :z "a1"
|
||||
:source {:symbol :drawing}}}}
|
||||
:palettes {:id :palettes :type :palette-track :display :lane :frames 5
|
||||
:nodes {:change {:id :change :kind :instance :z "a1"
|
||||
:source {:symbol :day-palette}
|
||||
:span [0 5] :time {:at 0}
|
||||
:channels {[:palette] choice}}}}
|
||||
:day-palette {:id :day-palette :type :palette :palette-ref :day
|
||||
:frames 1 :nodes {}}
|
||||
:drawing {:id :drawing :frames 5 :nodes {:mark mark}}}}
|
||||
context (pal/compile document)
|
||||
resolve (clip/resolver document :main nil context nil)
|
||||
slid (nest/slide document :palettes [:change] 1)
|
||||
trimmed (nest/resize-in document :palettes [:change] 1)
|
||||
extended (nest/resize-out document :palettes [:change] 1 false)]
|
||||
(resolve 2)
|
||||
(is (= {:from :day :to :night :t 0.5} (clip/active-palette resolve)))
|
||||
(is (= [128 128 128]
|
||||
(nth (pal/effective-ramp context (clip/active-palette resolve))
|
||||
(pal/render-index context :day 1))))
|
||||
(is (nil? (:refused slid)) (:refused slid))
|
||||
(is (= [1 6] (node/placed-span
|
||||
(get-in slid [:clip :symbols :palettes :nodes :change]))))
|
||||
(is (nil? (:refused trimmed)) (:refused trimmed))
|
||||
(is (= [1 5] (node/placed-span
|
||||
(get-in trimmed [:clip :symbols :palettes :nodes :change]))))
|
||||
(is (nil? (:refused extended)) (:refused extended))
|
||||
(is (= [0 6] (node/placed-span
|
||||
(get-in extended [:clip :symbols :palettes :nodes :change]))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue