canvas实现2025年新年快乐夜晚烟花动画效果代码

代码语言:html

所属分类:动画

代码描述:canvas实现2025年新年快乐夜晚烟花动画效果代码

代码标签: canvas 2025 新年 快乐 夜晚 烟花 动画

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

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

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

  <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Rowdies:wght@300;400;700&display=swap" rel="stylesheet">
  
  
  
<style>
body{ background: url(//repo.bfw.wiki/bfwrepo/image/611da9b999795.png) no-repeat;
background-size: cover;
  overflow:clip;
  height:100vh;
  display:flex;
  justify-content:center;
  align-items:center;
}
canvas{
  position:fixed;
  inset:0;
  z-index:1;
  filter:blur(1px)
}
h1{  

  font-weight: 700;
  color:#ffaa;
  font-size:30vw;
  margin:auto;
  opacity:.8;
  pointer-events:none;
  user-select: none;
  position:relative;
  z-index:2;
  animation: textShadowRotate 5s infinite linear;
    
  
}
    @keyframes textShadowRotate {
      0% {
        text-shadow: 5px 5px 20px rgb(255, 100, 100), -5px -5px 10px rgb(0, 255, 0);
      }
      25% {
        text-shadow: 5px -5px 10px rgb(0, 255, 255), -5px 5px 20px rgb(255, 100, 255);
      }
      50% {
        text-shadow: -5px -5px 20px rgb(0, 0, 255), 5px 5px 10px rgb(255, 255, 0);
      }
      75% {
        text-shadow: -5px 5px 10px rgb(255, 0, 255), 5px -5px 20px rgb(0, 255, 255);
      }
      100% {
        text-shadow: 5px 5px 20px rgb(255, 100, 100), -5px -5px 10px rgb(0, 255, 0);
      }
    }
</style>

  
  
</head>

<body translate="no">
  <h1 id="year">2025</h1>
<canvas id="canvas"></canvas>
  
      <script  >

const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let cw = window.innerWidth,ch = window.innerHeight;
let fireworks = [],partic.........完整代码请登录后点击上方下载按钮下载查看

网友评论0