54 lines
1.0 KiB
JavaScript
54 lines
1.0 KiB
JavaScript
if (!this.entityLoaded) {
|
|
return;
|
|
}
|
|
|
|
if (!this.initialized) {
|
|
|
|
this.animationSystem = this.entityLoaded.animationSystem;
|
|
|
|
this.cylinder = this.entityLoaded.cylinder;
|
|
|
|
this.initialized = true;
|
|
}
|
|
|
|
this.animationSystem.start();
|
|
|
|
var currentRotation = this.cylinder.rotation.x;
|
|
|
|
var remainder = currentRotation % 0.4488;
|
|
|
|
var integer = Math.floor(currentRotation);
|
|
|
|
var result = remainder * 0.4488;
|
|
|
|
console.log('current rotation: ' + currentRotation + ' remainder : ' + remainder + ' integer : ' + integer + ' result: ' + result);
|
|
|
|
if (remainder > (0.4488 / 2)) {
|
|
this.cylinder.rotation.x += remainder;
|
|
} else {
|
|
this.cylinder.rotation.x -= 0.4488 - remainder;
|
|
}
|
|
|
|
|
|
|
|
|
|
//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
|