line-svg-animation

line-svg-animation 知乎商业前端牛逼

by hangyangws

HTML

<svg version="1.1" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg">
  <symbol id="text">
    <text x="30%" y="35%" class="text">知乎商业</text>
    <text x="30%" y="70%" class="text">前端牛逼</text>
  </symbol>
  <g>
    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#text" class="use-text"></use>
    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#text" class="use-text"></use>
    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#text" class="use-text"></use>
    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#text" class="use-text"></use>
    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#text" class="use-text"></use>
  </g>
</svg>

CSS

.text {
  font-size: 200px;
  font-family: cursive;
}



/* line 19, ../../src/css/source/_chat.scss */

svg {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #000;
}


/* line 27, ../../src/css/source/_chat.scss */

.use-text {
  fill: none;
  stroke: white;
  stroke-dashoffset: 35%;
  stroke-dasharray: 0 87.5%;

  stroke-width: 2px;
}


/* line 38, ../../src/css/source/_chat.scss "#33B5E5","#0099CC","#AA66CC","#9933CC","#99CC00","#669900","#FFBB33","#FF8800","#FF4444","#CC0000"*/

.use-text:nth-child(1) {
  stroke: #360745;
  animation: animation1 8s infinite ease-in-out forwards;
}


/* line 38, ../../src/css/source/_chat.scss */

.use-text:nth-child(2) {
  stroke: #D61C59;
  animation: animation2 8s infinite ease-in-out forwards;
}


/* line 38, ../../src/css/source/_chat.scss */

.use-text:nth-child(3) {
  stroke: #E7D84B;
  animation: animation3 8s infinite ease-in-out forwards;
}


/* line 38, ../../src/css/source/_chat.scss */

.use-text:nth-child(4) {
  stroke: #EFEAC5;
  animation: animation4 8s infinite ease-in-out forwards;
}


/* line 38, ../../src/css/source/_chat.scss */

.use-text:nth-child(5) {
  stroke: #1B8798;
  animation: animation5 8s infinite ease-in-out forwards;
}

@keyframes animation1 {
  50% {
    stroke-dasharray: 7% 28%;
    stroke-dashoffset: 7%;
  }
  70% {
    stroke-dasharray: 7% 28%;
    stroke-dashoffset: 7%;
  }
}

@keyframes animation2 {
  50% {
    stroke-dasharray: 7% 28%;
    stroke-dashoffset: 14%;
  }
  70% {
    stroke-dasharray: 7% 28%;
    stroke-dashoffset: 14%;
  }
}

@keyframes animation3 {
  50% {
    stroke-dasharray: 7% 28%;
    stroke-dashoffset: 21%;
  }
  70% {
    stroke-dasharray: 7% 28%;
    stroke-dashoffset: 21%;
  }
}

@keyframes animation4 {
  50% {
    stroke-dasharray: 7% 28%;
    stroke-dashoffset: 28%;
  }
  70% {
    stroke-dasharray: 7% 28%;
    stroke-dashoffset: 28%;
  }
}

@keyframes animation5 {
  50% {
    stroke-dasharray: 7% 28%;
    stroke-dashoffset: 35%;
  }
 ...