Working on this was a bit tricky, but once I understood the concepts and structure behind making these shapes, it became easier. The hardest part for me was using the equations from the website and implementing it into my code. I had to browse through a few posts of other students to get a rough idea of what to do. From the start I wanted to do an epicycloid evolute because it looked really appealing and looked similar to a flower.

```
//Seth Henry
//Tuesdays at 10:30
//sehenry@andrew.cmu.edu
//Assignment: Project 7 Composition with Curves (Epicycloid Evolute)
//Global Variables
var nPoints = 400;
var conX;
var scale;
var n=10
function setup() {
createCanvas(400, 400);
}
function draw() {
background(100,50,mouseX); //changes background color based on the mouse position
fill(mouseX,100,mouseY); //changes the epicycloid color based on the mouse position
var a = 150.0 //radius a
var b = 50.0 //radius b
var angle = map(conX,0,width,0,6*TWO_PI); //rotate around the constraint (conX)
conX = constrain(mouseX, 0, width); //constrain around mouseX and mouseY
scaleA = map(conX,0,width,0,3);
push();
translate(width/2,height/2);
rotate(angle); //rotate clockwise
scale(scaleA,scaleA); //change the size of the epicycloid outer portion
beginShape();
//Epicycloid Outer
for (var i=0; i<200; i++){
var theta = map(i,0,nPoints,0, 4*TWO_PI);
x=(a/(a+2*b))*(a+b)*cos(theta)+b*cos(((a+b)/b)*theta); //xpetal of epicycloid
y=(a/(a+2*b))*(a+b)*sin(theta)+b*sin(((a+b)/b)*theta); //ypetal of epicycloid
rect(x-5,y-5,30,30);
}
endShape();
pop();
push();
translate(width/2,height/2);
rotate(-angle); //rotate the opposite way of the outer epicycloid
beginShape();
//No Rotate
//Epicycloid Inner
for (var i=0; i<200; i++){
var theta = map(i,0,nPoints,0, 4*TWO_PI);
x=(a/(a+2*b))*(a+b)*cos(theta)+b*cos(((a+b)/b)*theta); //xpetal of epicycloid
y=(a/(a+2*b))*(a+b)*sin(theta)+b*sin(((a+b)/b)*theta); //ypetal of epicycloid
rect(x-5,y-5,30,30);
}
endShape();
pop();
push();
translate(width/2,height/2);
rotate(angle); //rotate same direction of epicycloid
beginShape(); //The evolute portion of the flower
for (var i=0; i<200; i++){
a=100;
var theta = map(i,0,nPoints,0, 5*TWO_PI);
var petalX = a * (((n-1)*cos(theta)+cos((n-1)*theta))/n) //Xpetal of evolute
var petalY = a * (((n-1)*sin(theta)+sin((n-1)*theta))/n) //ypetal of evolute
rect(petalX-5,petalY-5,30,30); //draws the inside petals
}
endShape();
pop();
}
```