Add settled prop for declarative animation suppression#3585
Closed
mattgperry wants to merge 1 commit intomainfrom
Closed
Add settled prop for declarative animation suppression#3585mattgperry wants to merge 1 commit intomainfrom
mattgperry wants to merge 1 commit intomainfrom
Conversation
When settled={false}, all animations are applied instantly (type: false)
with no interpolation, equivalent to CSS transition: none. When settled
transitions from false to true, the current animate value is applied
instantly to prevent catch-up animations. Only subsequent changes after
settled is true use the configured transition.
Fixes #3560
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryAdded Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[animateChanges called] --> B{props.settled === false?}
B -->|Yes| C[isUnsettled = true]
B -->|No| D{prevProps.settled === false?}
D -->|Yes| C
D -->|No| E[isUnsettled = false]
C --> F[Apply transitionOverride: type false]
F --> G[Animation applies instantly]
E --> H[Normal transition behavior]
H --> I[Animation interpolates over time]
Last reviewed commit: 36dd6b3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
settledboolean prop to motion components that suppresses animation interpolation whenfalsesettled={false}, all animations apply instantly (type: false), equivalent to CSStransition: nonesettledtransitions fromfalsetotrue, the currentanimatevalue applies instantly (no catch-up animation), and only subsequent changes respect the configuredtransitionProblem
When async measurement systems (e.g.
IntersectionObserver,ResizeObserver) fire multiple corrections during initialization, each state change triggers a new animation in motion components. There was no declarative way to suppress interpolation during this unstable period. The existing APIs (initial={false},transition: { duration: 0 },transition.delay) each fail to fully address the measurement flutter problem as detailed in #3560.Implementation
The fix is minimal — two changes in
motion-dom:node/types.ts): Addedsettled?: booleantoMotionNodeAnimationOptionsrender/utils/animation-state.ts): InanimateChanges(), when the component is unsettled (settled === falseorsettledjust flipped fromfalsetotrue), all animations receivetransitionOverride: { type: false }which applies values instantly with no interpolationUsage
Test plan
settled={false}settled={false}settledbecomestruesettledfalse→true transition applies instantly (no catch-up)Fixes #3560
🤖 Generated with Claude Code