zoukankan      html  css  js  c++  java
  • 炫酷CSS文字动画

    HTML

    <div class="container">
        <svg viewBox="0 0 1000 300">
          <symbol id="line-text">
            <text text-anchor="middle" x="50%" y="50%" dy=".4em">
              Microgoople
            </text>
          </symbol>
          <use xlink:href="#line-text" class="text"></use>
          <use xlink:href="#line-text" class="text"></use>
          <use xlink:href="#line-text" class="text"></use>
          <use xlink:href="#line-text" class="text"></use>
        </svg>
      </div>
    

    CSS

    * {
      padding: 0;
      margin: 0;
    }
    
    body {
      background-color: rgb(41, 45, 62);
    }
    
    .container {
      font-size: 120px;
      font-weight: bold;
      text-transform: uppercase;
    }
    
    svg {
      position: absolute;
       100%;
      height: 100%;
    }
    
    .text {
      fill: none;
      stroke- 5;
      stroke-dasharray: 0 240;
      stroke-dashoffset: 0;
    }
    
    .text:nth-child(4n + 1) {
      stroke: rgb(39, 135, 238);
      animation: text1 4s ease-in-out forwards;
    }
    .text:nth-child(4n + 2) {
      stroke: rgb(47, 169, 92);
      animation: text2 4s ease-in-out forwards;
    }
    .text:nth-child(4n + 3) {
      stroke: rgb(249, 189, 56);
      animation: text3 4s ease-in-out forwards;
    }
    .text:nth-child(4n + 4) {
      stroke: rgb(235, 61, 50);
      animation: text4 4s ease-in-out forwards;
    }
    
    @keyframes text1 {
      100% {
        stroke-dashoffset: 1000;
        stroke-dasharray: 60 180;
      }
    }
    
    @keyframes text2 {
      100% {
        stroke-dashoffset: 1060;
        stroke-dasharray: 60 180;
      }
    }
    
    @keyframes text3 {
      100% {
        stroke-dashoffset: 1120;
        stroke-dasharray: 60 180;
      }
    }
    
    @keyframes text4 {
      100% {
        stroke-dashoffset: 1180;
        stroke-dasharray: 60 180;
      }
    }
    

    效果展示

    在这里插入图片描述

  • 相关阅读:
    SpringApplication类-1
    post与head注入
    sql_post注入
    渗透测试点线面合集
    渗透入侵溯源
    VMware 安装Tools 失败的问题:VGAuthService 启动失败
    Weblogic wls-wsat XMLDecoder 反序列化漏洞复现(CVE-2017-10271)
    web常见的中间件漏洞及复现
    XX点评H5字体映射
    python控制阿里云服务器开机,关机,重启
  • 原文地址:https://www.cnblogs.com/geq2020/p/12636878.html
Copyright © 2011-2022 走看看