A clip says where what it plays runs out

Lengthening a placement past the end of the symbol it plays made the bar
longer and the picture empty, with nothing on the bar to say so: a symbol
made at the playhead near the end is only a few frames long, and moving it
back and stretching it showed those few frames and then nothing. The
frames past the symbol's end are now drawn empty inside the clip's outline,
as Flash leaves an empty frame unfilled, on a row's bar and on a lane's
clip alike. A held or looping placement always has a frame to show and is
never marked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Olive Vaughn 2026-10-11 15:26:19 -04:00
parent fce76dfaa6
commit 2eb5944a78
3 changed files with 66 additions and 2 deletions

View file

@ -79,6 +79,20 @@
(+ at (/ (or (clip/frames clip (node/source n)) 0) rate)) (+ at (/ (or (clip/frames clip (node/source n)) 0) rate))
(clip/frames clip sid))) (clip/frames clip sid)))
(defn- shows
"Where on the ruler `n` has something to show, as `[from to)`, given `->open`
from its own frames to the ruler's; nil where it places nothing or shows
something across all of its span.
A SPAN IS NOT CONTENT. Lengthening a placement past the end of the symbol it
plays leaves the bar longer and the picture empty — `node/placed-frame` runs
out — so the row has to say where the symbol does. A held or looping
placement always has a frame to show, so only a playing one answers."
[clip n ->open]
(when-let [t (and (node/source n) (node/source-time n))]
(mapv (comp ->open (time->parent t))
[0 (or (clip/frames clip (node/source n)) 0)])))
(defn- node-label (defn- node-label
"What to call a node in the label column. "What to call a node in the label column.
@ -194,6 +208,7 @@
:expandable? true :expandable? true
:expanded? open? :expanded? open?
:span cspan :span cspan
:shows (shows clip child cself)
:key-items (key-items child sid cself) :key-items (key-items child sid cself)
:keys (into [] (comp (mapcat keyed-frames) :keys (into [] (comp (mapcat keyed-frames)
(map cself) (map cself)
@ -242,6 +257,7 @@
(node-label clip (:id child) child)) (node-label clip (:id child) child))
:source (node/source child) :source (node/source child)
:span (mapv ->open (node/placed-span child)) :span (mapv ->open (node/placed-span child))
:shows (shows clip child (comp ->open (local->parent child)))
:key-items (key-items child sid (comp ->open (local->parent child))) :key-items (key-items child sid (comp ->open (local->parent child)))
:keys (into [] :keys (into []
(comp (mapcat keyed-frames) (comp (mapcat keyed-frames)
@ -306,6 +322,7 @@
:expandable? true :expandable? true
:expanded? open? :expanded? open?
:span span :span span
:shows (shows clip n self)
:key-items (key-items n sid self) :key-items (key-items n sid self)
:keys (into [] (comp (mapcat keyed-frames) :keys (into [] (comp (mapcat keyed-frames)
(map self) (map self)
@ -328,6 +345,7 @@
(some-> (node/source child) name)) (some-> (node/source child) name))
:source (node/source child) :source (node/source child)
:span (mapv source-self (node/placed-span child)) :span (mapv source-self (node/placed-span child))
:shows (shows clip child (comp source-self (local->parent child)))
;; The clip's own keys, on the ;; The clip's own keys, on the
;; block, so a collapsed lane ;; block, so a collapsed lane
;; still says where it changes. ;; still says where it changes.
@ -1046,12 +1064,24 @@
(reset! gesture nil) (when @preview (reset! preview nil))) (reset! gesture nil) (when @preview (reset! preview nil)))
:on-pointer-cancel (fn [e] (.stopPropagation e) (reset! gesture nil) (reset! preview nil))}]))) :on-pointer-cancel (fn [e] (.stopPropagation e) (reset! gesture nil) (reset! preview nil))}])))
(defn- runout
"The stretches of a bar drawn from `in` to `out` where what it places has
nothing to show — see `shows` — as Flash draws empty frames: unfilled, inside
the outline of a clip that still lasts there."
[in out shows]
(when-let [[from to] shows]
(for [[a b] [[in (min out from)] [(max in to) out]]
:when (< a b)]
^{:key a}
[:span.tl-runout {:style {:left (str (* 100 (/ (- a in) (- out in))) "%")
:width (str (* 100 (/ (- b a) (- out in))) "%")}}])))
(defn- track-cell (defn- track-cell
"`sliding` is the gesture in flight: `{:row :path :kind :from :df}`, where "`sliding` is the gesture in flight: `{:row :path :kind :from :df}`, where
`:from` is the frame the press was on and `:df` how many frames the pointer has `:from` is the frame the press was on and `:df` how many frames the pointer has
moved since. What it looks like mid-drag is `[:ui :sliding]`, which the clip moved since. What it looks like mid-drag is `[:ui :sliding]`, which the clip
every row and the stage are drawn from already has in it." every row and the stage are drawn from already has in it."
[{:keys [path span keys key-items gaps dense? kind node-kind select slides cels lane? of unmapped? owner]} [{:keys [path span shows keys key-items gaps dense? kind node-kind select slides cels lane? of unmapped? owner]}
frames sliding hint {:keys [clip store open selection selections target-path key-selection key-preview key-anchor key-state key-elements choose-row!]}] frames sliding hint {:keys [clip store open selection selections target-path key-selection key-preview key-anchor key-state key-elements choose-row!]}]
(let [selected-set (set selections) (let [selected-set (set selections)
active-row (:row @sliding) active-row (:row @sliding)
@ -1313,6 +1343,7 @@
:on-pointer-down :on-pointer-down
(when (and select (not unmapped?)) (when (and select (not unmapped?))
#(begin! % (or slides path) :slide select nil nil))} #(begin! % (or slides path) :slide select nil nil))}
(runout in out shows)
(when (and select (not unmapped?)) (when (and select (not unmapped?))
[:span.tl-edge.in {:title "Drag start" [:span.tl-edge.in {:title "Drag start"
:on-pointer-down #(begin! % path :in select nil nil)}]) :on-pointer-down #(begin! % path :in select nil nil)}])
@ -1320,7 +1351,7 @@
[:span.tl-edge.out {:title "Drag endpoint · Shift-drag ripples later clips" [:span.tl-edge.out {:title "Drag endpoint · Shift-drag ripples later clips"
:on-pointer-down #(begin! % path :out select nil nil)}])])) :on-pointer-down #(begin! % path :out select nil nil)}])]))
(doall (doall
(for [[i {:keys [id label source span select ghost?]}] (for [[i {:keys [id label source span shows select ghost?]}]
(map-indexed vector (map-indexed vector
(cond-> (vec cels) (cond-> (vec cels)
(= select (:target-lane @sliding)) (= select (:target-lane @sliding))
@ -1377,6 +1408,7 @@
{:selection select :label label {:selection select :label label
:in (js/Math.floor in) :in (js/Math.floor in)
:duration (- out in)}))} :duration (- out in)}))}
(runout in out shows)
[:span.tl-cel-label label] [:span.tl-cel-label label]
(when select (when select
(if joined? (if joined?

View file

@ -225,6 +225,28 @@
(is (= [[2 3]] (mapv :span (:cels lane))) (is (= [[2 3]] (mapv :span (:cels lane)))
"a lane placed at twice the speed draws its frames 4–6 on ruler frames 2–3"))) "a lane placed at twice the speed draws its frames 4–6 on ruler frames 2–3")))
(deftest a-bar-says-where-what-it-plays-runs-out
(let [placed {:id :short :kind :instance :z "a" :span [0 10]
:time {:at 6 :rate 1}
:source {:symbol :short}
:playback {:in 0 :speed 1 :end :stop}}
doc (-> (clip/blank)
(assoc-in [:symbols :main :frames] 24)
(assoc-in [:symbols :main :nodes] {:short placed})
(assoc-in [:symbols :short] {:id :short :frames 4 :nodes {}}))
row #(first (timeline/rows % :main #{}))]
(is (= [6 16] (:span (row doc))))
(is (= [6 10] (:shows (row doc)))
"four frames of symbol, stretched to ten, show from 6 to 10 only")
(is (nil? (:shows (row (assoc-in doc [:symbols :main :nodes :short :playback :speed] 0))))
"a held placement shows its frame across the whole span")
(let [lane (-> (assoc-in doc [:symbols :main :display] :lane)
(assoc-in [:symbols :main :nodes :short :playback :speed] 2)
(timeline/rows :main #{})
first)]
(is (= [[6 8]] (mapv :shows (:cels lane)))
"a clip in a lane says it too, at its own speed"))))
(deftest an-ordinary-symbol-keeps-a-row-per-node (deftest an-ordinary-symbol-keeps-a-row-per-node
(let [doc (update-in (fixture/document) [:symbols :main] dissoc :display) (let [doc (update-in (fixture/document) [:symbols :main] dissoc :display)
rows (timeline/rows doc :main #{})] rows (timeline/rows doc :main #{})]

View file

@ -1372,6 +1372,16 @@ button.followable svg { width: 12px; height: 12px; display: block; }
text-overflow: ellipsis; text-overflow: ellipsis;
pointer-events: none; pointer-events: none;
} }
/* Frames of a clip past the end of what it plays: still the clip's — the outline
and the handles go on — but empty, as Flash leaves an empty frame unfilled. */
.tl-runout {
position: absolute;
top: 0;
bottom: 0;
background: repeating-linear-gradient(135deg, var(--pane) 0 3px, var(--sunk) 3px 6px);
pointer-events: none;
}
.tl-cel-label { position: relative; }
.tl-span.ghost { .tl-span.ghost {
background: transparent; background: transparent;
border: 1px dashed var(--sel); border: 1px dashed var(--sel);