Merge pull request #2450 from dotCooCoo/feat/wiggle-paths-spatial-phase

Shapes: Wiggle Paths has Spatial Phase, which slides its wiggle along the path
This commit is contained in:
BFlat
2026-10-29 10:08:43 +07:00
committed by GitHub
10 changed files with 223 additions and 12 deletions
+1
View File
@@ -324,6 +324,7 @@ fn collect(ctx: &EvalCtx, layer: &Layer, contents: &PropGroup, arena: &mut Vec<B
speed: ctx.f(layer, g, "speed", 2.0),
correlation: ctx.f(layer, g, "correlation", 50.0),
phase_deg: ctx.f(layer, g, "phase", 0.0),
spatial_phase_deg: ctx.f(layer, g, "spatialPhase", 0.0),
seed: ctx.f(layer, g, "seed", 0.0),
};
let t = layer.layer_time(ctx.time).seconds();
+18
View File
@@ -258,6 +258,24 @@ fn round_corners_clip_corner_pixels() {
assert!((coverage(&img) - std::f32::consts::PI * 400.0).abs() < 15.0, "{}", coverage(&img));
}
/// Wiggle Paths' Spatial Phase changes the drawn shape; a whole turn draws it as at 0°.
#[test]
fn wiggle_paths_spatial_phase_renders() {
let render = |phase: f64| {
let (p, cid) = shape_comp(|ids| {
vec![
build::shape_ellipse(ids, [60.0, 60.0], [0.0, 0.0]),
op(ids, "wiggle", &[("size", Value::Scalar(8.0)), ("correlation", Value::Scalar(0.0)), ("spatialPhase", Value::Scalar(phase))]),
build::shape_fill(ids, RED),
]
});
render_frame(&p, cid, Tick::from_seconds_f64(0.5), 1.0).data
};
let zero = render(0.0);
assert!(render(90.0) != zero, "Spatial Phase 90° draws the shape of 0°");
assert!(render(360.0) == zero, "Spatial Phase 360° draws another shape than 0°");
}
#[test]
fn wiggle_paths_vary_over_time_deterministically() {
let (p, cid) = shape_comp(|ids| {