r3-custom-code/98ckiy76lb.js

63 lines
1.9 KiB
JavaScript

if (!this.entityLoaded) {
return;
}
//this.initialized = false;
if (!this.initialized) {
this.camera = this.entityLoaded.camera;
this.camera2d = this.entityLoaded.camera2d;
this.particleEngine = this.entityLoaded.particleEngine;
this.particle = this.entityLoaded.particle;
this.audioDrone = this.entityLoaded.audioDrone;
this.particleEngine.pulse = true;
this.particleEngine.particlesPerSecond = 22;
this.particleEngine.updateInstance('particlesPerSecond');
this.particle.fadeInFactor = 1;
this.time = 0;
this.camera2d.fov = 180;
this.camera2d.updateInstance('fov');
this.camera2dAnimation = true;
this.initialized = true;
}
this.time += 0.1 * data.delta;
this.camera.position.x = Math.sin(this.time) * 40;// * (window.innerWidth - (window.innerWidth / 2));
this.camera.position.y = Math.sin(this.time / 2) * 40;//Math.cos(this.time) * (window.innerHeight - (window.innerHeight / 2));
this.camera.position.z = 150 + Math.sin(this.time) * 50;//Math.sin(this.camera.position.y) * Math.cos(this.camera.position.x);
this.camera.updateInstance('position');
this.camera.lookAt.x = 0;
this.camera.lookAt.y = 0;
this.camera.lookAt.z = 0;
this.camera.updateInstance('lookAt');
if (this.audioDrone.volume < 0.1) {
this.audioDrone.volume += 0.001;
this.audioDrone.updateInstance('volume');
}
if (this.camera2dAnimation) {
this.camera2d.fov -= Math.abs(Math.cos(this.time * 5));
//console.log(this.camera2d.fov);
this.camera2d.updateInstance('fov');
if (this.camera2d.fov < 75) {
this.camera2d.fov = 75;
this.camera2d.updateInstance('fov');
this.camera2dAnimation = false;
this.particleEngine.pulse = false;
this.particleEngine.particlesPerSecond = 8;
this.particleEngine.updateInstance('particlesPerSecond');
this.particle.fadeInFactor = 0.002;
}
}
//console.log('camera x:' + this.camera.position.x + ',y: ' + this.camera.position.y + ',z: ' + this.camera.position.z);
//@ sourceURL=SpoonLibBeforeRender.js