Skip to content

fix: only animate properties defined by keyframes#58

Merged
Xerrion merged 1 commit intomasterfrom
fix/animation-property-scoping
Mar 7, 2026
Merged

fix: only animate properties defined by keyframes#58
Xerrion merged 1 commit intomasterfrom
fix/animation-property-scoping

Conversation

@Xerrion
Copy link
Collaborator

@Xerrion Xerrion commented Mar 7, 2026

Summary

Animations that don't define scale or translate keyframes (e.g. fadeIn/fadeOut) no longer override the frame's existing scale or position. This fixes visible "jumping" when frames have a user-configured scale other than 1.0.

Problem

ApplyToFrame unconditionally called SetScale(sc), ClearAllPoints()+SetPoint(), and SetAlpha(al) every animation tick. For animations without scale keyframes, sc defaulted to 1.0 via PROPERTY_DEFAULTS, forcing the frame to scale 1.0 regardless of its configured scale. On animation completion, onFinished callbacks would restore the correct scale - causing a visible snap.

Same issue with translate: alpha-only animations unnecessarily repositioned the frame every tick.

Changes

  • Keyframe introspection: Animate() now scans keyframes to determine which properties the animation defines (hasScale, hasTranslate)
  • Conditional application: ApplyToFrame only sets translate/scale when the animation defines those properties
  • Relative scale: Scale is now applied as sc * originalScale instead of absolute sc. A keyframe scale=0.3 means "30% of original", scale=1.0 means "back to original"
  • Conditional restore: Stop() only restores properties that were animated
  • Alpha remains always animated for backward compatibility (slide animations rely on default alpha=1.0)

Backward Compatibility

Animation type hasScale hasTranslate Behavior
fadeIn/fadeOut false false Only alpha. Scale and position untouched.
slideInRight/moveUp false true Position + alpha. Scale untouched.
zoomIn/bounceIn true false Scale (relative) + alpha. Position untouched.
zoomInLeft/backInRight true true All three properties animated.

No breaking changes for existing consumers.

Animations that don't define scale keyframes (e.g. fadeIn/fadeOut) no longer
override the frame's existing scale. Scale is now applied relative to the
frame's originalScale. Translate and scale are conditional based on keyframe
introspection; alpha remains always animated for backward compatibility.
@Xerrion Xerrion merged commit 20ab83a into master Mar 7, 2026
1 check passed
@Xerrion Xerrion deleted the fix/animation-property-scoping branch March 7, 2026 12:41
Xerrion pushed a commit that referenced this pull request Mar 7, 2026
🤖 I have created a release *beep* *boop*
---


##
[3.5.7](3.5.6...3.5.7)
(2026-03-07)


### Bug Fixes

* only animate properties defined by keyframes
([#58](#58))
([20ab83a](20ab83a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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