animation update

beta.r3js.org
-=yb4f310 2018-01-16 11:57:22 +01:00
parent de5e80b80a
commit 9654125674
2 changed files with 46 additions and 17 deletions

View File

@ -97,11 +97,10 @@ GameLib.D3.Animation.prototype.createInstance = function() {
/**
* Updates the instance with the current state
*/
GameLib.D3.Animation.prototype.updateInstance = function() {
GameLib.D3.Animation.prototype.updateInstance = function(property, item) {
try {
if (this.rotationFn) {
if (property === 'rotationFn') {
try {
this.instance.rotation = new Function('data', this.rotationFn).bind(this);
this.publish(
GameLib.Event.ANIMATION_COMPILE_SUCCESS,
@ -110,9 +109,19 @@ GameLib.D3.Animation.prototype.updateInstance = function() {
type : GameLib.D3.Animation.ANIMATION_FUNCTION_TYPE_ROTATION
}
)
} catch (error) {
console.error(error);
this.publish(
GameLib.Event.ANIMATION_COMPILE_FAILED,
{
component : this
}
)
}
}
if (this.translationFn) {
if (property === 'translationFn') {
try {
this.instance.translation = new Function('data', this.translationFn).bind(this);
this.publish(
GameLib.Event.ANIMATION_COMPILE_SUCCESS,
@ -120,10 +129,20 @@ GameLib.D3.Animation.prototype.updateInstance = function() {
component : this,
type : GameLib.D3.Animation.ANIMATION_FUNCTION_TYPE_TRANSLATION
}
);
} catch (error) {
console.error(error);
this.publish(
GameLib.Event.ANIMATION_COMPILE_FAILED,
{
component : this
}
)
}
}
if (this.scaleFn) {
if (property === 'scaleFn') {
try {
this.instance.scale = new Function('data', this.scaleFn).bind(this);
this.publish(
GameLib.Event.ANIMATION_COMPILE_SUCCESS,
@ -132,17 +151,27 @@ GameLib.D3.Animation.prototype.updateInstance = function() {
type : GameLib.D3.Animation.ANIMATION_FUNCTION_TYPE_SCALE
}
)
} catch (error) {
console.error(error);
this.publish(
GameLib.Event.ANIMATION_COMPILE_FAILED,
{
component : this
}
)
}
}
if (property === 'meshes') {
GameLib.Event.Emit(
GameLib.Event.ANIMATION_MESH_ADDED,
{
animation : this,
mesh : item
}
)
}
} catch (error) {
console.error(error);
this.publish(
GameLib.Event.ANIMATION_COMPILE_FAILED,
{
component : this
}
)
}
};
/**

View File

@ -411,7 +411,7 @@ GameLib.System.GUI.prototype.buildQuaternionControl = function(folder, component
GameLib.System.GUI.prototype.buildVectorControl = function(folder, componentTemplate, property) {
var step = 0.01;
var step = 0.00001;
var object = componentTemplate.template;
@ -616,7 +616,7 @@ GameLib.System.GUI.prototype.buildArrayManagerControl = function(
}
);
component.updateInstance(property);
component.updateInstance(property, activeSelection.component);
// addArrayItem(activeSelection.component, component[property].length - 1);
}