xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
}
function draw() {
//background(255, 5);
noFill();
rectMode(CENTER);
// Outline dunkelrot bis hellrot per Zufall
stroke( random(100, 255), 0, 100);
// Spring zur Position der Maus (x, y)
//translate(mouseX, mouseY);
translate(width/2, height/2);
// Rotiere im Uhrzeigersinn um irgendwas Grad abhängig von der Zeit durch Teiler (Geschwindigkeit)
// klein = schnell
// gross = langsamer
rotate( millis()/1000 );
// Rechteck an 0, 0 und 100, 100 groß
rect(0, 0, 100, 100);
// Spring relativ zur aktuellen Rotation 100 nach rechts
translate(100, 0);
// Rotiere jetzt schneller (kleinerer Teiler) in die andere Richtung (-)
rotate( -millis()/100 );
// Zeichne ein kleineres Rechteck (50 px)
rect(millis()/100, 0, 50, 50);
}