Skip to content
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

Animate values when child variant definitions change #2804

Merged
merged 3 commits into from
Sep 19, 2024

Conversation

mattgperry
Copy link
Collaborator

Ensure that when the value of a variant changes, we animate to the latest value.

<motion.div initial="a">
  <motion.div variants={{ a: { x }}} />
</motion.div>

@@ -0,0 +1,43 @@
import { VisualElement } from "../VisualElement"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a bit of a drive-by moving the method out into a function. To improve code-splitting I want to prefer functions over methods where possible.

@mattgperry mattgperry merged commit 111c7c0 into main Sep 19, 2024
1 check passed
@mattgperry mattgperry deleted the fix/change-variant-values branch September 19, 2024 08:13
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.

2 participants