Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
settings:
scene rotation speed
tires size
jellyfish size
resume
css
settings:
scene rotation speed
tires size
jellyfish size
resume
JavaScript
let mousePos= {x:0, y:0}; HEIGHT = window.innerHeight, WIDTH = window.innerWidth, flag=true; const Pi = Math.PI, scene = new THREE.Scene(), camera = new THREE.PerspectiveCamera(60, WIDTH/HEIGHT, 1, 10000), renderer = new THREE.WebGLRenderer({alpha: true, antialias: true}), container = document.getElementById('ocean'), ambientLight = new THREE.AmbientLight(0x045c7c, .5), hemisphereLight = new THREE.HemisphereLight(0xaaaaaa,0x000000, .9), shadowLight = new THREE.DirectionalLight(0xffffff, .9); const shapes = { //all the variables behind the objects in the scene seabed : { radius: 660, height: 700, rSeg:50, hSeg:20, ampR: 20, speedC: .015, color: 0x531e1e, rotation: .005, x: 0, y: -620, z: -50, step: .000005, }, bottle : { colors : ["orange", "blue","white", "red", "green", "blue",], height: 20, radius: 5, segments: 16, x: 0, y: 150, z: 110, scale: 1, }, can : { colors : ["green", "orange", "black", "red", "brown", "blue",], radius:5, height: 20, segments: 16, }, fish : { radius : 4, height : 15, segments : 12, }, water : { groupNumber : 22, membersNumber : 20, depth: 450, step: .0015, }, tire : { innerR : 8, outerR : 16, rSegments : 8, tSegments : 20, number: 25, step: .003, }, tentacle : { partsNum: 20, partsOffset: 30, firstOff: 10, }, jellyfish : { y : 100, z : 110, minX: -350, maxX: 350, minY: 70, maxY: 450, } }; const settings={ camera: { x:0, y:350, z:600, xRot: -Pi/32, }, oNpause: false, }, params = { jsize:1, speed:1, tsize:1, }; let water, trash, trashHolder, jellyfish, tentacles = [], jellyDisplacementX = 0, jellyDisplacementY = 0, crashSpeedX = 0, crashSpeedY = 0, crash, countTentacles=0; function initScene() { //scene initialisation scene.fog = new THREE.Fog(0x38bbb7, -200,950); camera.position.set(settings.camera.x,settings.camera.y,settings.camera.z); camera.rotation.x=settings.camera.xRot; renderer.setSize(WIDTH, HEIGHT); renderer.shadowMap.enabled = true; container.appendChild(renderer.domElement); window.addEventListener('resize', handleWindowResize, false); } function normalize(v,vmin,vmax,tmin, tmax){ const nv = Math.max(Math.min(v,vmax), vmin); const dv = vmax-vmin; const pc = (nv-vmin)/dv; const dt = tmax-tmin; const tv = tmin + (pc*dt); return tv; } function handleMouseMove(event) { const tx = -1 + (event.clientX / WIDTH)*2; const ty = 1 - (event.clientY / HEIGHT)*2; mousePos = {x:tx, y:ty}; } function handleWindowResize() { HEIGHT = window.innerHeight; WIDTH = window.innerWidth; renderer.setSize(WIDTH, HEIGHT); camera.aspect = WIDTH / HEIGHT; camera.updateProjectionMatrix(); } function initLights() { scene.add(hemisphereLight); scene.add(shadowLight); scene.add(ambientLight); } Seabed = function(rad,h,rS,hS,a,sC,color,xP,yP,zP){ //the seabed is rotated cylinder const geometry = new THREE.CylinderGeometry(rad,rad,h,rS,hS); geometry.applyMatrix(new THREE.Matrix4().makeRotationX(-Pi/2)); geometry.mergeVertices(); const length = geometry.vertices.length; this.bumps = []; //add some bumps for more realism for(let i=0; i
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>塑料海洋-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号