Skip to content

Instantly share code, notes, and snippets.

@koss-lebedev
Last active July 23, 2019 11:41
Show Gist options
  • Save koss-lebedev/6de1e25f7850700097dcad0ffaae82a8 to your computer and use it in GitHub Desktop.
Save koss-lebedev/6de1e25f7850700097dcad0ffaae82a8 to your computer and use it in GitHub Desktop.
const Four = () => {
const [active, setActive] = React.useState(false);
const rectangle: Variants = {
active: { background: "#ff00b1", rotate: 90 },
disabled: { background: "#0D00FF", rotate: 0 }
};
return (
<motion.div
className="rectangle"
variants={rectangle}
animate={active ? "active" : "disabled"}
onClick={() => setActive(!active)}
>
Click me!
</motion.div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment