A P5js experiment. I begin to “translate” AS3 experiments into P5js sketch, from the book Flash Math Creativity edited by friendsofed. This first experiments is based on Glen Rhodes’s Flowers. There is no interaction in this sketch.
function setup() {
createCanvas(900, 900);
angleMode(DEGREES);
colorMode(RGB);
background(255);
}
function draw() {
let from = color(237, 189, 45, 200);
let to = color(247, 227, 128, 20);
translate(width / 2, height / 2);
//Draw flower
for (var i = 0; i < 120; i++) {
push();
flower_color = lerpColor(from, to, i / 120);
rotate((1440 * i) / 120);
translate(2 * i / 2, 2 * i / 2);
noStroke();
fill(flower_color);
scale(i / 120 + 2);
ellipse(0, 0, 30, 120);
pop();
}
}