Skip to content

Instantly share code, notes, and snippets.

@AEnMe
Last active July 1, 2020 07:51
Show Gist options
  • Save AEnMe/d69c4118af6685026f73303a9dfc3bfd to your computer and use it in GitHub Desktop.
Save AEnMe/d69c4118af6685026f73303a9dfc3bfd to your computer and use it in GitHub Desktop.
TrimPath-OffsetStroke
//Used to offset the dashes of a stroke while the trim start is animated.
start = thisProperty.propertyGroup(4).content("Trim Paths 1").start; // Path to the Trim Path's start slider
path = thisProperty.propertyGroup(4).content("Path 1").path; // Path to the vector path
n = 0;
for (i = 0; i < path.points().length - 1; i++) {
n += length(path.points()[i], path.points()[i + 1]); // Sum of all the length between two points
}
offset = start * n / 100; // offset the dashes to stay in place while start is animated
value + offset;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment