even better sandbox
This commit is contained in:
parent
0580db6c68
commit
668e9a050e
10 changed files with 169 additions and 19 deletions
|
@ -1,3 +1,15 @@
|
|||
export const internals = {
|
||||
body: document.createElement("body"),
|
||||
};
|
||||
|
||||
export function body() {
|
||||
return internals.body;
|
||||
}
|
||||
|
||||
export function addElement(element) {
|
||||
body().appendChild(element);
|
||||
}
|
||||
|
||||
export class Sketch {
|
||||
constructor(width, height) {
|
||||
this.canvas = document.createElement("canvas");
|
||||
|
@ -5,6 +17,6 @@ export class Sketch {
|
|||
this.canvas.height = height;
|
||||
this.ctx = this.canvas.getContext("2d");
|
||||
|
||||
document.body.appendChild(this.canvas);
|
||||
addElement(this.canvas);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue