diff --git a/README.md b/README.md
index 933885aa0..243b2edf3 100644
--- a/README.md
+++ b/README.md
@@ -92,6 +92,13 @@ same time.
**Motion**
- Keyframe animation on ~25 properties with easing
+- **Keyframe markers on clips** — diamonds on the clip body at each unique
+ keyframe time (tooltip lists channels; a count badge when several share a
+ time). Ctrl/Cmd+← / Ctrl/Cmd+→ jumps the playhead to
+ the previous / next keyframe (selected clips first, else clips under the
+ playhead)
+- **Keyframe graphs** — toggle a property’s curve in the inspector to show an
+ interpolated value graph beside the program monitor; click the graph to seek
- **Speed ramps** — keyframe `speed` and the engine time-remaps video *and* the
export audio mix (the fast-into-slow-mo reel move)
- **Camera shake** and **RGB-split/chromatic aberration**, both animatable
diff --git a/app.js b/app.js
index 4a6ef1bfb..be1798a28 100644
--- a/app.js
+++ b/app.js
@@ -252,6 +252,7 @@ const state = {
binTab: "project", // project | elements | sfx | svg
disabledTracks: new Set(), // mirror of project.disabledTracks for fast lookup
transFocus: null, // "in" | "out" — inspector transition row highlighted
+ kfGraphs: new Set(), // animatable prop keys with open monitor graphs
};
function normalizeDisabledTracks(raw) {
if (raw == null) return [];
@@ -320,7 +321,7 @@ const els = {
projectName: $("projectName"), monitorRes: $("monitorRes"),
aspectSel: $("aspectSel"), btnGuides: $("btnGuides"), safeOverlay: $("safeOverlay"),
btnSpeed: $("btnSpeed"),
- monitorStage: $("monitorStage"),
+ monitorStage: $("monitorStage"), kfGraphs: $("kfGraphs"),
exportSetup: $("exportSetup"), engineFast: $("engineFast"), engineRealtime: $("engineRealtime"),
};
const ctx2d = els.preview.getContext("2d");
@@ -2041,6 +2042,39 @@ function transitionMarksHtml(c, trackH) {
wedge(c.transitionOut, "out");
return html;
}
+/* Group keyframes by clip-local time → [{ t, keys: ["opacity","scale"] }, …]. */
+function clipKeyframeGroups(c) {
+ if (!c?.keyframes) return [];
+ const byT = new Map();
+ for (const [channel, arr] of Object.entries(c.keyframes)) {
+ if (!Array.isArray(arr)) continue;
+ for (const kf of arr) {
+ const t = +kf.t;
+ if (!Number.isFinite(t)) continue;
+ const key = t.toFixed(4);
+ let g = byT.get(key);
+ if (!g) { g = { t, keys: [] }; byT.set(key, g); }
+ if (!g.keys.includes(channel)) g.keys.push(channel);
+ }
+ }
+ return [...byT.values()].sort((a, b) => a.t - b.t);
+}
+const clipKeyframeLocalTimes = (c) => clipKeyframeGroups(c).map((g) => g.t);
+/* Diamond marks on the clip body — one per unique time; count badge if multi-channel. */
+function clipKeyframesHtml(c) {
+ const groups = clipKeyframeGroups(c);
+ if (!groups.length || !(c.duration > 0)) return "";
+ let html = `
`;
+ for (const { t, keys } of groups) {
+ if (t < -1e-6 || t > c.duration + 1e-6) continue;
+ const pct = Math.max(0, Math.min(100, (t / c.duration) * 100));
+ const label = keys.join(", ") + " @ " + fmt(c.start + t);
+ const badge = keys.length > 1 ? `
${keys.length} ` : "";
+ const multi = keys.length > 1 ? " multi" : "";
+ html += `
${badge}
`;
+ }
+ return html + `
`;
+}
function rebuildClips() {
const w = contentWidth();
els.tracksContent.style.width = w + "px";
@@ -2073,6 +2107,7 @@ function rebuildClips() {
: (c.name || "");
body += `
${badge}${escapeHtml(label)}
`;
+ body += clipKeyframesHtml(c);
let inner = `${body}
`;
inner += transitionMarksHtml(c, tr.h);
inner += `
`;
@@ -2304,6 +2339,13 @@ els.tracksContent.addEventListener("pointerdown", (e) => {
}
const c = getClip(clipDiv.dataset.id);
if (!c) return;
+ const kfMark = e.target.closest(".clip-kf");
+ if (kfMark) {
+ e.preventDefault();
+ selectClip(c.id);
+ setTime(c.start + (+kfMark.dataset.t || 0));
+ return;
+ }
const transHandle = e.target.closest(".trans-dur-handle");
if (transHandle) {
const wrap = transHandle.closest(".trans-mark");
@@ -2551,6 +2593,47 @@ function setTime(t) {
if (state.audioHold) scheduleAudioHoldRefresh();
}
+/* Absolute timeline times of every keyframe on the given clips (deduped). */
+function keyframeTimelineTimes(clips) {
+ const seen = new Set();
+ const out = [];
+ for (const c of clips) {
+ for (const local of clipKeyframeLocalTimes(c)) {
+ const t = +(c.start + local).toFixed(4);
+ if (seen.has(t)) continue;
+ seen.add(t);
+ out.push(t);
+ }
+ }
+ out.sort((a, b) => a - b);
+ return out;
+}
+/* Jump playhead to previous (−1) or next (+1) keyframe.
+ Prefers selected clips; falls back to clips under the playhead.
+ Keyboard counterpart to Avid’s Ctrl/Cmd-click snap-to-audio-keyframe. */
+function goToKeyframe(dir) {
+ let clips = state.selIds.size ? selectedClips() : [];
+ if (!clips.some((c) => clipKeyframeLocalTimes(c).length)) {
+ const t = state.time;
+ clips = project.clips.filter((c) =>
+ clipKeyframeLocalTimes(c).length &&
+ t >= c.start - 1e-6 && t <= c.start + c.duration + 1e-6);
+ }
+ const times = keyframeTimelineTimes(clips);
+ if (!times.length) { toast("No keyframes"); return; }
+ const eps = 0.5 / Math.max(1, project.fps || 30);
+ if (dir > 0) {
+ const next = times.find((t) => t > state.time + eps);
+ if (next == null) { toast("No next keyframe"); return; }
+ setTime(next);
+ } else {
+ let prev = null;
+ for (const t of times) if (t < state.time - eps) prev = t;
+ if (prev == null) { toast("No previous keyframe"); return; }
+ setTime(prev);
+ }
+}
+
/* Add a marker at the playhead, or remove one already there (M key).
Works while playing — tap M on the beat to lay down a beat grid. */
function toggleMarker() {
@@ -2793,6 +2876,7 @@ function renderInspector(lite) {
const c = getClip(state.selId);
if (!c) {
els.inspector.innerHTML = `Select a clip to edit its transform, effects & audio.
`;
+ renderKfGraphsPanel();
return;
}
if (lite) { // during gestures, just refresh timing numbers if present
@@ -2805,16 +2889,28 @@ function renderInspector(lite) {
const kfCount = (k) => (c.keyframes && c.keyframes[k] ? c.keyframes[k].length : 0);
const kfCtl = (k) => !ANIMATABLE.includes(k) ? "" :
`◆${kfCount(k) || ""} ${kfCount(k) ? `✕ ` : ""} `;
- /* reset: prop key(s) for Ctrl-click on the label; defaults to k when that key is in DEFAULT_PROPS. */
- const row = (label, inner, k = "", reset) => {
+ /* Label carries two affordances that key off different click modifiers:
+ plain click toggles the keyframe graph (animatable props), Ctrl/Cmd-click
+ resets the prop(s). `reset` overrides which keys reset; defaults to k. */
+ const propLabel = (label, k = "", reset) => {
const keys = reset !== undefined ? reset : k;
const list = (Array.isArray(keys) ? keys : String(keys || "").split(",")).map((s) => s.trim()).filter(Boolean);
const canReset = list.some((rk) => Object.hasOwn(DEFAULT_PROPS, rk) || rk === "transIn" || rk === "transOut");
- const lab = canReset
- ? `${label} `
- : `${label} `;
- return `${lab}${inner}${k ? kfCtl(k) : ""}
`;
+ const isGraph = !!k && ANIMATABLE.includes(k);
+ if (!isGraph && !canReset) return `${label} `;
+ const cls = [
+ isGraph ? "kf-graph-toggle" : "",
+ isGraph && state.kfGraphs.has(k) ? "on" : "",
+ isGraph && kfCount(k) ? "has-kf" : "",
+ canReset ? "insp-reset" : "",
+ ].filter(Boolean).join(" ");
+ const attrs = (isGraph ? ` data-kfgraph="${k}"` : "") + (canReset ? ` data-reset="${list.join(",")}"` : "");
+ const title = isGraph && canReset ? "Click: keyframe graph · Ctrl-click: reset"
+ : isGraph ? "Show / hide keyframe graph" : "Ctrl-click to reset";
+ return `${label} `;
};
+ const row = (label, inner, k = "", reset) =>
+ `${propLabel(label, k, reset)}${inner}${k ? kfCtl(k) : ""}
`;
const slider = (k, min, max, step, val, unit = "") =>
row(k[0].toUpperCase() + k.slice(1),
`
@@ -3090,6 +3186,179 @@ function renderInspector(lite) {
const row = els.inspector.querySelector(`[data-k="${k}"]`)?.closest(".insp-row");
row?.scrollIntoView({ block: "nearest", behavior: "smooth" });
}
+ els.inspector.querySelectorAll("[data-kfgraph]").forEach((lab) => {
+ lab.addEventListener("click", (e) => {
+ if (e.ctrlKey || e.metaKey) return; // Ctrl/Cmd-click is reserved for prop reset
+ e.preventDefault();
+ toggleKfGraph(lab.dataset.kfgraph);
+ });
+ });
+ renderKfGraphsPanel();
+}
+
+/* ── Keyframe graphs (program-monitor left gutter) ── */
+const KF_GRAPH_LABEL = {
+ x: "Pos X", y: "Pos Y", scale: "Scale", rotation: "Rotation", opacity: "Opacity",
+ volume: "Volume", speed: "Speed", brightness: "Bright", contrast: "Contrast",
+ saturation: "Sat", hue: "Hue", blur: "Blur", grayscale: "Gray", sepia: "Sepia",
+ invert: "Invert", temperature: "Temp", tint: "Tint", vignette: "Vignette",
+ cornerRadius: "Radius", shake: "Shake", rgbSplit: "RGB", grain: "Grain",
+ fontSize: "Size", letterSpacing: "Track", glow: "Glow",
+};
+function toggleKfGraph(key) {
+ if (!ANIMATABLE.includes(key)) return;
+ if (state.kfGraphs.has(key)) state.kfGraphs.delete(key);
+ else state.kfGraphs.add(key);
+ renderInspector(); // refresh label .on state + panel
+}
+function renderKfGraphsPanel() {
+ const root = els.kfGraphs;
+ if (!root) return;
+ const c = getClip(state.selId);
+ const keys = [...state.kfGraphs].filter((k) => ANIMATABLE.includes(k));
+ if (!c || !keys.length) {
+ root.innerHTML = "";
+ root.hidden = true;
+ return;
+ }
+ root.hidden = false;
+ root.innerHTML = keys.map((k) => {
+ const label = KF_GRAPH_LABEL[k] || k;
+ return ``;
+ }).join("");
+ root.querySelectorAll("[data-kfgraph-close]").forEach((btn) => {
+ btn.addEventListener("click", (e) => {
+ e.stopPropagation();
+ state.kfGraphs.delete(btn.dataset.kfgraphClose);
+ renderInspector();
+ });
+ });
+ root.querySelectorAll(".kf-graph canvas").forEach((cv) => {
+ const key = cv.closest("[data-kfgraph-card]")?.dataset.kfgraphCard;
+ cv.addEventListener("pointerdown", (e) => seekKfGraph(e, cv, key));
+ });
+ updateKfGraphs();
+}
+function seekKfGraph(e, cv, key) {
+ const c = getClip(state.selId);
+ if (!c || !key) return;
+ const { t0, t1 } = kfGraphRange(c, key);
+ const rect = cv.getBoundingClientRect();
+ const u = clamp((e.clientX - rect.left) / Math.max(1, rect.width), 0, 1);
+ setTime(c.start + t0 + u * Math.max(1e-6, t1 - t0));
+ updateKfGraphs();
+}
+/* Value + time window for a graph. When keyframes exist, zoom X to their span
+ (with padding) instead of the full clip duration. */
+function kfGraphRange(c, key) {
+ const fallback = +(c.props?.[key] ?? DEFAULT_PROPS[key] ?? 0);
+ const dur = Math.max(MIN_DUR, c.duration);
+ const kfs = Array.isArray(c.keyframes?.[key]) ? c.keyframes[key] : [];
+ const vals = kfs.length ? kfs.map((kf) => +kf.v) : [fallback];
+ let lo = Math.min(...vals), hi = Math.max(...vals);
+ if (!isFinite(lo) || !isFinite(hi)) { lo = 0; hi = 1; }
+ if (Math.abs(hi - lo) < 1e-6) {
+ const pad = Math.max(0.05, Math.abs(lo) * 0.1 || 0.5);
+ lo -= pad; hi += pad;
+ } else {
+ const pad = (hi - lo) * 0.12;
+ lo -= pad; hi += pad;
+ }
+
+ let t0 = 0, t1 = dur;
+ if (kfs.length === 1) {
+ const t = clamp(+kfs[0].t || 0, 0, dur);
+ const half = Math.max(0.15, dur * 0.08);
+ t0 = Math.max(0, t - half);
+ t1 = Math.min(dur, t + half);
+ } else if (kfs.length >= 2) {
+ const ts = kfs.map((kf) => +kf.t || 0);
+ const a = Math.min(...ts), b = Math.max(...ts);
+ const pad = Math.max(0.05, (b - a) * 0.1, dur * 0.02);
+ t0 = Math.max(0, a - pad);
+ t1 = Math.min(dur, b + pad);
+ }
+ if (t1 - t0 < 1e-3) { t0 = 0; t1 = dur; }
+ return { lo, hi, fallback, t0, t1, dur };
+}
+function updateKfGraphs() {
+ const root = els.kfGraphs;
+ if (!root || root.hidden) return;
+ const c = getClip(state.selId);
+ if (!c) return;
+ root.querySelectorAll(".kf-graph").forEach((card) => {
+ const key = card.dataset.kfgraphCard;
+ const cv = card.querySelector("canvas");
+ if (key && cv) drawKfGraph(cv, c, key);
+ });
+}
+function drawKfGraph(cv, c, key) {
+ const dpr = window.devicePixelRatio || 1;
+ const cssW = cv.clientWidth || 160, cssH = cv.clientHeight || 52;
+ if (cv.width !== Math.round(cssW * dpr) || cv.height !== Math.round(cssH * dpr)) {
+ cv.width = Math.round(cssW * dpr);
+ cv.height = Math.round(cssH * dpr);
+ }
+ const g = cv.getContext("2d");
+ g.setTransform(dpr, 0, 0, dpr, 0, 0);
+ const W = cssW, H = cssH;
+ g.clearRect(0, 0, W, H);
+ const { lo, hi, fallback, t0, t1 } = kfGraphRange(c, key);
+ const span = Math.max(1e-6, t1 - t0);
+ const yAt = (v) => H - 4 - ((v - lo) / (hi - lo)) * (H - 8);
+ const xAt = (t) => 3 + ((t - t0) / span) * (W - 6);
+
+ // mid / zero guide
+ g.strokeStyle = "#ffffff10";
+ g.lineWidth = 1;
+ g.beginPath();
+ const y0 = yAt(0);
+ if (y0 > 4 && y0 < H - 4) { g.moveTo(3, y0); g.lineTo(W - 3, y0); g.stroke(); }
+
+ // interpolated curve (only the zoomed window)
+ g.strokeStyle = "#7b6cff";
+ g.lineWidth = 1.5;
+ g.beginPath();
+ const steps = Math.max(24, Math.floor(W));
+ for (let i = 0; i <= steps; i++) {
+ const t = t0 + (i / steps) * span;
+ const v = kfChannel(c, key, t, fallback);
+ const x = xAt(t), y = yAt(v);
+ if (i === 0) g.moveTo(x, y); else g.lineTo(x, y);
+ }
+ g.stroke();
+
+ // keyframe diamonds
+ const kfs = c.keyframes?.[key];
+ if (Array.isArray(kfs)) {
+ g.fillStyle = "#ffd166";
+ for (const kf of kfs) {
+ const x = xAt(kf.t), y = yAt(kf.v);
+ g.beginPath();
+ g.moveTo(x, y - 3.5); g.lineTo(x + 3.5, y); g.lineTo(x, y + 3.5); g.lineTo(x - 3.5, y);
+ g.closePath(); g.fill();
+ }
+ }
+
+ // playhead (drawn only when inside the zoomed window)
+ const lt = state.time - c.start;
+ if (lt >= t0 - 1e-6 && lt <= t1 + 1e-6) {
+ const px = xAt(clamp(lt, t0, t1));
+ g.strokeStyle = "#ff4d6a";
+ g.lineWidth = 1;
+ g.beginPath();
+ g.moveTo(px, 1); g.lineTo(px, H - 1);
+ g.stroke();
+ const cur = kfChannel(c, key, clamp(lt, t0, t1), fallback);
+ g.fillStyle = "#ff4d6a";
+ g.beginPath();
+ g.arc(px, yAt(cur), 2.5, 0, Math.PI * 2);
+ g.fill();
+ }
}
/* ═══════════════════════════ PLAYBACK ENGINE ═══════════════════════════ */
@@ -4910,6 +5179,7 @@ function loop(ts) {
els.playhead.style.left = state.time * state.pps + "px";
drawRuler();
updateSafeOverlay();
+ updateKfGraphs();
updateMeterUI(dt);
els.tcCurrent.textContent = fmt(state.time);
els.tcTotal.textContent = fmt(dur);
@@ -5365,6 +5635,10 @@ window.addEventListener("keydown", (e) => {
e.shiftKey ? trimToWorkArea() : splitAtWorkArea();
}
else if (k === "Delete" || k === "Backspace") deleteSelected();
+ else if ((e.ctrlKey || e.metaKey) && !e.altKey && (k === "ArrowLeft" || k === "ArrowRight")) {
+ e.preventDefault();
+ goToKeyframe(k === "ArrowRight" ? 1 : -1);
+ }
else if (k === "ArrowLeft") setTime(state.time - (e.shiftKey ? 1 : 1 / project.fps));
else if (k === "ArrowRight") setTime(state.time + (e.shiftKey ? 1 : 1 / project.fps));
else if (k === "Home") gotoHome();
diff --git a/index.html b/index.html
index 9afd3f8bd..75b4c4f86 100644
--- a/index.html
+++ b/index.html
@@ -82,6 +82,7 @@
+
@@ -207,6 +208,7 @@
Keyboard shortcuts
Ctrl +click clipAdd / remove from selection
Ctrl +A / Esc Select all / deselect
← → Step 1 frame (⇧ = 1 second)
+ Ctrl +← / Ctrl +→ Go to previous / next keyframe
[ / ] Trim selected in / out to playhead
Home / End Jump to start / end
diff --git a/style.css b/style.css
index f1def3ca9..b5c50137b 100644
--- a/style.css
+++ b/style.css
@@ -709,6 +709,80 @@ body.track-size-s .clip.selected {
background: #000;
}
+/* ── Keyframe graphs (left gutter of program monitor) ── */
+.kf-graphs {
+ position: absolute;
+ left: 6px;
+ top: 6px;
+ bottom: 6px;
+ width: min(168px, 28%);
+ z-index: 4;
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ overflow-x: hidden;
+ overflow-y: auto;
+ pointer-events: none;
+}
+.kf-graphs[hidden] { display: none; }
+.kf-graph {
+ pointer-events: auto;
+ flex: 0 0 auto;
+ background: #000a;
+ border: 1px solid #ffffff18;
+ border-radius: 4px;
+ padding: 4px 5px 3px;
+ user-select: none;
+}
+.kf-graph-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 4px;
+ margin-bottom: 2px;
+ font: 700 9px/1 ui-sans-serif, system-ui, sans-serif;
+ letter-spacing: .35px;
+ color: #c8c8d0;
+}
+.kf-graph-head button {
+ margin: 0;
+ padding: 0 3px;
+ border: 0;
+ background: transparent;
+ color: #8b8b93;
+ font: 700 11px/1 ui-sans-serif, system-ui, sans-serif;
+ cursor: pointer;
+ opacity: .75;
+}
+.kf-graph-head button:hover { color: #fff; opacity: 1; }
+.kf-graph canvas {
+ display: block;
+ width: 100%;
+ height: 52px;
+ cursor: crosshair;
+ border-radius: 2px;
+ background: #0a0a0ccc;
+}
+
+.insp-row label.kf-graph-toggle {
+ cursor: pointer;
+ border-radius: 3px;
+ margin: -1px -2px;
+ padding: 1px 2px;
+}
+.insp-row label.kf-graph-toggle:hover {
+ color: #cfc8ff;
+ background: #7b6cff22;
+}
+.insp-row label.kf-graph-toggle.on {
+ color: #b9baff;
+ background: #7b6cff33;
+}
+.insp-row label.kf-graph-toggle.has-kf::after {
+ content: " ◆";
+ font-size: 8px;
+ opacity: .7;
+}
/* ── Per-track VU (RMS / LUFS / Peak) ── */
.vu-meter {
position: absolute;
@@ -1280,6 +1354,54 @@ input[type=range] {
z-index: 3;
}
+/* Keyframe diamonds on the clip — same size/color as ruler beat markers */
+.clip .clip-kfs {
+ position: absolute;
+ left: 0;
+ right: 0;
+ bottom: 1px;
+ height: 8px;
+ pointer-events: none;
+ z-index: 4;
+}
+.clip .clip-kf {
+ position: absolute;
+ top: 0;
+ /* rotated square → ~8×8 tip-to-tip, matching ruler markers */
+ width: 6px;
+ height: 6px;
+ margin-left: -3px;
+ background: #ffd166;
+ transform: rotate(45deg);
+ pointer-events: auto;
+ cursor: pointer;
+}
+.clip .clip-kf:hover {
+ background: #ffe28a;
+}
+/* Count badge when ≥2 channels share this time (diamond stays rotated; numeral counter-rotates) */
+.clip .clip-kf.multi {
+ width: 8px;
+ height: 8px;
+ margin-left: -4px;
+ top: -1px;
+}
+.clip .clip-kf-n {
+ position: absolute;
+ inset: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ transform: rotate(-45deg);
+ font: 700 7px/1 ui-sans-serif, system-ui, sans-serif;
+ color: #1a1a1e;
+ pointer-events: none;
+ user-select: none;
+}
+body.track-size-s .clip .clip-kf-n {
+ font-size: 6px;
+}
+
/* transition wedges — width from transition duration × pps (see transitionMarksHtml) */
.clip .trans-mark {
position: absolute;