Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
css
canvas { position:fixed; top:0; left:0; }
JavaScript
class App { constructor() { this.renderer = new THREE.WebGLRenderer({antialias:true}); this.scene = new THREE.Scene(); this.camera = new THREE.PerspectiveCamera(45, innerWidth/innerHeight, 0.1, 100); this.camera.position.set(0,1,-30); document.body.appendChild(this.renderer.domElement); this.renderer.setPixelRatio(window.devicePixelRatio); this.renderer.setSize(innerWidth, innerHeight); this.camera.lookAt(new THREE.Vector3(0,7,0)); this.renderer.setAnimationLoop(e=>this.update(e)); this.scene.background =new THREE.Color( 0x501010); this.scene.background.multiplyScalar(0.5); this.scene.fog = new THREE.FogExp2(0x501010,0.03); var light = new THREE.DirectionalLight(0xfffff0,1.41); light.position.set(1, 10, -5); this.scene.add(light); var light = new THREE.DirectionalLight(0xf0f0ff,0.4); light.position.set(1, -10, -5); this.scene.add(light); this.target = new THREE.Object3D(2); this.scene.add(this.target); var mat = new THREE.MeshStandardMaterial({ color:0xffc050, roughness:0.7, metallness:0, wireframe:false}); this.pivot = this.makeTwister(50, mat); this.scene.add(this.pivot); this.meatballs = []; for(var i =0;i<50;i++) { var meatball = this.makeMeatball(); this.scene.add(meatball); meatball.position.x = Math.random()*30-15; meatball.position.z = Math.random()*40-20; meatball.position.y = Math.random()*50; this.meatballs.push(meatball); } for(var i =0;i<70;i++) { const tree = this.makeTree(); tree.position.x = Math.random()*40-20; tree.position.z = Math.random()*50-10; this.scene.add(tree); } this.lightning = new THREE.PointLight(0xffffff,2); this.scene.add(this.lightning); this.lightning.position.y = 5; for(var i =0;i<20;i++) { var cloud = this.makeMeatball(); this.scene.add(cloud); cloud.scale.setScalar(4+Math.random()*3); cloud.position.x = Math.random()*40-20; cloud.position.z = Math.random()*20-10; cloud.rotation.z = -Math.PI/2; cloud.rotation.y = Math.PI/2; cloud.position.y = 20; } } makeTree() { const pivot = new THREE.Object3D(); let cone = new THREE.Mesh(new THREE.CylinderGeometry(0.01, 1,3,16, true), new THREE.MeshStandardMaterial({ color:0x404040, side:THREE.DoubleSide })); pivot.add(cone); cone = cone.clone(); cone.scale.multiplyScalar(0.8); cone.position.y+=1; pivot.add(cone); cone = cone.clone(); cone.scale.multiplyScalar(0.8); cone.position.y+=1; pivot.add(cone); pivot.position.y=-4; return pivot; } noiseMap(size,low, high) { var c= document.createElement('canvas'); var g = c.getContext('2d'); c.width = c.height = size; var data = g.getImageData(0,0,c.width, c.height); for(var i =0;i
{ ball.position.y-=0.2; ball.rotation.z+=0.1; if(ball.position.y<-7) ball.position.y+=50; }); this.pivot.children.forEach((child,i,a)=>{ var n = a.length; var f = (n-i)/n; f = f*f*f; var ratio = 0.99-f/72; child.position.z = (1-ratio)*this.target.position.z + ratio*child.position.z; child.position.x = (1-ratio)*this.target.position.x + ratio*child.position.x; child.rotation.y+=child.theta/5; }); this.renderer.render(this.scene, this.camera); } } const app = new App();
粒子
时间
文字
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号