7/6 TIL

MOON·2020년 7월 6일
0

Portfolio Main Page - 애니메이션 추가

Before

After


코드

import styled, { css, keyframes } from "styled-components";
.
.
.
<MainText efc>
   노멀함.
<br />
 그러나 특별함.
</MainText>

const MainText = styled.div`
  display: inline-block;
  font-size: 70px;
  font-weight: 900;
  height: 20vh;
  margin-top: 15vh;
  color: #fff;
  background: linear-gradient(to right, #dd5e89 20%, #e55d87 30%, #f7bb97 50%);
  ${(props) =>
    props.efc &&
    css`
      animation: ${Effect} 2s linear infinite;
    `};
  background-size: auto;
  background-clip: border-box;
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
`;



const Effect = keyframes`
to {
  background-position: 100% center;
	}
from {
  background-position: 20% center;
}
`;

0개의 댓글