본문 바로가기
CSS

SVG animation

by 🐬마뇽뇽 마뇽🦄 2022. 9. 8.
728x90

SVG animation

텍스트 애니메이션을 준비해보았습니다.

html

svg viewBox="0 0 1320 300">
    <text x="50%" y="50%" dy="40px" text-anchor="middle">해파리</text>
</svg>
<

css

@font-face {
    font-family: 'PyeongChangPeace';
    font-weight: 300;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/PyeongChang/PyeongChangPeace-Light.eot');
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/PyeongChang/PyeongChangPeace-Light.eot?#iefix') format('embedded-opentype'),
        url('https://cdn.jsdelivr.net/gh/webfontworld/PyeongChang/PyeongChangPeace-Light.woff2') format('woff2'),
        url('https://cdn.jsdelivr.net/gh/webfontworld/PyeongChang/PyeongChangPeace-Light.woff') format('woff'),
        url('https://cdn.jsdelivr.net/gh/webfontworld/PyeongChang/PyeongChangPeace-Light.ttf') format("truetype");
    font-display: swap;
} 
@font-face {
    font-family: 'PyeongChangPeace';
    font-weight: 700;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/PyeongChang/PyeongChangPeace-Bold.eot');
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/PyeongChang/PyeongChangPeace-Bold.eot?#iefix') format('embedded-opentype'),
        url('https://cdn.jsdelivr.net/gh/webfontworld/PyeongChang/PyeongChangPeace-Bold.woff2') format('woff2'),
        url('https://cdn.jsdelivr.net/gh/webfontworld/PyeongChang/PyeongChangPeace-Bold.woff') format('woff'),
        url('https://cdn.jsdelivr.net/gh/webfontworld/PyeongChang/PyeongChangPeace-Bold.ttf') format("truetype");
    font-display: swap;
} 

body {
  background-color: #e0deff;
}
svg {
  font-family: "PyeongChangPeace";
  font-size: 140px;
  position: absolute;
  width: 100%;
  height: 100%;
  font-weight: 700;
  animation: stroke 5s 1 alternate ;
  fill :rgba(108, 124, 218)
}
@keyframes stroke {
  0% {
  stroke-dashoffset: 25%;
  stroke-dasharray : 0 50%;
  fill :rgba(108, 124, 218,0);
  stroke : rgba(86, 103, 199,1);
  stroke-width : 2;
  }
  70% {
    fill :rgba(108, 124, 218,0);
    stroke : rgba(86, 103, 199,1);
  }
  80% {
    fill :rgba(108, 124, 218,0);
    stroke : rgba(86, 103, 199,1);
  }
  100% {
  stroke-dashoffset: -25%;
   stroke-dasharray : 50% 0;
  fill :rgba(108, 124, 218,1);
  stroke : rgba(86, 103, 199,0);
  stroke-width : 2;
  }
}
728x90

'CSS' 카테고리의 다른 글

애니메이션 만들기  (3) 2022.09.08
css intro  (2) 2022.09.08
SVG Intro  (5) 2022.09.08
두 원이 돌아가는 애니메이션  (2) 2022.08.29
박스가 움직이는 애니메이션  (3) 2022.08.29

댓글


고양이 고양이
고양이 고양이
고양이 고양이