fixed movieclip speed/fps bug. fixes #35

This commit is contained in:
logsol 2015-02-07 15:37:40 +01:00
parent 5caa21f453
commit 93680e3286
9 changed files with 60 additions and 29 deletions

View file

@ -25,6 +25,8 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
"run": [104,126]
}
this.lastStep = Date.now();
this.animatedMeshesContainer = {
withArms: {},
withoutArms: {}
@ -260,12 +262,23 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
Doll.prototype.render = function() {
if(this.actionState) {
var stepLength = (Date.now() - this.lastStep);
this.lastStep = Date.now();
// compare current framerate to wanted and get factor
// (stepLength / 60) * 2
// * 2 to scale to flash fps
var factor = stepLength / 30;
Nc.trigger(Nc.ns.client.view.mesh.update,
this.layerId,
this.animatedMeshes[this.actionState],
{
x: this.body.GetPosition().x * Settings.RATIO,
y: this.body.GetPosition().y * Settings.RATIO,
animationSpeed: factor
//rotation: this.body.GetAngle()
}
);