LoginSignup
1
0

More than 3 years have passed since last update.

React jssでkeyframes

Posted at

CSSで行うkeyframesをjssに起こす

import { createStyles, makeStyles, Theme } from "@material-ui/core/styles";

const useStyles = makeStyles((theme: Theme) => 
  createStyles({
    "@keyframes color": {
        "0%": { backgroundColor: "red" },
        "50%": { backgroundColor: "blue" },
        "100%": { backgroundColor: "green" },
    },
    root: {
       animation: "$color 10s infinite"
    },
  })
);

rootを適用したいコンポーネントに適用すればOK
keyframesfrom/toでも出来るみたいです。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0