74 lines
1.8 KiB
JavaScript
74 lines
1.8 KiB
JavaScript
if (!this.entityLoaded) {
|
|
return;
|
|
}
|
|
|
|
if (!this.initialized) {
|
|
|
|
/**
|
|
* attributeData hols the new attribute data we want to animate to
|
|
*/
|
|
this.startAnimation = false;
|
|
this.animate = false;
|
|
this.attributeData = null;
|
|
|
|
this.camera = this.entityLoaded.camera;
|
|
|
|
this.mouseMove = this.entityLoaded.mouseMove;
|
|
|
|
this.lookAtTarget = this.mouseMove.lookAtTarget;
|
|
|
|
this.meshImageGrid = this.entityLoaded.meshImageGrid;
|
|
|
|
this.update = [];
|
|
|
|
this.time = 0;
|
|
|
|
this.initialized = true;
|
|
}
|
|
|
|
this.time += 0.02 * data.delta;
|
|
|
|
this.lookAtTarget = this.mouseMove.lookAtTarget;
|
|
|
|
if (this.lookAtTarget) {
|
|
|
|
var current = this.meshImageGrid.lookAt.instance;
|
|
|
|
var newLookAt = current.lerp(this.lookAtTarget, 0.1 * data.delta);
|
|
|
|
this.meshImageGrid.instance.lookAt(newLookAt);
|
|
|
|
}
|
|
|
|
if (this.startAnimation) {
|
|
this.time = 0;
|
|
this.animate = true;
|
|
this.startAnimation = false;
|
|
}
|
|
|
|
if (this.animate) {
|
|
if (this.time < 1) {
|
|
this.updateAttributeArrays(this.time);
|
|
} else {
|
|
this.updateAttributeArrays(1);
|
|
this.animate = false;
|
|
}
|
|
}
|
|
|
|
|
|
//this.camera.position.x = 10;Math.sin(this.time) * 4;// * (window.innerWidth - (window.innerWidth / 2));
|
|
//this.camera.position.y = 10;Math.sin(this.time / 2) * 4;//Math.cos(this.time) * (window.innerHeight - (window.innerHeight / 2));
|
|
//this.camera.position.z = 10;-Math.sin(this.time) * 5;//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');
|
|
// }
|
|
|
|
//@ sourceURL=beforeRender.js
|