this.run(this.dict, this.movieClip, this.canvas);
},
setHeader: function(header) {
- this.frameTick = 1000 / header.framerate;
+ this.frameTick = 1000 / header.framerate;
// this.frameTick = 1000; // for debug
this.movieClip.totalframes = header.framecount;
- var canvas_width = this.canvas.width;
- var factorX = this.canvas.canvas.width / (header.framesize.xmax / 20);
- var factorY = this.canvas.canvas.height / (header.framesize.ymax / 20);
+ var canvas_width = this.canvas.width;
+ var factorX = this.canvas.canvas.width / (header.framesize.xmax / 20);
+ var factorY = this.canvas.canvas.height / (header.framesize.ymax / 20);
if (factorX < factorY) {
this.matrix[0] *= factorX;
this.matrix[3] *= factorX;
}
this.movieClip.absoluteMatrix = null;
this.movieClip.setMatrix(this.matrix);
- if (typeof this.timerId === 'number') {
- clearInterval(this.timerId);
+ if (typeof this.timerId === 'number') {
+ clearInterval(this.timerId);
this.ticks();
- }
+ }
},
setBackground: function(red, green, blue) {
- this.canvas.canvas.style.backgroundColor = 'rgb('+red+','+green+','+blue+')';
+ this.canvas.canvas.style.backgroundColor = 'rgb('+red+','+green+','+blue+')';
},
run: function(dict, movieClip, canvas) {
console.debug("Flapp::run");
this.ticks();
},
ticks: function() {
- var flapp = this;
- var dict = this.dict;
- var movieClip = this.movieClip;
- var canvas = this.canvas;
+ var flapp = this;
+ var dict = this.dict;
+ var movieClip = this.movieClip;
+ var canvas = this.canvas;
console.debug("Flapp::ticks "+movieClip.currentFrame);
this.timerId = setInterval(function() {
if (movieClip.control(dict)) {
- movieClip.action();
- canvas.clear();
- movieClip.render(canvas, dict);
- movieClip.increment();
+ movieClip.action();
+ canvas.clear();
+ movieClip.render(canvas, dict);
+ movieClip.increment();
}
- }, flapp.frameTick);
+ }, flapp.frameTick);
}
};