xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
background(0);
rectMode(CENTER);
//saveGif('mySketch.gif', 2);
}
function draw() {
background(0, 5);
//clear();
// jump to the center of the sketch
translate(width/2, height/2);
// mapping of sin over time (-1 ... +1) to -200 ... 200
// speed is defined by /1000
let s = map(sin(millis()/1000), -1, 1, -200, 200);
// map(input, von_input, bis_input, von_output, bis_output);
// 0, 180 Grad
// 0, 2*PI Grad
// 0, 255 Deckkraft / Farbe
// mappingf sin over time to an angle 0-PI
let r = random(PI);
let r1 = millis()/1000;
let r2 = map(sin(millis()/1500), -1, 1, 0, PI);
noFill();
stroke(255);
//translate(s, 0);
push();
rotate(r);
rect(0, 0, 200, 200);
pop();
push();
translate(-300, 0);
rotate(r1);
rect(0, 0, 200, 200);
pop();
push();
translate(300, 0);
rotate(r2);
rect(0, 0, 200, 200);
pop();
}