mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Added drawing loop, unplugged traditional renderers
This commit is contained in:
@ -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();
|
||||
};
|
||||
|
||||
})();
|
Reference in New Issue
Block a user