59 lines
1.2 KiB
JavaScript
59 lines
1.2 KiB
JavaScript
|
if (!this.entityLoaded) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (!this.initialized) {
|
||
|
|
||
|
this.animationSystem = this.entityLoaded.animationSystem;
|
||
|
|
||
|
this.cylinder = this.entityLoaded.cylinder;
|
||
|
|
||
|
this.initialized = true;
|
||
|
}
|
||
|
|
||
|
while (this.cylinder.rotation.x < 0) {
|
||
|
this.cylinder.rotation.x += Math.PI * 2;
|
||
|
this.cylinder.updateInstance('rotation');
|
||
|
}
|
||
|
|
||
|
!this.animationSystem.started && this.animationSystem.start();
|
||
|
|
||
|
var currentRotation = this.cylinder.rotation.x;
|
||
|
|
||
|
var number = 0.897597901;
|
||
|
|
||
|
var remainder = currentRotation % number;
|
||
|
|
||
|
var result = number - remainder;
|
||
|
|
||
|
//console.log('current rotation: ' + currentRotation + ' remainder : ' + remainder + ' result: ' + result);
|
||
|
|
||
|
this.cylinder.rotation.x += result - 0.4488;
|
||
|
|
||
|
GameLib.Event.Emit(
|
||
|
GameLib.Event.PLAY_AUDIO,
|
||
|
{
|
||
|
name : 'Audio - Select'
|
||
|
}
|
||
|
);
|
||
|
|
||
|
//var offset = currentRotation / 0.4488;
|
||
|
|
||
|
//var integer = Math.floor(offset);
|
||
|
|
||
|
|
||
|
|
||
|
//if (remainder > 0.5) {
|
||
|
// this.cylinder.rotation.x = (integer + 1) * 0.4488 * 2 - 0.4488;
|
||
|
//} else {
|
||
|
// this.cylinder.rotation.x = (integer) * 0.4488 * 2 - 0.4488;
|
||
|
//}
|
||
|
|
||
|
//console.log('offset:' + offset + ', remainder: ' + remainder);
|
||
|
|
||
|
|
||
|
|
||
|
//console.log('started');
|
||
|
|
||
|
//console.log(data);
|
||
|
//@ sourceURL=SpoonLibMouseUp.js
|