xxxxxxxxxx
31
/*
map animation example
*/
var rot = 0;
var colorB = 0;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
// translate to center of canvas
translate(200, 200);
// textSize(40);
// text(r, 0, 0);
// animate rotation
rotate(rot);
rot += PI * 0.0125;
if (rot > PI * 2) {
rot = 0;
}
colorB = map(rot, 0, PI * 2, 255, 100);
fill(0, 0, colorB);
square(0, 0, 100);
}