webgl实现可调节参数的水泡液体点击拆分交互动画效果代码
代码语言:html
所属分类:动画
代码描述:webgl实现可调节参数的水泡液体点击拆分交互动画效果代码,参数调节使用了lil-gui插件
代码标签: webgl 调节 参数 水泡 液体 点击 拆分 交互 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body, html {
margin: 0;
padding: 0;
overflow: hidden;
}
body {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.btn {
height: 370px;
position: relative;
}
.btn canvas {
display: block;
height: 100%;
}
.btn button {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1;
font-size: 20px;
text-shadow: 0 0 3px #ffffff;
padding: 20px;
background: none;
outline: none;
border: none;
cursor: pointer;
font-weight: bold;
opacity: .9;
}
.btn button:hover {
color: deeppink;
}
.btn button:active {
color: cyan;
}
.lil-gui {
--width: 500px;
max-width: 90%;
--widget-height: 20px;
font-size: 15px;
--input-font-size: 15px;
--padding: 10px;
--spacing: 10px;
--slider-knob-width: 5px;
--background-color: rgba(5, 0, 15, .9);
--widget-color: rgba(255, 255, 255, .3);
--focus-color: rgba(255, 255, 255, .4);
--hover-color: rgba(255, 255, 255, .5);
--font-family: monospace;
z-index: 1;
}
</style>
</head>
<body translate="no">
<div class="btn">
<canvas></canvas>
<button>click me</button>
</div>
<script type="x-shader/x-fragment" id="vertShader">
precision mediump floa.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0