three+gsap实现带音乐三维爱心表白动画效果代码

代码语言:html

所属分类:表白

代码描述:three+gsap实现带音乐webgl三维爱心表白动画效果代码,点击爱心播放音乐动画开始。

代码标签: three webgl gsap

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

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

<head>

  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1">

  
  
  
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  overflow: hidden;
  background: #16000a;
}
body {
  -webkit-font-smoothing: antialiased;
  color: #ffdada;
}
.webgl {
  position: fixed;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  outline: none;
}

body::before {
  content: "";
  position: absolute;
  border: 8px solid;
  inset: 1rem;
  z-index: 100;
  pointer-events: none;
}

h1 {
  position: absolute;
  top: 10vh;
  left: 2.5rem;
  right: 1rem;
  text-align: center;
  font-family: ador-hairline, sans-serif;
  font-weight: 900;
  font-size: max(1rem, 3vh);
}

button {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  height: 12vh;
  width: 12vh;
  transform: translateY(2vh);
  right: 0;
  margin: auto;
  -webkit-appearance: none;
  background: transparent;
  color: inherit;
  border: none;
  cursor: pointer;
}

svg {
  width: 3.5vh;
}
</style>



</head>

<body >
  <canvas class="webgl"></canvas>
<h1>
  With Love
</h1>
<button id="play-music" type="button" aria-label="Play music"><svg fill="currentColor" viewBox="0 0 512 512" width="100" title="music">
    <path d="M470.38 1.51L150.41 96A32 32 0 0 0 128 126.51v261.41A139 139 0 0 0 96 384c-53 0-96 28.66-96 64s43 64 96 64 96-28.66 96-64V214.32l256-75v184.61a138.4 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0