原生js+css实现将音频转换为各种波形频谱动画有背景图片的有声视频代码
代码语言:html
所属分类:多媒体
代码描述:原生js+css实现将音频转换为各种波形频谱动画有背景图片的有声视频代码,一句话就是将音频声音转换成动态的视频效果导出下载。
代码标签: 原生 js css 音频 转换 各种 波形 频谱 动画 背景 图片 有声 视频 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>音频可视化视频生成器</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
padding: 30px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
h1 {
text-align: center;
color: #333;
margin-bottom: 30px;
font-size: 2.5em;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.controls {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.control-group {
background: #f8f9fa;
padding: 20px;
border-radius: 10px;
border: 2px solid #e9ecef;
}
.control-group h3 {
margin-bottom: 15px;
color: #495057;
font-size: 1.2em;
}
label {
display: block;
margin-bottom: 5px;
color: #6c757d;
font-weight: 500;
}
input[type="file"],
select,
input[type="color"],
input[type="range"] {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 2px solid #dee2e6;
border-radius: 5px;
background: white;
transition: border-color 0.3s;
}
input[type="file"]:hover,
select:hover {
border-color: #667eea;
}
input[type="range"] {
padding: 5px;
}
.range-value {
text-align: center;
color: #495057;
font-weight: bold;
margin-top: -10px;
margin-bottom: 10px;
}
button {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
padding: 12px 30px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
font-weight: bold;
transition: transform 0.3s, box-shadow 0.3s;
width: 100%;
margin-bottom: 10px;
}
button:hover:not(:disabled) {
transform: translateY(-2px);
box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.canvas-container {
position: relative;
width: 100%;
max-width: 800px;
margin: 0 auto 30px;
background: #000;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
canvas {
width: 100%;
h.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0