webgl实现声音驱动shader可视化动画效果代码
代码语言:html
所属分类:动画
代码描述:webgl实现声音驱动shader可视化动画效果代码
代码标签: webgl 声音 驱动 shader 可视化 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
padding: 0;
background: black;
font-family: "Press Start 2P", monospace;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
#container {
position: relative;
width: 100vw;
height: 100vh;
}
#canvas {
width: 100%;
height: 100%;
display: block;
}
#controls {
position: absolute;
top: 20px;
left: 20px;
z-index: 100;
display: flex;
gap: 10px;
flex-direction: column;
}
#playButton,
#titleDisplay,
#creditsButton {
padding: 15px 30px;
font-size: 12px;
font-family: "Press Start 2P", monospace;
background: rgba(255, 255, 255, 0.1);
color: white;
border: 2px solid rgba(255, 255, 255, 0.3);
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
}
#playButton:hover {
background: rgba(255, 255, 255, 0.2);
border-color: rgba(255, 255, 255, 0.5);
transform: scale(1.05);
}
#playButton:active {
transform: scale(0.95);
}
#playButton.playing {
background: rgba(255, 100, 100, 0.2);
border-color: rgba(255, 100, 100, 0.5);
}
#titleDisplay {
position: absolute;
top: 20px;
right: 20px;
cursor: default;
pointer-events: none;
transition: none;
transform: none;
}
#info {
color: rgba(255, 255, 255, 0.7);
font-size: 8px;
max-width: 250px;
line-height: 1.4;
margin-left: 15px;
}
#loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
font-size: 12px;
text-align: center;
z-index: 200;
}
#creditsButton {
position: absolute;
bottom: 20px;
right: 20px;
cursor: default;
pointer-events: none;
transition: none;
transform: none;
font-size: 10px;
padding: 10px 20px;
}
#myWorkButton {
position: absolute;
bottom: 20px;
left: 20px;
padding: 10px 20px;
font-size: 10px;
font-family: "Press Start 2P", monospace;
background: rgba(255, 255, 255, 0.1);
color: white;
border: 2px solid rgba(255, 255, 255, 0.3);
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
text-decoration: none;
display: inline-block;
z-index: 100;
}
#myWorkButton:hover {
background: rgba(255, 255, 255, 0.2);
border-color: rgba(255, 255, 255, 0.5);
transform: scale(1.05);
}
#myWorkButton:active {
transform: scale(0.95);
}
.hidden {
display: none;
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
</head>
<body translate="no">
<div id="container">
<canvas id="canvas"></canvas>
<div id="controls">
<button id="playButton">▶ START EXPERIENCE</button>
<div id="info">
Click to start the synchronized audio-visual experience.
<br><br>
5 visual presets that change automatically with the music.
</div>
</div>
<div id="loading" class="hidden">
Loading audio...
</div>
<div id="titleDisplay">CHROMATIC PULSE EXPERIENCE</div>
</div>
<audio id="audio" crossorigin="anonymous&qu.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0