evolvePath()
Part of the @remotion/paths package.
Animates an SVG path from being invisible to it's full length. The function takes two arguments:
-
progressis the progress towards full evolution, where0means the path being invisible, and1meaning the path being fully drawn out.notePassing in a value above 1 will result in the start of the path getting devolved. Passing in a value below 0 will result in the path getting evolved from the end.
-
pathmust be a valid SVG path.
The return value will be an object containing strokeDasharray and strokeDashoffset values, which should be passed to the <path> element.
import { evolvePath } from "@remotion/paths";
const path = "M 0 0 L 100 0";
const evolution = evolvePath (0.5, path );
console .log (evolution ); // { strokeDasharray: '100 100', strokeDashoffset: 50 }
const element = (
<path
d ={path }
strokeDasharray ={evolution .strokeDasharray }
strokeDashoffset ={evolution .strokeDashoffset }
/>
);