xxxxxxxxxx
43
function setup() {
createCanvas(500, 500);
rectMode(CENTER);
angleMode(DEGREES);
}
function draw() {
// changing background color
var r = map(sin(frameCount), -1, 1, 50, 255)
var g = map(cos(frameCount /2), -1, 1, 50, 255)
var b = map(sin(frameCount /9), -1, 1, 50, 255)
background(0);
noFill();
// posisiton of the rect
translate(width/2, height/2);
for(var i = 0; i < 200; i++)
{
push()
//rotation (100 is the rotation speed)
rotate(sin(frameCount * i/10 ) * 50)
// rect stroke colors
// var r = map(sin(frameCount), -1, 1, 50, 255)
// var g = map(cos(frameCount /6), -1, 1, 50, 255)
// var b = map(sin(frameCount /2), -1, 1, 50, 255)
stroke(r,g,b)
rect(0, 0, 600 - i * 4, 600 -i * 7, 200 - i)
pop()
}
}