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()
}
);

View file

@ -96,6 +96,7 @@ function (Parent, PIXI, ColorRangeReplaceFilter, Settings) {
if (options.visible === true || options.visible === false) mesh.visible = options.visible;
if (options.pivot) mesh.pivot = new PIXI.Point(options.pivot.x, options.pivot.y);
if (options.anchor) mesh.anchor = options.anchor;
if (options.animationSpeed) mesh.animationSpeed = options.animationSpeed;
};
Layer.prototype.addFilter = function(mesh, filterName, options) {