moving Tessellate towards more of a library structure
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user