Update: CC - Demo New - Entity Loaded (tuby5lj4di.js) 553 bytes modified
parent
0ace6040c8
commit
a0f221e2d5
|
@ -154,10 +154,10 @@ GameLib.CustomCode.prototype.generateAnimationVectors = function(attributeData)
|
|||
|
||||
var i;
|
||||
|
||||
this.updateInformation = [];
|
||||
|
||||
this.updateInformation = [];
|
||||
|
||||
for (i = 0; i < this.offsetAttribute.count; i++) {
|
||||
|
||||
|
||||
this.updateInformation.push(
|
||||
{
|
||||
offset : {
|
||||
|
@ -186,39 +186,67 @@ GameLib.CustomCode.prototype.generateAnimationVectors = function(attributeData)
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
/**
|
||||
* Performs the actual update to our instanced geometry
|
||||
*/
|
||||
GameLib.CustomCode.prototype.updateAttributeArrays = function(alpha) {
|
||||
console.log('animation : ' + alpha);
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
/**
|
||||
* Load the next animation
|
||||
*/
|
||||
GameLib.CustomCode.prototype.loadNext = function() {
|
||||
|
||||
this.currentIndex++
|
||||
|
||||
if (this.currentIndex > this.maxIndex) {
|
||||
this.currentIndex = 0;
|
||||
};
|
||||
|
||||
var attributeData = this.generateAttributeData(this.currentIndex, 128, 128);
|
||||
|
||||
this.generateAnimationVectors(attributeData);
|
||||
|
||||
/**
|
||||
* Notify our render component that we are ready to start animating
|
||||
*/
|
||||
this.beforeRender.startAnimation = true;
|
||||
|
||||
this.currentIndex++
|
||||
|
||||
if (this.currentIndex > this.maxIndex) {
|
||||
this.currentIndex = 0;
|
||||
}
|
||||
|
||||
var attributeData = this.generateAttributeData(this.currentIndex, 128, 128);
|
||||
|
||||
this.generateAnimationVectors(attributeData);
|
||||
|
||||
/**
|
||||
* Notify our render component that we are ready to start animating
|
||||
*/
|
||||
this.beforeRender.startAnimation = true;
|
||||
|
||||
}.bind(this);
|
||||
|
||||
/**
|
||||
* Performs the actual update to our instanced geometry
|
||||
*/
|
||||
GameLib.CustomCode.prototype.updateAttributeArrays = function(alpha) {
|
||||
|
||||
console.log('animation : ' + alpha);
|
||||
|
||||
var i, offset, scale;
|
||||
|
||||
for (i = 0; i < this.updateInformation.length; i++) {
|
||||
|
||||
offset = this.updateInformation[i].offset;
|
||||
scale = this.updateInformation[i].scale;
|
||||
|
||||
this.offsetAttribute.setXYZ(
|
||||
i,
|
||||
offset.current.lerp(
|
||||
offset.target,
|
||||
alpha
|
||||
)
|
||||
);
|
||||
|
||||
this.scaleAttribute.setXYZ(
|
||||
i,
|
||||
scale.current.lerp(
|
||||
scale.target,
|
||||
alpha
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}.bind(this);
|
||||
|
||||
|
||||
this.buildInstancedGeometry(0);
|
||||
|
||||
this.beforeRender.entityLoaded = this;
|
||||
|
|
Loading…
Reference in New Issue