canvas实现可调整参数的水流动画效果代码
代码语言:html
所属分类:动画
代码描述:canvas实现可调整参数的水流动画效果代码
下面为部分代码预览,完整代码请点击下载或在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>Canvas水流动态效果</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box
}
body {
font-family: 'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
background: linear-gradient(135deg,#1a2a6c,#2c3e50);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
color: white;
overflow-x: hidden
}
header {
text-align: center;
padding: 20px 0;
max-width: 800px;
width: 100%
}
h1 {
font-size: 2.8rem;
margin-bottom: 10px;
text-shadow: 0 2px 10px rgba(0,0,0,0.3);
background: linear-gradient(to right,#4facfe,#00f2fe);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent
}
.subtitle {
font-size: 1.2rem;
opacity: .8;
margin-bottom: 20px
}
.container {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 30px;
max-width: 1200px;
width: 100%
}
.canvas-container {
position: relative;
flex: 1;
min-width: 500px;
max-width: 800px;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 10px 30px rgba(0,0,0,0.4);
background: rgba(0,0,0,0.2)
}
canvas {
display: block;
width: 100%;
height: 500px;
cursor: pointer
}
.controls {
flex: 0 0 300px;
background: rgba(255,255,255,0.1);
backdrop-filter: blur(10px);
border-radius: 12px;
padding: 25px;
box-shadow: 0 8px 20px rgba(0,0,0,0.2)
}
.control-group {
margin-bottom: 25px
}
h2 {
font-size: 1.5rem;
margin-bottom: 20px;
color: #4facfe
}
.slider-container {
margin-bottom: 15px
}
label {
display: block;
margin-bottom: 8px;
font-weight: 500
}
input[type="range"] {
width: 100%;
height: 8px;
background: rgba(255,255,255,0.2);
border-radius: 4px;
outline: 0;
-webkit-appearance: none
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 20px;
height: 20px;
background: #00f2fe;
border-radius: 50%;
cursor: pointer;
box-shadow: 0 0 10px rgba(0,242,254,0.5)
}
.value-display {
display: inline-block;
width: 50px;
text-align: right;
font-weight: bold;
color: #00f2fe
}
.instructions {
background: rgba(255,255,255,0.1);
border-left: 4px solid #4facfe;
pad.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0