admin 管理员组文章数量: 1184232
2024年2月24日发(作者:php遍历)
(SCENE, CAMERA);}// lightsfunction createLights() {var hemisphereLight = new hereLight(0xffffff);(hemisphereLight);}function init() {e(WIDTH, HEIGHT);mentById('space').appendChild(ment);// camera//(-500, 500, 0); //scene1//(new 3(500, 0, 0));//(-300, 200, 0); //scene2//(new 3(100, 0, 0));//(600, 1500, 0); //scene3//(new 3(601, 0, 0));(-700, 700, 300);(new 3(0, 0, 0));createLights();niumFalcon = new 3D();(createBody());(createRescueCapsules());(createCenterCylinder());(createBackCylinders());(createFronts());(createCockpit());(createUndercarriages());(createParable());(millenniumFalcon);ext = new 3D();(createText());(crawlText);// move the Falcon to mouse coords
emove = handleMouseMove;// k = handleClick;// p = handleKeyup;loop();}init();//__________________________________// textfunction createText() {var crawlText = mentById('crawl-text').(' ');h(function(word) {(word);});var textGeo = new ometry('text', {size: 70,height: 20,//curveSegments: 4,font: 'franklin gothic book',//bevelThickness: 2,//bevelSize: 1.5,bevelEnabled: true,material: 0,//extrudeMaterial: 1});var textMesh = new (textGeo, primaryMat);//smoother eVertexNormals();//center eBoundingBox();var centerOffset = -(.x - .x) / 2;on.z = centerOffset;on.z = -PI / 2;
on.x = -PI / 2;return textMesh;}function refreshText() {(textMesh);createText();}//__________________________________// behaviourvar isLooping = false;var horizontalCenter = WIDTH / 2;var verticalCenter = HEIGHT / 2;var mouseX, mouseY;function handleKeyup(e) {if (e == 32) {shoot();}}function handleClick(e) {shoot();//loopityLoop(e);}function handleMouseMove(e) {mouseX = ;mouseY = ;/*switch(scene) {case 1:mouseFar();break;case 2:mouseClose();break;case 3:
mouseMiddle();break;}*/mouseFar();//mouseClose();}function mouseFar() {var speed = 1;var posZ = (mouseX - horizontalCenter) / 1.5;(on, speed, {z: posZ});var posX = -(mouseY - verticalCenter) / verticalCenter * 50;(on, speed, {x: posX});}function mouseClose() {var speed = 1;/** x = cos(phi) * h* <=> x / h = cos(phi)* <=> phi = arccos(x / h)* y = h - sin(phi) * h* <=> y = h * (1 - sin(arccos(x / h)))*/var posZ = (mouseX - horizontalCenter) / 3.5;var posY = horizontalCenter * (1 - (((posZ) / horizontalCenter)));(on, speed, {z: posZ,y: posY});var mAngle = PI / 8;
var mXrotation = -posZ / horizontalCenter * 3.5 * PI / 3;if (!isLooping) {(on, speed, {x: mXrotation});}var posX = -(mouseY - verticalCenter) / verticalCenter * 50;(on, speed, {x: posX});}function setAcceleration() {var speed = 0.5;var posZ = (mouseX - horizontalCenter) / 1.5;var maxAngle = PI / 3;var mXrotation = (posZ - on.z) / horizontalCenter * maxAngle * 2;if (!isLooping) {(on, speed, {x: mXrotation});}}function shoot() {var speed = 0.5;var blasts = new 3D();var blastTop = new 3D();var blastTopPos = new 3().setFromMatrixPosition(World);var blastWidth = 25;var blastCenter = new (new erGeometry(.5, .5, blastWidth, 16),new mbertMaterial({color: 0xffffff})
);var blastHalo = new (new erGeometry(1.6, 1.6, blastWidth + 4, 16),haloMaterial(0xff0000));(blastCenter);(blastHalo);on.z = -PI / 2;on.x = blastTopPos.x + blastWidth / 2 + 20;on.y = blastTopPos.y + 3;on.z = blastTopPos.z;(blastTop);var blastBottomPos = new 3().setFromMatrixPosition(World);var blastBottom = ();on.z = -PI / 2;on.x = blastBottomPos.x + blastWidth / 2 + 20;on.y = blastBottomPos.y - 3;on.z = blastBottomPos.z;(blastBottom);(blasts);(on, speed, {x: 1000,ease: ,onComplete: function() {(blasts)}});}function loopityLoop(e) {if (!isLooping) {isLooping = true;var originalXrotation = on.x;var speed = 2;
var mXrotation = originalXrotation;if ( <= horizontalCenter) {mXrotation -= 2 * PI;} else {mXrotation += 2 * PI;}(on, speed, {x: mXrotation,ease: t,onComplete: function() {on.x = originalXrotationisLooping = false}});}}
版权声明:本文标题:html5星际特效,HTML5Three.js星际大战开场射击三维动画 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/b/1708777436a531213.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论