css+js实现文字字母粗细动画效果代码

代码语言:html

所属分类:动画

代码描述:css+js实现文字字母粗细动画效果代码

代码标签: css js 文字 字母 粗细 动画

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

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  


  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@100..700&display=swap");

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:#1d233b;
}

h1 {
  font-family: 'Roboto Mono', monospace;
  font-size: 7rem;
  text-align: center;
}

.chars {
  font-variation-settings: 'wght' 100;
  animation-name: pulse;
  animation-iteration-count: infinite;
  will-change: tranform;
}

@keyframes pulse {
  0% {
	font-variation-settings: 'wght' 100;
	filter: grayscale(80%);
  }
  50% {
	font-variation-settings: 'wght' 700;
	filter: grayscale(0%);
  }
  100% {
	font-variation-settings: 'wght' 100;
	filter: grayscale(80%);
  }
}
</style>



  
  
</head>

<body >
  <h1 data-splitting="chars"><span><span class="chars" style="animation-delay: 0ms; animation-duration: 4500ms; color: rgb(255, 77, 77);">f</span><span class="chars" style="animation-delay: 150ms; animation-duration: 4500ms; color: rgb(255, 184, 77);">a</span><span class="chars" style="animation-delay: 300ms; animation-duration: 4500ms; color: rgb(219, 255, 77);">n</span><span class="chars" style="animation-delay: 450ms; animation-duration: 4500ms; color: rgb(112, 255, 77);">c</span><span class="chars" style="animation-delay: 600ms; animation-duration: 4500m.........完整代码请登录后点击上方下载按钮下载查看

网友评论0