mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixed movieclip speed/fps bug. fixes #35
This commit is contained in:
parent
5caa21f453
commit
93680e3286
9 changed files with 60 additions and 29 deletions
|
|
@ -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()
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
22
app/Lib/Utilities/Channel/Extensions.js
Normal file
22
app/Lib/Utilities/Channel/Extensions.js
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
9
app/Lib/Utilities/Client/Extensions.js
Normal file
9
app/Lib/Utilities/Client/Extensions.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
define([
|
||||
"Lib/Utilities/Core/Extensions",
|
||||
"Lib/Vendor/Pixi"
|
||||
],
|
||||
|
||||
function (Parent, PIXI) {
|
||||
|
||||
"use strict";
|
||||
});
|
||||
12
app/Lib/Utilities/Core/Extensions.js
Executable file
12
app/Lib/Utilities/Core/Extensions.js
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
define([
|
||||
],
|
||||
|
||||
function () {
|
||||
|
||||
"use strict";
|
||||
|
||||
String.prototype.toUpperCaseFirstChar = function () {
|
||||
var f = this.charAt(0).toUpperCase();
|
||||
return f + this.substr(1);
|
||||
}
|
||||
});
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -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 = {};
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue