moving Tessellate towards more of a library structure

This commit is contained in:
Gavin McDonald
2016-02-19 12:46:31 -05:00
parent ccd9cdb111
commit 63af7b6db8
8 changed files with 126 additions and 97 deletions

View File

@@ -1,7 +1,7 @@
export default class Sketch {
constructor(settings) {
this.lastTime = null;
this.lastNow = null;
['getContext', 'onResize', 'render'].map(method => this[method] = this[method].bind(this));
@@ -28,9 +28,12 @@ export default class Sketch {
}
render(now) {
this.draw(this.context, now, this.lastTime);
this.context.now = now;
this.context.lastNow = this.lastNow;
this.lastTime = now;
this.draw(this.context);
this.lastNow = now;
requestAnimationFrame(this.render);
}
}