Skip to content

Paths

fframes_kit::paths has Remotion’s @remotion/paths in snake_case over kurbo::BezPath: get_length, get_point_at_length, get_tangent_at_length, evolve_path, interpolate_path, translate_path, scale_path, reverse_path, cut_path, warp_path, normalize_path, get_bounding_box, get_subpaths, extend_view_box, center_path, parse_path, serialize, reset_path, reduce_instructions, and align_points(a, b, n) (the same number of subpaths and cubic segments in both, turned to start at the nearest points), which Morph runs on.

use fframes_kit::prelude::*;
let square = paths::parse_path("M0 0 L10 0 L10 10 L0 10 Z").unwrap();
assert_eq!(paths::get_length(&square), 40.0);
assert_eq!(paths::get_length(&paths::cut_path(&square, 20.0)), 20.0);
let half = paths::interpolate_path(0.5, &square, &paths::scale_path(&square, 2.0, 2.0));
assert!((paths::get_bounding_box(&half).width() - 15.0).abs() < 1e-9);