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) {

View file

@ -0,0 +1,22 @@
define([
"Lib/Utilities/Core/Extensions"
],
function (Parent) {
//"use strict";
console.checkpoint = function (s) {
console.log(" \033[32mbeep - \033[0m" + s);
}
console.warn = function (s) {
console.log(" \033[33mwarn - \033[0m" + s);
}
console.error = function (s) {
console.log(" \033[31merror - \033[0m" + s);
}
});

View file

@ -0,0 +1,9 @@
define([
"Lib/Utilities/Core/Extensions",
"Lib/Vendor/Pixi"
],
function (Parent, PIXI) {
"use strict";
});

View file

@ -0,0 +1,12 @@
define([
],
function () {
"use strict";
String.prototype.toUpperCaseFirstChar = function () {
var f = this.charAt(0).toUpperCase();
return f + this.substr(1);
}
});

View file

@ -1,26 +0,0 @@
define([
],
function() {
String.prototype.toUpperCaseFirstChar = function () {
var f = this.charAt(0).toUpperCase();
return f + this.substr(1);
}
if(typeof process !== 'undefined') {
console.checkpoint = function (s) {
console.log(' \033[32mbeep - \033[0m' + s);
}
console.warn = function (s) {
console.log(' \033[33mwarn - \033[0m' + s);
}
console.error = function (s) {
console.log(' \033[31merror - \033[0m' + s);
}
}
});

View file

@ -4,7 +4,7 @@ var requirejs = require('requirejs');
requirejs.config({
nodeRequire: require,
baseUrl: 'app',
deps: ['Lib/Utilities/Extensions']
deps: ['Lib/Utilities/Channel/Extensions']
});
var inspector = {};

View file

@ -4,7 +4,7 @@ var GLOBALS = { context: "Client" };
requirejs.config({
baseUrl: 'app',
deps: ['Lib/Utilities/Extensions'],
deps: ['Lib/Utilities/Client/Extensions'],
waitSeconds: 0,
paths: {
screenfull: "/screenfull",

View file

@ -8,7 +8,7 @@ var inspector;
requirejs.config({
nodeRequire: require,
baseUrl: 'app',
deps: ['Lib/Utilities/Extensions']
deps: ['Lib/Utilities/Channel/Extensions']
});
var port = process.argv[2]