79 lines
2.4 KiB
JavaScript
79 lines
2.4 KiB
JavaScript
/**
|
|
* R3.D3.API.Animation
|
|
* @param apiComponent
|
|
*
|
|
* @property rotationSpeed
|
|
* @property translationSpeed
|
|
* @property scaleSpeed
|
|
* @property rotationFn
|
|
* @property translationFn
|
|
* @property scaleFn
|
|
* @property blocking
|
|
* @property applyToMeshWhenDone
|
|
* @property functionType
|
|
*
|
|
* @constructor
|
|
*/
|
|
R3.D3.API.Animation = function(
|
|
apiComponent,
|
|
) {
|
|
|
|
__API_COMPONENT__;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.rotationSpeed)) {
|
|
apiComponent.rotationSpeed = 0;
|
|
}
|
|
this.rotationSpeed = apiComponent.rotationSpeed;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.translationSpeed)) {
|
|
apiComponent.translationSpeed = 0;
|
|
}
|
|
this.translationSpeed = apiComponent.translationSpeed;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.scaleSpeed)) {
|
|
apiComponent.scaleSpeed = 0;
|
|
}
|
|
this.scaleSpeed = apiComponent.scaleSpeed;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.rotationFn)) {
|
|
apiComponent.rotationFn = null;
|
|
}
|
|
this.rotationFn = apiComponent.rotationFn;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.translationFn)) {
|
|
apiComponent.translationFn = null;
|
|
}
|
|
this.translationFn = apiComponent.translationFn;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.scaleFn)) {
|
|
apiComponent.scaleFn = null;
|
|
}
|
|
this.scaleFn = apiComponent.scaleFn;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.blocking)) {
|
|
apiComponent.blocking = {
|
|
position : false, //positions can be blocked from accumulating and executing at once
|
|
rotation : true, //rotations need to execute in order
|
|
scale : false //scale can accumulate
|
|
};
|
|
}
|
|
this.blocking = apiComponent.blocking;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.applyToMeshWhenDone)) {
|
|
apiComponent.applyToMeshWhenDone = true;
|
|
}
|
|
this.applyToMeshWhenDone = apiComponent.applyToMeshWhenDone;
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiComponent.functionType)) {
|
|
apiComponent.functionType = R3.D3.API.Animation.ANIMATION_FUNCTION_TYPE_ROTATION;
|
|
}
|
|
this.functionType = apiComponent.functionType;
|
|
|
|
};
|
|
|
|
R3.D3.API.Animation.prototype = Object.create(R3.API.Component.prototype);
|
|
R3.D3.API.Animation.prototype.constructor = R3.D3.API.Animation;
|
|
|
|
R3.D3.API.Animation.ANIMATION_FUNCTION_TYPE_ROTATION = 1;
|
|
R3.D3.API.Animation.ANIMATION_FUNCTION_TYPE_TRANSLATION = 2;
|
|
R3.D3.API.Animation.ANIMATION_FUNCTION_TYPE_SCALE = 3; |