From e3fbaa69dce64c8e7be135e4f2a3aa69d36131ba Mon Sep 17 00:00:00 2001 From: William Toohey Date: Sat, 25 Jun 2016 22:36:20 +1000 Subject: [PATCH] Fix #18 --- src/js/HuesCanvas.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/js/HuesCanvas.js b/src/js/HuesCanvas.js index 7212f17..4cbde4f 100644 --- a/src/js/HuesCanvas.js +++ b/src/js/HuesCanvas.js @@ -32,6 +32,7 @@ function HuesCanvas(root, audioContext, core) { core.addEventListener("beat", this.beat.bind(this)); core.addEventListener("invert", this.setInvert.bind(this)); core.addEventListener("settingsupdated", this.settingsUpdated.bind(this)); + core.addEventListener("frame", this.animationLoop.bind(this)); this.core = core; this.needsRedraw = false; @@ -92,9 +93,6 @@ function HuesCanvas(root, audioContext, core) { window.addEventListener('resize', this.resize.bind(this)); this.resize(); - - this.animating = true; - requestAnimationFrame(this.animationLoop.bind(this)); } HuesCanvas.prototype.setInvert = function(invert) { @@ -329,9 +327,6 @@ HuesCanvas.prototype.animationLoop = function() { } else if(this.needsRedraw){ this.redraw(); } - if(this.animating) { - requestAnimationFrame(this.animationLoop.bind(this)); - } }; HuesCanvas.prototype.setImage = function(image) { @@ -511,13 +506,6 @@ HuesCanvas.prototype.setSmartAlign = function(align) { this.smartAlign = align == "on"; }; -HuesCanvas.prototype.setAnimating = function(anim) { - if(!this.animating && anim) { - requestAnimationFrame(this.animationLoop); - } - this.animating = anim; -}; - window.HuesCanvas = HuesCanvas; })(window, document); \ No newline at end of file