xxxxxxxxxx
53
class MyApp {
constructor(width, height) {
this.objects = [];
this.width = width;
this.height = height;
this.cx = width / 2;
this.cy = height / 2;
}
//setScale(scale) {
// this.scale = scale;
//}
addObject(obj) {
this.objects.push(obj);
}
draw() {
for (var i = 0; i < this.objects.length; ++i) {
//var obj = this.objects[i];
//var x = obj.x * this.scale;
//var y = obj.y * this.scale;
//var r = obj.r * this.scale;
//stroke(obj.color.r, obj.color.g, obj.color.b);
//fill(obj.color.r, obj.color.g, obj.color.b);
//circle(this.cx + x, this.cy + y, r);
//
//textFont('Helvetica');
//strokeWeight(1);
//stroke(255, 255, 255);
//fill(255, 255, 255);
//textSize(15);
//text(obj.text, this.cx + x - 20, this.cy + y - 15);
}
}
}
var CanvasWidth = 1200;
var CanvasHeight = 750;
//var MaxInvScale = 1000000;
//var MinInvScale = 1;
let myapp = new MyApp(CanvasWidth, CanvasHeight);
//let slider;
function setup() {
createCanvas(CanvasWidth, CanvasHeight);
}
function draw() {
background(220);
myapp.draw();
}