From 88c530ff1f2c4a55635245642dccf4214ff9ec94 Mon Sep 17 00:00:00 2001 From: Jelmer van der Linde Date: Thu, 31 Aug 2017 18:06:12 +0200 Subject: [PATCH] Remove throttle, and add a little random initialisation so you don't get the synchronized flickering --- index.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 0548320..082d952 100644 --- a/index.html +++ b/index.html @@ -122,6 +122,7 @@ class Sequence { constructor(seq) { + this.offset = Math.random(); this.setSequence(seq); } @@ -148,7 +149,7 @@ if (isNaN(this.duration)) return undefined; - let dt = time % this.duration; + let dt = this.offset + time % this.duration; for (let i = 0; i < this.steps.length; ++i) { if (dt < this.steps[i][1]) @@ -205,9 +206,7 @@ let update = function(t) { draw(t / 1000); - setTimeout(function() { - requestAnimationFrame(update); - }, 50); + requestAnimationFrame(update); }; update(0);