xxxxxxxxxx
var template;
var minLen = 5;
var numRect = 38;
var strokeOverLen = 0.02;
var tiltAngle = 5;
var speed = 0.1;
function preload(){
template = loadImage("projectortemplate_rsvp.png");
}
function setup() {
createCanvas(1920/2, 1080/2);
background(255);
rectMode(CENTER);
angleMode(DEGREES);
imageMode(CENTER);
template.resize(1920/2, 1080/2);
}
function draw() {
background(255);
fill(255);
stroke(0);
for (i=0; i<=numRect; i++){
push();
translate(width/2, height/2);
if (i%2 == 0){
rotate(-tiltAngle*(i+1));
}
else{
rotate(tiltAngle*(i+1));
}
strokeWeight(minLen*(numRect-i)*strokeOverLen);
rect(0, 0, minLen*(numRect-i), minLen*(numRect-i));
pop();
}
tiltAngle += speed;
image(template, width/2, height/2);
}