Added drawing loop, unplugged traditional renderers

This commit is contained in:
juliandescottes
2012-09-08 23:59:44 +02:00
parent e4373ad133
commit 6e7545a1d2
7 changed files with 21 additions and 50 deletions

View File

@ -6,7 +6,8 @@
this.animIndex = 0;
this.fps = parseInt($("#preview-fps")[0].value, 10);
this.deltaTime = 0;
this.previousTime = 0;
var renderingOptions = {
"dpi": dpi
};
@ -25,29 +26,16 @@
$("#preview-fps")[0].addEventListener('change', this.onFPSSliderChange.bind(this));
};
ns.AnimatedPreviewController.prototype.startAnimationTimer = function () {
this.stopAnimationTimer();
this.animationTimer = window.setTimeout(this.refreshAnimatedPreview.bind(this), 1000/this.fps);
};
ns.AnimatedPreviewController.prototype.stopAnimationTimer = function () {
if (this.animationTimer) {
window.clearInterval(this.animationTimer);
this.animationTimer = null;
}
};
ns.AnimatedPreviewController.prototype.onFPSSliderChange = function(evt) {
this.fps = parseInt($("#preview-fps")[0].value, 10);
};
ns.AnimatedPreviewController.prototype.refreshAnimatedPreview = function () {
ns.AnimatedPreviewController.prototype.render = function () {
if (!this.framesheet.hasFrameAtIndex(this.animIndex)) {
this.animIndex = 0;
}
this.renderer.render(this.framesheet.getFrameByIndex(this.animIndex));
this.animIndex++;
this.startAnimationTimer();
};
})();