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]
|
"run": [104,126]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.lastStep = Date.now();
|
||||||
|
|
||||||
this.animatedMeshesContainer = {
|
this.animatedMeshesContainer = {
|
||||||
withArms: {},
|
withArms: {},
|
||||||
withoutArms: {}
|
withoutArms: {}
|
||||||
|
|
@ -260,12 +262,23 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
|
||||||
|
|
||||||
Doll.prototype.render = function() {
|
Doll.prototype.render = function() {
|
||||||
if(this.actionState) {
|
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,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
this.layerId,
|
this.layerId,
|
||||||
this.animatedMeshes[this.actionState],
|
this.animatedMeshes[this.actionState],
|
||||||
{
|
{
|
||||||
x: this.body.GetPosition().x * Settings.RATIO,
|
x: this.body.GetPosition().x * Settings.RATIO,
|
||||||
y: this.body.GetPosition().y * Settings.RATIO,
|
y: this.body.GetPosition().y * Settings.RATIO,
|
||||||
|
animationSpeed: factor
|
||||||
//rotation: this.body.GetAngle()
|
//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.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.pivot) mesh.pivot = new PIXI.Point(options.pivot.x, options.pivot.y);
|
||||||
if (options.anchor) mesh.anchor = options.anchor;
|
if (options.anchor) mesh.anchor = options.anchor;
|
||||||
|
if (options.animationSpeed) mesh.animationSpeed = options.animationSpeed;
|
||||||
};
|
};
|
||||||
|
|
||||||
Layer.prototype.addFilter = function(mesh, filterName, options) {
|
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({
|
requirejs.config({
|
||||||
nodeRequire: require,
|
nodeRequire: require,
|
||||||
baseUrl: 'app',
|
baseUrl: 'app',
|
||||||
deps: ['Lib/Utilities/Extensions']
|
deps: ['Lib/Utilities/Channel/Extensions']
|
||||||
});
|
});
|
||||||
|
|
||||||
var inspector = {};
|
var inspector = {};
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ var GLOBALS = { context: "Client" };
|
||||||
|
|
||||||
requirejs.config({
|
requirejs.config({
|
||||||
baseUrl: 'app',
|
baseUrl: 'app',
|
||||||
deps: ['Lib/Utilities/Extensions'],
|
deps: ['Lib/Utilities/Client/Extensions'],
|
||||||
waitSeconds: 0,
|
waitSeconds: 0,
|
||||||
paths: {
|
paths: {
|
||||||
screenfull: "/screenfull",
|
screenfull: "/screenfull",
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ var inspector;
|
||||||
requirejs.config({
|
requirejs.config({
|
||||||
nodeRequire: require,
|
nodeRequire: require,
|
||||||
baseUrl: 'app',
|
baseUrl: 'app',
|
||||||
deps: ['Lib/Utilities/Extensions']
|
deps: ['Lib/Utilities/Channel/Extensions']
|
||||||
});
|
});
|
||||||
|
|
||||||
var port = process.argv[2]
|
var port = process.argv[2]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue