xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
}
function draw() {
circle(mouseX, mouseY, 20);
}
// colors
var b_color;
var w_color;
// stroke size
var stW;
//size of squares
var wSquare;
var hSquare;
// starting position of each square
var startX;
var startY;
function setup () {
createCanvas(600,600);
b_color = '#000000';
w_color = '#ffffff';
stW = 1;
// calculate the size of each square
wSquare = 600 / 5;
hSquare = 600 / 5;
// set starting position
startX = 0;
startY = 0;
// set angle mode
angleMode(DEGREES);
}
function draw() {
background(w_color);
//Grid 1
fill(w_color);
//set stroke color and size
stroke (b_color);
strokeWeight (stW);
rect(startX, startY, wSquare, hSquare);
// Grid 2
fill(w_color);
rect(120, startY, wSquare,hSquare);
// Grid 3
fill(w_color);
rect(240, startY, wSquare, hSquare);
// Grid 4
fill(w_color);
rect(360, startY, wSquare, hSquare);
fill(b_color);
triangle(360, 0, 360, 120, 480, 120);
// Grid 5
fill(w_color);
rect(480, startY, wSquare, hSquare);
fill(b_color);
triangle(600, 0, 600, 120, 480, 120);
// Grid 6
fill(w_color);
rect(startX, 120, wSquare, hSquare);
// Grid 7
fill(w_color);
rect(120, 120, wSquare, hSquare);
// Grid 8
fill(w_color);
rect(240,120, wSquare, hSquare)
// Grid 9
fill(b_color);
rect(360,120, wSquare, hSquare)
//draw the arc - bottom-lef black
fill(w_color);
arc(360,240,wSquare*2,hSquare*2, 270, 0);
// Grid 10
fill(b_color);
rect(480,120, wSquare, hSquare)
//draw the arc - bottom-lef black
fill(w_color);
arc(600,240,wSquare*2,hSquare*2, 180, 270);
// Grid 11
fill(w_color);
rect(startX,240, wSquare, hSquare)
// Grid 12
fill(w_color);
rect(120,240, wSquare, hSquare)
// Grid 13
fill(w_color);
rect(240,240, wSquare, hSquare)
// Grid 14
fill(b_color);
rect(360,240, wSquare, hSquare)
//draw the arc - bottom-lef black
fill(w_color);
arc(360,240,wSquare*2,hSquare*2, 0, 90);
// Grid 15
fill(w_color);
rect(480,240, wSquare, hSquare)
// Grid 16
fill(w_color);
rect(startX,360, wSquare, hSquare)
//draw the arc - bottom-lef black
fill(b_color);
arc(120,480,wSquare*2,hSquare*2, 180, 270);
// Grid 17
fill(b_color);
rect(120,360, wSquare, hSquare)
// Grid 18
fill(b_color);
rect(240,360, wSquare, hSquare)
// Grid 19
fill(w_color);
rect(360,360, wSquare, hSquare)
fill(b_color);
triangle(480, 360, 360, 360, 360, 480);
// Grid 20
fill(w_color);
rect(480,360, wSquare, hSquare)
// Grid 21
fill(w_color);
rect(startX,480, wSquare, hSquare)
//draw the arc - bottom-lef black
fill(b_color);
arc(120,480,wSquare*2,hSquare*2, 90, 180);
// Grid 22
fill(b_color);
rect(120,480, wSquare, hSquare)
// Grid 23
fill(w_color);
rect(240,480, wSquare, hSquare)
//draw the arc - bottom-lef black
fill(b_color);
arc(240,480,wSquare*2,hSquare*2, 0, 90);
// Grid 24
fill(b_color);
rect(360,480, wSquare, hSquare)
//draw the arc - bottom-lef black
fill(w_color);
arc(480,480,wSquare*2,hSquare*2, 90, 180);
// Grid 25
fill(w_color);
rect(480,480, wSquare, hSquare)
}