xxxxxxxxxx
44
function setup() {
createCanvas(windowWidth, windowHeight);
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(r,g,b);
noFill();
// posisiton of the rect
translate(width/2, height/2);
// translate(mouseX, mouseY);
for(var i = 0; i < 200; i++)
{
push()
//rotation (100 is the rotation speed)
rotate(sin(frameCount + i ) * 100)
// 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 * 3, 600 -i * 3, 200 - i)
pop()
}
}