animation support ignore default#964
Conversation
Deploying webgal-dev with
|
| Latest commit: |
8accb4c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d23b489d.webgal-dev.pages.dev |
| Branch Preview URL: | https://animation-ignore-default.webgal-dev.pages.dev |
There was a problem hiding this comment.
Code Review
This pull request introduces an ignoreDefault option across various animation scripts (including changeBg, changeFigure, setAnimation, setTempAnimation, setTransform, and setTransition) to control whether default animation settings are ignored. It updates the stage animation settings interface and refactors the animation timeline logic to support this behavior. Feedback was provided on getAnimationTimeline to explicitly exclude 'scale' and 'position' from the initial pickBy call when writeFullEffect is false, preventing potential side effects from copying nested objects by reference when they are not being animated.
| const originalTransform = { ...pickBy(sourceTransform, (source, key) => unionKeys.has(key)) }; | ||
| if (unionScaleKeys.size > 0) originalTransform.scale = targetScale; | ||
| if (unionPositionKeys.size > 0) originalTransform.position = targetPosition; |
There was a problem hiding this comment.
When writeFullEffect is false, pickBy is used to copy properties from sourceTransform based on unionKeys. However, since scale and position are nested objects, copying them directly by reference can lead to unexpected behavior if they are not being animated (i.e., when unionScaleKeys or unionPositionKeys are empty).
By explicitly excluding 'scale' and 'position' from the initial pickBy call, we can ensure they are only added to originalTransform when they are actually being animated.
const originalTransform = {
...pickBy(sourceTransform, (source, key) => unionKeys.has(key) && key !== 'scale' && key !== 'position'),
};
if (unionScaleKeys.size > 0) originalTransform.scale = targetScale;
if (unionPositionKeys.size > 0) originalTransform.position = targetPosition;
No description provided.