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%;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0