User avatar

Jeroen Reumkens PRO

Motion opacity animate autoplay

Unlock Playgrounds

Build, test and share frontend ideas right in your browser.

Choose a plan

Cancel anytime. Playgrounds are also included in PRO. Upgrade later and we credit 100% of your first 3 months and 50% of the rest toward it.

Already a member? Log in

Playground settings

Playground

Anyone with the link can view it. Private playgrounds are only visible to you.

Editor

Applied right away

Files in the same folder share one tab.

Packages

Importable from your code, loaded from esm.sh

import { useAnimate } from 'motion/react';
import { useEffect } from 'react';

export const App = () => {
const [scope, animate] = useAnimate();
useEffect(() => {
const controls = animate("h1", { opacity: 0.5, x: 200 }, { autoplay: false });
setTimeout(() => {
controls.play();
}, 2000);
}, [])
return (
<div ref={scope} className="grid min-h-dvh place-items-center text-white">
<div className="flex flex-col items-center">
<img
className="mb-8 h-12 w-12"
src="https://sandpack.frontend.fyi/img/fefyi.svg"
/>
<h1
className="mb-6 max-w-[60%] text-balance text-center font-mono text-3xl text-white opacity-0"
>
Time to draw some rectangles
</h1>
<a
href="https://www.frontend.fyi/dev"
target="_blank"
className="text-sm uppercase"
>
Frontend.FYI Dev Playgrounds
</a>
</div>
</div>
);
}
  • No matching files
↵ open⌘↵ open to the sideesc close