Ani Motion is a lightweight (8.59 KB including CSS) library that adds minimalistic animations to your Webstudio site, including on Radix Components.
data-ani attribute with a value representing the animation effect, such as fade.<aside> π‘ Note: To add custom attributes in Webstudio, select the instance in the Navigator, go to the Settings Panel, and click the + next to Properties & Attributes.
</aside>
Ani Motion supports three types of animation triggers:
Intersection
data-ani
Animations play when the instance enters the viewport, running from start to finish.
Scroll
data-ani-progress
Animations progress as the instance moves through the viewport.
State
data-ani
Animations run when changing between two states, like on Radix Components.
| Value | data-ani | data-ani-progress | Notes |
|---|---|---|---|
| fade | β | β | |
| slide-up | β | β | |
| slide-down | β | β | |
| slide-left | β | β | |
| slide-right | β | β | |
| zoom | β | β | |
| flip-y | β | β | |
| flip-x | β | β | |
| expand | β | β | Primarily intended for Radix Components with open/closed states like Accordions. |
All animation effects are compatible with Radix Components, which have various states such as active/inactive or open/closed. The animations automatically target these states, allowing you to use Ani Motion like any other component.
<aside>
π‘ Note: Scroll-based animations (data-ani-progress) are not compatible with Radix Components since interacting with a dynamic component merits an animation to run from start to finish when triggered, not based on scroll position.
</aside>
Radix Components have multiple instances, so it's important to add the animation attribute to the correct instance β the one carrying the state (e.g., open/closed). Here's where to apply the attribute:
| Radix Component | Instance | Notes |
|---|---|---|
| Accordion | Item Content | Removing the default margin on Item Content because it causes a jump during the transition. |
| Collapsible | Collapsible Content | |
| Dialog | Dialog Content | |
| Navigation Menu | Menu Viewport | Be sure to use Menu Viewport and not Menu Content. Also manually add a height and width transition to Menu Viewport. Itβll make the transition between multiple dropdowns smooth. Remove overflow hidden from the Menu Viewport and add it to the Viewport Container. |
| Popover | Popover Content | |
| Select List | Select Content | |
| Tooltip | Tooltip Content | |
| Tabs | Tab Content* | *Avoid using animations on Tabs due to a "jumping" effect caused by two simultaneous fading animations (the selected tab entering and the previous tab leaving). |
| Sheet | Sheet Content |