Skip to content

Craft.animate() + animateAll()#16849

Merged
brandonkelly merged 2 commits into5.7from
feature/animate
Mar 7, 2025
Merged

Craft.animate() + animateAll()#16849
brandonkelly merged 2 commits into5.7from
feature/animate

Conversation

@brandonkelly
Copy link
Copy Markdown
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