js实现2024新年快乐烟花跟随鼠标点击绽放动画效果代码

代码语言:html

所属分类:动画

代码描述:js实现2024新年快乐烟花跟随鼠标点击绽放动画效果代码

代码标签: js 2024 新年快乐 烟花 跟随 鼠标 点击 绽放 动画

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

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

  
  
<style>
@import url("https://fonts.googleapis.com/css?family=Poppins:300,400");

body {
  margin: 0;
  margin-top: -20px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  font-family: "Poppins", sans-serif;
}

.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 15;
  animation: fadeout 11s linear forwards;
}

.loading h2 {
  color: #000;
}

.loading .bar {
  position: relative;
  width: 400px;
  height: 40px;
  background: transparent;
  margin: 0 20px;
  border: 2px solid #000;
  box-sizing: border-box;
}

.loading .bar:after {
  content: "Loading...";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 10px;
  text-align: center;
  line-height: 36px;
  color: #fff;
  font-size: 20px;
  mix-blend-mode: difference;
}

.loading .bar:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  transform-origin: left;
  animation: animate 10s linear forwards;
}

.center {
  position: relative;
  width: 400px;
}

.center div {
  position: relative;
  margin: -30px 0;
  height: 100px;
  z-index: 2;
  transform: skewY(-5deg);
  display: flex;
  justify-content: center;
  align-items: center;
}
.center div:nth-child(2),
.center div:nth-child(4) {
  transform: skewY(14.5deg);
  z-index: 1;
}
.center div:nth-child(4) {
  transform: skewY(25deg);
  transform-origin: left;
  top: -52px;
}

.center div:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
}
.center div:nth-child(1):before,
.center div:nth-child(3):before {
  background: linear-gradient(-160deg, #ff0058, #673ab7);
  transform: scaleX(0);
}

.center div:nth-child(2):before,
.center div:nth-child(4):before {
  background: linear-gradient(-20deg, #ff0058, #673ab7);
  transform: scaleX(0);
}
.center div:nth-child(1):before {
  backface-visibility: hidden;
  animation: animate 1s linear forwards;
  transform-origin: right;
  animation-delay: 12s;
}

.cente.........完整代码请登录后点击上方下载按钮下载查看

网友评论0