xxxxxxxxxx
53
let greg
let mj
let cuko
function setup() {
cnv = createCanvas(800, 800);
let cx = (windowWidth - cnv.width) / 2;
let cy = (windowHeight - cnv.height) / 2;
cnv.position(cx, cy);
greg= new Grid(0,0,400,2,color(105,138,143),color(127,146,99)) // (x,y,cellsz,total,color1,color0)
mj = new Grid(400,400,100,2*2,color(254,165,83),color(105,138,143))
cuko = new Grid(400,400,100/8,2*4,color(128,28,13),color(2254,165,83))
strokeWeight(4)
stroke(97,187,70)
frameRate(1)
print(greg)
greg.makeGrid()
print(greg.grid)
//frameRate(15)
stroke(0)
}
function draw() {
strokeWeight(8)
greg.makeGrid();
greg.showGrid();
strokeWeight(4)
mj.makeGrid()
mj.showGrid()
strokeWeight(2)
cuko.makeGrid()
cuko.showGrid()
mj.x = random([0,400])
mj.y= random([0,400])
cuko.x = mj.x +random([0,100,200,300])
cuko.y = mj.y +random([0,100,200,300])
}
function keyPressed() {
// this will download the first 25 seconds of the animation!
if (key === "g") {
saveGif("gridingrid.gif", 20);
}
if (key === "s") {
saveCanvas("gridingrid", "jpg");
}
}