svg文字动画效果

代码语言:html

所属分类:动画

代码描述:svg文字动画效果

代码标签: 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
* {
  box-sizing: border-box;
}
body {
  min-height: 100vh;
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: center;
          justify-content: center;
  text-align: center;
  background: #0d0d0d;
}
svg {
  width: 75vmin;
}
:root {
  --fade-delay: 1;
  --fade-duration: 1;
  --move-duration: 4;
  --merge-duration: 1;
  --merge-delay: calc(var(--move-duration) - var(--merge-duration));
}
path {
  -webkit-animation: fade calc(var(--fade-duration) * 1s) calc(var(--fade-delay) * 1s) ease-in both, move calc(var(--move-duration) * 1s) ease-out forwards, merge calc(var(--merge-duration) * 1s) calc(var(--merge-delay) * 1s) ease-out forwards;
          animation: fade calc(var(--fade-duration) * 1s) calc(var(--fade-delay) * 1s) ease-in both, move calc(var(--move-duration) * 1s) ease-out forwards, merge calc(var(--merge-duration) * 1s) calc(var(--merge-delay) * 1s) ease-out forwards;
  -webkit-animation: move 10s infinite linear;
          animation: move 10s infinite linear;
  fill: none;
  stroke: hsl(var(--hue), 80%, 60%);
  stroke-dasharray: var(--dash);
  stroke-width: 1px;
}
.text {
  -webkit-filter: drop-shadow(0px 0px 10px rgba(255,255,255,0.75));
          filter: drop-shadow(0px 0px 10px rgba(255,255,255,0.75));
}
g:nth-of-type(1) path {
  --hue: 120;
  --dash: 1 3;
  --from: 0%;
  --to: -100%;
}
g:nth-of-type(2) path {
  --hue: 0;
  --dash: 1 1;
  --from: 50%;
  --to: 70%;
}
g:nth-of-type(3) path {
  display: none;
  --hue: 85;
  --dash: 2 2;
}
g:nth-of-type(4) path {
  --dash: 2 3;
  --hue: 190;
  --from: 0;
  --to: 160%;
}
g:nth-of-type(5) path {
  --dash: 2 6;
  --hue: 45;
  --from: 0;
  --to: 200%;
}
g:nth-of-type(6) path {
  --dash: 0 0;
  --hue: 250;
  --from: 45%;
  --to: -100%;
}
@-webkit-keyframes move {
  from {
    stroke-dashoffset: var(--from, 0%);
  }
  to {
    stroke-dashoffset: var(--to, 200%);
  }
}
@keyframes move {
  from {
    stroke-dashoffset: var(--from, 0%);
  }
  to {
    stroke-dashoffset: var(--to, 200%);
  }
}
@-webkit-keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@-webkit-keyframes merge {
  to {
    stroke: #fff;
  }
}
@keyframes merge {
  to {
    stroke: #fff;
  }
}
</style>

</head>
<body translate="no">
<div class="text">
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 63 21">
<g aria-label="JH3Y">
<path d="M5 14l1 2 2 1 2-1V5H4V1h10v16l-2 1-2 2H5l-2-2-1-1-1-3zM18 20V1h4v7h4V1h4v19h-4v-8h-4v8zM39 20h-3l.........完整代码请登录后点击上方下载按钮下载查看

网友评论0