Animation
Setup custom animations for your app.
Modify animations
You can modify the current animations by changing the animations property or by using the keyframes property.
module.exports = {
...,
content: [
"./node_modules/@andore-ui/**/*.{js,ts,jsx,tsx}",
],
plugins: [
require('@andore-ui/theme')({
theme: {
animations: {
"accordion-open": `accordion-open 0.3s ease-in-out`,
}
keyframes: {
"accordion-open": {
from: {height: "0"},
to: {height: "var(--radix-accordion-content-height)"},
},
}
}
}),
],
};
How does it work?
The animations property is used to define the animation name and the duration of the animation. The keyframes property is used to define the animation keyframes.
For example, let's modify the animation of this component:
Animation tokens
The following table lists the available animation tokens:
Token Name | Description |
---|---|
Animation used when an accordion is open | |
Animation used when an accordion is closed | |
Animation used for showing an overlay | |
Animation used for showing content | |
Animation used for sliding down and fading | |
Animation used for sliding left and fading | |
Animation used for sliding up and fading | |
Animation used for sliding right and fading | |
Animation used for indeterminate progress with infinite loop | |
Animation used for circular indeterminate progress with infinite loop | |
Animation used for hiding a snackbar | |
Animation used for showing a snackbar | |
Animation used for swiping out a snackbar |
Animation timing tokens
The timing of the animations described above are controlled by the transitionTimingFunction property. The following table lists the available timing tokens:
Token Name | Value |
---|---|
500ms ease | |
400ms cubic-bezier(0.05, 0.7, 0.1, 1.0) | |
200ms cubic-bezier(0.3, 0.0, 0.8, 0.15) | |
300ms cubic-bezier(0.2, 0.0, 0, 1.0) | |
250ms cubic-bezier(0, 0, 0, 1) | |
200ms cubic-bezier(0.3, 0, 1, 1) |
Note: All the timing described above are the default values defined in Material Design system.
Animation duration tokens
The theme also provides a set of predefined duration tokens that can be used to define the duration of the animations. The following table lists the available duration tokens defined in the transitionDuration property:
Token Name | Value |
---|---|
50ms | |
100ms | |
150ms | |
200ms | |
250ms | |
300ms | |
350ms | |
400ms | |
450ms | |
500ms | |
550ms | |
600ms | |
700ms | |
800ms | |
900ms | |
1000ms |