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

Craft.animate() + animateAll() #16849

Merged
merged 2 commits into from
Mar 7, 2025
Merged

Craft.animate() + animateAll() #16849

merged 2 commits into from
Mar 7, 2025

Conversation

brandonkelly
Copy link
Member

Description

Adds new Craft.animate() and Craft.animateAll() methods, which apply new CSS properties to the given element(s) with an animation.

A ViewTransition is used for browsers that support it, or Velocity.js is used as a fallback (😒 Firefox).

// animate a single element
await Craft.animate(myElement, {opacity: 0});

// animate multiple elements together
const animations = [
  [myElement1, {opacity: 0}],
  [myElement2, {'margin-top': '-50px'}],
];
await Craft.animateAll(animations);

@brandonkelly brandonkelly merged commit 7c40b3e into 5.7 Mar 7, 2025
@brandonkelly brandonkelly deleted the feature/animate branch March 7, 2025 14:31
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