// Matthew Erlebacher
// Section B
// merlebac@andrew.cmu.edu
// Project-07
function setup() {
createCanvas(480, 480);
}
function draw() {
background(125);
var angR = map(mouseX, 0, 6.28318, 0, width);
// Controls the rotation of the points
var stem = map(mouseY, 0, 10, 0, height);
// Determines the amount of stems
push();
translate(width/2, height/2);
beginShape();
for (var ang = 0; ang <= 6.28318; ang += 0.001) {
var radius = 200 * cos(stem * ang);
// Sets the radius
var flowerX = radius * cos(ang);
var flowerY = radius * sin(ang);
// I found the equation from Dan Shiffman and decided to crank it up to 11
// https://www.youtube.com/watch?v=f5QBExMNB1I
strokeWeight(5);
rotate(angR);
point(flowerX, flowerY);
// This creates points which create a flower pattern I used points instead of vertex because vertex looked unappealing
}
endShape(CLOSE);
pop();
}
I am really glad with how this project turned out. At first I was pretty overwhelmed by the code and equations. However, after I watched Dan Shiffman’s video “Coding Challenge #55: Mathematical Rose Patterns” I had a much better understanding of the assignment. I decided that my two aspects of variability would be the amount of stems in the flower, and the rotation. I started out using vertex, but decided to change it to point since it had a much smoother look. I also wanted to make it so that it could rotate as much as possible, and have a massive amount of stems. I opted out of using color because I thought that it gave the image a more simplistic look.