Styled-components Animation

2022. 3. 29. 03:09코딩공부/React

import { keyframes } from 'styled-components';

import React from 'react';
import styled from 'styled-components';
import { keyframes } from 'styled-components';

const Father = styled.div`
  display: flex;
`;

const animation = keyframes`
  from {
    transform: rotate(0deg);
  }
  to{
    transform: rotate(360deg);
  }
`;

const animationTwo = keyframes`
  0% {
    transform: rotate(0deg);
    border-radius: 0px;
  }
  50% {
    transform: rotate(360deg);
    border-radius: 100px;
  }
  100% {
    transform: rotate(0deg);
    border-radius: 0px;
  }
`;

const Box = styled.div`
  height: 200px;
  width: 200px;
  background-color: tomato;
  animation: ${animation} 1s linear infinite;
`;

function App() {
  return (
    <Father>
      <Box/>
    </Father>
  );
}

export default App;