User avatar

Jeroen Reumkens PRO

Motion opacity animate autoplay

Unlock Playground Access

Playgrounds let you build, test, and share frontend ideas instantly — right in your browser. Access is included in PRO. Just want Playgrounds? Pick a plan below.

Maker

€5,- / month

Unlimited Playgrounds access to build, experiment, and share without limits.

Join for €5 per month

Champion

€10,- / month

All the benefits of Maker, plus you help Frontend.fyi grow and get a Champion badge on your profile.

Join for €10 per month

Cancel anytime — no commitment.
Upgrade to PRO anytime and get a partial refund.We'll credit 100% of your first 3 months and 50% of the rest toward the PRO lifetime price.

Already a member? Login

Playground settings

Title

Description

Public

Editor settings


Packages

These packages can be imported in your JavaScript files.

Package name

Version

@

@

@

12345678910111213141516171819202122232425262728293031323334353637
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>
  );
}
One sec — editor's thinking…