html5星际特效,HTML5Three.js星际大战开场射击三维动画

阅读: 评论:0

2024年2月8日发(作者:)

html5星际特效,HTML5Three.js星际大战开场射击三维动画

(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星际大战开场射击三维动画

本文发布于:2024-02-08 19:33:43,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170739202368336.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:开场   射击   三维动画
留言与评论(共有 0 条评论)
   
验证码:
排行榜

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23