canvas实现webgl跟随鼠标可调节参数的小鬼交互效果代码
代码语言:html
所属分类:动画
代码描述:canvas实现webgl跟随鼠标可调节参数的小鬼交互效果代码
代码标签: canvas webgl 跟随 鼠标 调节 参数 小鬼 交互
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body, html {
margin: 0;
padding: 0;
overflow: hidden;
background-color: #2C3E50;
}
canvas#ghost {
position: fixed;
top: 0;
left: 0;
display: block;
width: 100%;
z-index: 10000;
pointer-events: none;
}
.page {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: white;
text-align: center;
font-size: 4vw;
text-shadow: 0 0 5px #000000;
}
.lil-gui {
--width: 300px;
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, .8);
--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 >
<div class="page">
WebGL Ghost Cursor
</div>
<canvas id="ghost"></canvas>
<script type="x-shader/x-fragment" id="vertShader">
precision mediump float;
varying vec2 vUv;
attribute vec2 a_position;
void main() {
vUv = .5 * (a.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0