-
-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/animation #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/animation #149
Conversation
🦋 Changeset detectedLatest commit: 0c68647 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds animation capabilities to the FancyArrow component, allowing arrows to be drawn with a stroke animation effect. The implementation includes support for custom animation duration and delay parameters.
- Adds animation properties (
animated
,animationDuration
,animationDelay
) to the FancyArrow component - Implements stroke-dash animation for arrow paths and arrowheads with proper timing coordination
- Creates utility functions to split SVG paths for individual animation segments
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
slides.md | Adds documentation examples demonstrating the new animation features |
components/FancyArrow.vue | Adds animation props and CSS keyframes for stroke-dash and fill animations |
components/use-rough-arrow.ts | Implements core animation logic with path splitting and timing coordination |
components/split-path.ts | Utility functions to split SVG path definitions into individual segments |
components/split-path.test.ts | Unit tests for path splitting functionality |
.changeset/silver-aliens-prove.md | Changeset entry documenting the minor version bump |
(index / segment.strokedPaths.length) * segmentDuration; | ||
path.style.animation = `${strokeAnimationKeyframeName} ${pathDuration}ms ease-out ${pathDelay}ms forwards`; | ||
path.style.strokeDashoffset = `${segment.length}`; | ||
path.style.strokeDasharray = `${segment.length}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The segment.length
value is used for both strokeDashoffset
and strokeDasharray
, but this represents the arc length while the path length might be different. Consider calculating the actual path length using path.getTotalLength()
for more accurate animation.
path.style.strokeDasharray = `${segment.length}`; | |
const pathLength = path.getTotalLength(); | |
path.style.strokeDashoffset = `${pathLength}`; | |
path.style.strokeDasharray = `${pathLength}`; |
Copilot uses AI. Check for mistakes.
@@ -0,0 +1,17 @@ | |||
export function splitPathDefinition(d: string): string[] { | |||
const segments = d.split(/(?=M(?![a-z]))/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern (?=M(?![a-z]))
might not handle all valid SVG path commands correctly. Consider using a more comprehensive SVG path parser or documenting the limitations of this approach, as it may fail with relative move commands (lowercase 'm') or other edge cases.
Copilot uses AI. Check for mistakes.
Resolves #142