Onion skinning (raster): toggle + tinted ghosts of the active layer

- OnionSkinSettings (editor view state): enabled, frames_before/after (default 2/2),
  opacity (0.35), warm past / cool future tints, linear falloff. Threaded App →
  SharedPaneState (gated off during playback) → VelloRenderContext.
- Toggle: View ▸ Onion Skinning + the `O` shortcut (AppAction::ToggleOnionSkin).
- Tint: packed an RGB multiply into the canvas-blit matrix uniform's unused .w slots
  (1,1,1 = no tint for all normal blits); BlitTransform::with_tint. Shader multiplies.
- Render: for the ACTIVE raster layer only, blit the N neighbouring keyframes (full
  texture if resident, else the low-res proxy — uploaded on demand) tinted + faint,
  composited behind the current frame. Off during playback.

Next: a settings panel (frame count/opacity) and vector-layer ghosts.
This commit is contained in:
Skyler Lehmkuhl
2026-06-20 23:05:57 -04:00
parent f585c370e8
commit 53cae1bfe5
7 changed files with 167 additions and 6 deletions
@@ -67,5 +67,8 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
let mask = textureSample(mask_tex, mask_sampler, canvas_uv).r;
let masked_a = c.a * mask;
let inv_a = select(0.0, 1.0 / c.a, c.a > 1e-6);
return vec4<f32>(c.r * inv_a, c.g * inv_a, c.b * inv_a, masked_a);
// RGB tint packed into the matrix uniform's unused .w slots (1,1,1 = no tint).
// Used by onion-skin ghosts (warm = past, cool = future).
let tint = vec3<f32>(transform.col0.w, transform.col1.w, transform.col2.w);
return vec4<f32>(c.r * inv_a * tint.r, c.g * inv_a * tint.g, c.b * inv_a * tint.b, masked_a);
}