give my poor fan a break
This commit is contained in:
@@ -13,7 +13,6 @@ export default class Sketch {
|
||||
|
||||
this.draw = settings.draw || noop;
|
||||
this.resize = settings.resize || noop;
|
||||
this.drawDelay = settings.drawDelay;
|
||||
this.container = settings.element || document.body;
|
||||
|
||||
window.addEventListener('resize', this.onResize);
|
||||
@@ -69,11 +68,11 @@ export default class Sketch {
|
||||
this.context.now = now;
|
||||
this.context.lastNow = this.lastNow;
|
||||
|
||||
this.draw(this.context);
|
||||
const drawDelay = this.draw(this.context);
|
||||
|
||||
this.lastNow = now;
|
||||
|
||||
if (this.drawDelay) setTimeout(() => requestAnimationFrame(this.render), this.drawDelay);
|
||||
if (drawDelay) setTimeout(() => requestAnimationFrame(this.render), drawDelay);
|
||||
else requestAnimationFrame(this.render);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user