P5.js Test-Run
I played around with P5.js today. It is really nice software! There is an in-browser P5.js editor, so you can start playing around instantaneously.
function setup() {
angleMode(RADIANS); // Change the mode to RADIANS
createCanvas(200, 130);
}
function draw() {
background(256);
v1 = [1,0];
v2 = [cos(PI/3),sin(PI/3)];
n=0;
m=0;
while (n <= 5){
while (m <= 5){
p = [20+(20*v1[0]*n)+(20*v2[0]*m), 20+(20*v1[1]*n)+(20*v2[1]*m)]
if ( (n*m) % 2 == 0){
circle(p[0],p[1],20);
fill(200, 0, 0);
} else {
circle(p[0],p[1],20);
fill(0, 0, 200);
}
m += 1;
}
m = 0;
n += 1;
}
}
leave a comment