xxxxxxxxxx
90
function setup() {
createCanvas(400, 400);
}
function draw() {
background(255);
//one();
// two();
three();
}
function one() {
for (var i = 0; i < width; i+= 50) {
for (var j = 0; j < height; j+= 50) {
stroke(200);
line(i, j, i+50, j+50);
line(i+50, j, i, j+50);
}
if (i % 100 == 0) {
stroke(0);
} else {
stroke(200);
}
line(0, i, width, i);
line(i, 0, i, height);
}
}
function two() {
hufflepuff(0, height, 20);
ravenclaw(0, height, 20);
gryffindor(0, width, 0, height, 20);
slytherin(0, width, 0, height, 20);
}
function three() {
hufflepuff(0, 200, 10);
hufflepuff(200, 400, 10);
gryffindor(200, 400, 0, 200, 10);
gryffindor(0, 200, 200, 400, 10);
slytherin(200, 400, 0, 200, 10);
slytherin(0, 200, 200, 400, 10);
ravenclaw(200,400, 10);
ravenclaw(0,200, 10);
}
function hufflepuff(start, end, spacing) {
stroke(255,255,0);
for (var i = 0; i < 20; i ++) {
//stroke(i);
line(start+(i*spacing), start, start, end-(i*spacing));
}
}
function ravenclaw(start, end, spacing) {
stroke(0, 0, 255);
for (var i = 0; i < 20; i ++) {
line(start+ (i*spacing), end, end, end-(i*spacing));
}
}
function gryffindor(xstart, xend, ystart, yend, spacing) {
stroke(255,0,0);
for (var i = 0; i < 20; i ++) {
line(xstart, ystart+(i*spacing), xstart+(i*spacing), yend);
}
}
function slytherin(xstart, xend, ystart, yend, spacing) {
stroke(0, 255, 0);
for (var i = 0; i < 20; i ++) {
line(xstart+ (i*spacing), ystart, xend, ystart+(i*spacing));
}
}