Implement shape tweens (same-topology lerp)

`tween_after == Shape` was stored on keyframes but never read. Now the
render path morphs geometry across a shape-tween span:

- VectorGraph::interpolated(other, t): same-topology lerp of vertex
  positions, edge curves, stroke widths and stroke/fill colours. Returns
  None when topology differs (counts, deleted flags, edge endpoints, fill
  boundaries), so the caller holds the source keyframe.
- VectorLayer::tweened_graph_at(time): returns an owned morphed graph for
  a shape-tween span whose two keyframes share topology, else borrows the
  held keyframe. Editing still uses graph_at_time (the held keyframe).
- Renderer (Vello + CPU paths) renders via tweened_graph_at.
- SetTweenAction + wired the previously-stubbed "Add Shape Tween" menu.

The typical workflow — keyframe, duplicate it (same topology), move
vertices, Add Shape Tween — now morphs between the two. Non-matching
topology falls back to a hold.
This commit is contained in:
Skyler Lehmkuhl
2026-06-21 15:46:53 -04:00
parent 1dd5de4617
commit a1acecf396
8 changed files with 282 additions and 7 deletions
@@ -3761,8 +3761,16 @@ impl EditorApp {
// TODO: Implement add motion tween
}
MenuAction::AddShapeTween => {
println!("Menu: Add Shape Tween");
// TODO: Implement add shape tween
if let Some(layer_id) = self.active_layer_id {
let action = lightningbeam_core::actions::SetTweenAction::new(
layer_id,
self.playback_time,
lightningbeam_core::layer::TweenType::Shape,
);
if let Err(e) = self.action_executor.execute(Box::new(action)) {
eprintln!("Failed to add shape tween: {}", e);
}
}
}
MenuAction::ReturnToStart => {
println!("Menu: Return to Start");