evolvePath()
Part of the @remotion/paths
package.
Animates an SVG path from being invisible to it's full length. The function takes two arguments:
progress
is the progress towards full evolution, where0
means the path being invisible, and1
meaning 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.
path
must 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.
tsx
import {evolvePath } from "@remotion/paths";constpath = "M 0 0 L 100 0";constevolution =evolvePath (0.5,path );console .log (evolution ); // { strokeDasharray: '100 100', strokeDashoffset: 50 }constelement = (<path d ={path }strokeDasharray ={evolution .strokeDasharray }strokeDashoffset ={evolution .strokeDashoffset }/>);
tsx
import {evolvePath } from "@remotion/paths";constpath = "M 0 0 L 100 0";constevolution =evolvePath (0.5,path );console .log (evolution ); // { strokeDasharray: '100 100', strokeDashoffset: 50 }constelement = (<path d ={path }strokeDasharray ={evolution .strokeDasharray }strokeDashoffset ={evolution .strokeDashoffset }/>);