Skip to content

feat: make options for appendAnimation and detachAnimation optional #5025

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Frank3K
Copy link
Contributor

@Frank3K Frank3K commented Apr 15, 2025

Description

This PR makes all parameters of AppendAnimationOptions and DetachAnimationOptions optional.

Such that the following is possible:

// Example: Only specify repetitions
appendAnimation('some-animation', { repetitions: 5 });

// Example: Only specify fade for detach
detachAnimation('some-animation', { fade: 200 });

Previously, you had to pass all options, or no options at all (in case the default was used). Current code in master:

interface AppendAnimationOptions {
pingpong: boolean, repetitions: number|null, weight: number,
timeScale: number, fade: boolean|number, warp: boolean|number,
relativeWarp: boolean, time: number|null
}
interface DetachAnimationOptions {
fade: boolean|number
}

@mohammadbaghaei Would you be so kind to do the review? I tried to use appendAnimation, but then I was a bit surprised I needed to pass all parameters. I have no real experience with these methods, so it would be nice if you can take a look and functionally test.

Reference Issue

Such that the following is possible:

// Example: Only specify repetitions
appendAnimation('some-animation', { repetitions: 5 });

// Example: Only specify fade for detach
detachAnimation('some-animation', { fade: 200 });
LoopPingPong :
(repetitions === 1 ? LoopOnce : LoopRepeat);

const needsToStop = repetitions !== Infinity || mode !== LoopPingPong;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mohammadbaghaei I am particularly not 100% sure about this line.

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.

1 participant