K keys or draws on, shift-K draws blank, = and - change a hold

In a lane, K is Flash's F6: a copy of the drawing showing, taking over
from the playhead, or on the next frame when the playhead is on a
drawing's first one, so pressing it again and again draws on. Shift-K is
F7, the same with an empty drawing. Elsewhere K is Blender's I: what is
animated, or else position, turn and scale, keyed at the playhead.
= and - lengthen and shorten the selected hold by a frame, as in Harmony.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Olive Vaughn 2026-10-10 20:17:30 -04:00
parent e96464459d
commit 246b6d6468
6 changed files with 179 additions and 1 deletions

View file

@ -331,3 +331,17 @@
"editing repairs an older tweened colour channel")
(is (= :hold (get-in (node/toggle-key n [:style :color] 3 nil)
[:channels [:style :color] :interp])))))
(deftest keying-here-keys-what-is-animated-or-else-the-transform
(let [n {:id :x :kind :group}
fresh (node/key-at n 4 nil)
keyed-at #(set (keep (fn [[path c]] (when (contains? (:keys c) %2) path)) (node/channels %1)))]
(is (= #{[:xform :pos] [:xform :rot] [:xform :scale]} (keyed-at fresh 4))
"nothing animated: position, turn and scale, as Blender's I")
(let [turning (node/set-keyed-channel n [:xform :rot] 0 0.0)
turning (node/set-keyed-channel turning [:xform :rot] 10 2.0)
keyed (node/key-at turning 5 nil)]
(is (= #{[:xform :rot]} (keyed-at keyed 5)) "only what is already animated")
(is (= 1.0 (ch/value-at (get (node/channels keyed) [:xform :rot]) 5 nil))
"with the value it had there, so nothing moves"))
(is (= fresh (node/key-at fresh 4 nil)) "a key already there is kept, not toggled off")))

View file

@ -893,3 +893,44 @@
(is (= [0 6] (node/placed-span n)))
(is (every? #(= {:symbol :blank :frame 0} (node/placed-frame n % 1)) (range 6))
"stretched, every frame of it shows the one drawing")))
(defn- cel-spans [result sid]
(into {} (map (juxt :id node/placed-span))
(symbol/children (get-in result [:clip :symbols sid :nodes]))))
(deftest a-new-drawing-takes-over-from-the-playhead
(let [doc (document)]
(testing "inside a hold: the hold ends there and the copy has the rest of it"
(let [r (span/drawing-at doc :main 2 :new :copy {:copy? true})]
(is (= {:a [0 2] :new [2 4] :b [4 8] :insert [8 12]} (cel-spans r :main)))
(is (= 2 (:frame r)))
(is (= (get-in doc [:symbols :drawing-a :nodes])
(get-in r [:clip :symbols :copy :nodes])))))
(testing "on a drawing's first frame it goes on the frame after, as F6 does again and again"
(let [r (span/drawing-at doc :main 4 :new :copy {:copy? true})]
(is (= {:a [0 4] :b [4 5] :new [5 8] :insert [8 12]} (cel-spans r :main)))
(is (= (get-in doc [:symbols :drawing-b :nodes])
(get-in r [:clip :symbols :copy :nodes])))))
(testing "past the last cel: one frame, of the drawing before it, or empty"
(let [r (span/drawing-at doc :main 12 :new :blank {:extent :grow-symbol})]
(is (= [12 13] (get (cel-spans r :main) :new)))
(is (= {} (get-in r [:clip :symbols :blank :nodes])))
(is (= 13 (get-in r [:clip :symbols :main :frames]))))
(is (:required-frames (span/drawing-at doc :main 12 :new :blank {}))
"growing the shot is the caller's say"))))
(deftest a-new-drawing-in-a-gap-or-before-a-cel
(let [lane (fn [& cels]
(-> (document)
(assoc-in [:symbols :main] {:id :main :frames 12 :display :lane
:nodes (into {} (map (juxt :id identity)) cels)})))]
(is (= {:x [0 2] :new [3 5] :y [5 6]}
(cel-spans (span/drawing-at (lane (cel :x :drawing-a 0 2 0) (cel :y :drawing-b 5 1 0))
:main 3 :new :copy {:copy? true}) :main))
"in a gap it runs to the next cel, copying the one before")
(is (= {:x [0 1] :new [1 2] :y [2 4]}
(cel-spans (span/drawing-at (lane (cel :x :drawing-a 0 1 0) (cel :y :drawing-b 1 2 0))
:main 0 :new :copy {:copy? true}) :main))
"on a one-frame drawing with the next right after, room is made")
(is (:refused (span/drawing-at (lane) :main 0 :new :copy {:copy? true}))
"an empty lane has nothing to copy")))