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;
|
var i;
|
||||||
|
|
||||||
this.updateInformation = [];
|
this.updateInformation = [];
|
||||||
|
|
||||||
for (i = 0; i < this.offsetAttribute.count; i++) {
|
for (i = 0; i < this.offsetAttribute.count; i++) {
|
||||||
|
|
||||||
this.updateInformation.push(
|
this.updateInformation.push(
|
||||||
{
|
{
|
||||||
offset : {
|
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);
|
}.bind(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the next animation
|
* Load the next animation
|
||||||
*/
|
*/
|
||||||
GameLib.CustomCode.prototype.loadNext = function() {
|
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);
|
this.currentIndex++
|
||||||
|
|
||||||
/**
|
if (this.currentIndex > this.maxIndex) {
|
||||||
* Notify our render component that we are ready to start animating
|
this.currentIndex = 0;
|
||||||
*/
|
}
|
||||||
this.beforeRender.startAnimation = true;
|
|
||||||
|
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);
|
}.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.buildInstancedGeometry(0);
|
||||||
|
|
||||||
this.beforeRender.entityLoaded = this;
|
this.beforeRender.entityLoaded = this;
|
||||||
|
|
Loading…
Reference in New Issue