Skip to content

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

Merged
merged 30 commits into from
Aug 11, 2025
Merged

Feature/animation #149

merged 30 commits into from
Aug 11, 2025

Conversation

whitphx
Copy link
Owner

@whitphx whitphx commented Aug 10, 2025

Resolves #142

Copy link

changeset-bot bot commented Aug 10, 2025

🦋 Changeset detected

Latest commit: 0c68647

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
slidev-addon-fancy-arrow Minor

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

@whitphx whitphx marked this pull request as draft August 10, 2025 14:14
@whitphx whitphx marked this pull request as ready for review August 11, 2025 15:37
@whitphx whitphx requested a review from Copilot August 11, 2025 15:37
Copilot

This comment was marked as outdated.

whitphx and others added 4 commits August 12, 2025 00:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@whitphx whitphx requested a review from Copilot August 11, 2025 15:55
Copilot

This comment was marked as outdated.

@whitphx whitphx requested a review from Copilot August 11, 2025 16:06
Copilot

This comment was marked as outdated.

whitphx and others added 3 commits August 12, 2025 01:08
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@whitphx whitphx requested a review from Copilot August 11, 2025 16:15
Copilot

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@whitphx whitphx requested a review from Copilot August 11, 2025 16:32
Copy link
Contributor

@Copilot Copilot AI left a 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}`;
Copy link
Preview

Copilot AI Aug 11, 2025

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.

Suggested change
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]))/);
Copy link
Preview

Copilot AI Aug 11, 2025

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.

@whitphx whitphx merged commit d08777a into main Aug 11, 2025
7 checks passed
@whitphx whitphx deleted the feature/animation branch August 11, 2025 16:33
@github-actions github-actions bot mentioned this pull request Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Animation like v-mark
1 participant