21
loading...
This website collects cookies to deliver better user experience
npm install react-animation-maker
import { Animate } from 'react-animation-maker'
<Animate
from={{backgroundColor: '#f00'}}
to={[{backgroundColor: '#0f0'}]}>
Hello, World!
</Animate>
<Animate
from={{backgroundColor: '#f00'}}
to={[
{backgroundColor: '#0f0'},
{backgroundColor: '#00f'},
]}>
Hello, World!
</Animate>
style: js-css object
for the general style of all stages.durations: string[]
the durations between stages, its default value ['1s'].delay: int
specifies the delay time in milliseconds.loop: boolen
to indicate wheather the animation loops forever or not.<Animate
from={{backgroundColor: '#f00'}}
to={[
{backgroundColor: '#0f0'},
{backgroundColor: '#00f'},
{backgroundColor: '#f0f'},
{backgroundColor: '#fff'},
]}
durations={['250ms', '500ms', '750ms', '1s']}>
Hello, World!
</Animate>
import { Animate, FancyPopIn } from 'react-animation-maker'
<Animate
from={FancyPopIn.from}
to={FancyPopIn.to}
durations={FancyPopIn.durations}>
Hello, World!
</Animate>
import { useAnimate, FadeIn, FadeOut } from 'react-animation-maker'
const App = () => {
const [Anim, setAnim] = useAnimate(FadeIn);
return (
<div>
<Anim>
Hello, World!
</Anim>
<button onClick={() => setAnim(FadeOut)}>
Change Anim
</button>
</div>
);
}
import { useAnimate, FadeIn } from 'react-animation-maker'
const App = () => {
const [Anim, setAnim] = useAnimate(FadeIn);
return (
<div>
<Anim>
Hello, World!
</Anim>
<button onClick={() => setAnim({from: {}, to: {[{opacity: 0}]})}>
Change Anim
</button>
</div>
);
}