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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user