three+webgl实现流水涟漪三维动画效果代码
代码语言:html
所属分类:三维
代码描述:three+webgl实现流水涟漪三维动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
overflow: hidden;
background: #001f3f;
}
canvas {
display: block;
}
</style>
</head>
<body>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.123.js"></script>
<script>
let scene, camera, renderer, ocean, material;
let mouse = {
x: 0,
y: 0
};
let clock = new THREE.Clock();
const primeNumbers = [7, 13, 17, 19, 23, 29, 31, 37]; // Cicada prime numbers
init();
animate();
function init() {
// Scene and Camera setup
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(0, 3, 8);
camera.lookAt(0, 0, 0);
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// Ocean Geometry
const geometry = new THREE.PlaneGeometry(10, 10, 300, 300);
// Cicada shader material
material = new THREE.ShaderMaterial({
vertexShader: `
uniform float time;
uniform vec2 mouse;
uniform float cicadaOffse.........完整代码请登录后点击上方下载按钮下载查看
网友评论0