xxxxxxxxxx
77
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() {
gryffindor(0, height, 20)
hufflepuff(0, height, 20);
slytherin(0, height, 20);
ravenclaw(0, height, 20);
}
function three() {
hufflepuff(0, 200, 10);
hufflepuff(200, 400, 10);
gryffindor(200, 200, 10);
gryffindor(0, 400, 10);
}
function gryffindor(start, end, spacing) {
stroke(255,0,0);
for (var i = 0; i < 200; i += spacing) {
line(start, i, start+i, end);
}
}
function hufflepuff(start, end, spacing) {
stroke(255,255,0);
for (var i = 0; i < 200; i += spacing) {
//stroke(i);
line(start+i, start, start, end-i);
}
}
function slytherin(start, end, spacing) {
stroke(0, 255, 0);
for (var i = start; i < end; i += spacing) {
line(start+ i, start, end, i);
}
}
function ravenclaw(start, end, spacing) {
stroke(0, 0, 255);
for (var i = start; i < end; i += spacing) {
line(start+ i, end, end, end-i);
}
}