//Sheenu You
//Section E
//sheenuy@andrew.cmu.edu
//Project 07
var nPoints = 100;
function setup() {
createCanvas(480, 480);
background(0);
}
function draw(){
background(218,205,188)
drawLoopFlower();
}
function drawLoopFlower() {
//SHIFTS SHAPE INTO CENTER OF CANVAS
translate(240,240);
//MULTIPLIES SHAPE
//MATH VARIABLES
for (var o=0; o<80; o++){
var x;
var y;
var a=o*.5+mouseX/5
var b=mouseX/30;
stroke(56+o*1,82-o*1,139-o*1);
noFill();
//STARTS SHAPE
beginShape();
//MATHEMATICAL EQUATION FOR EPIcyCLOID
//x=(a+b)cos(theta)-bcos((a+b)/b*theta)
//y=(a+b)sin(theta)-bsin((a+b)/b*theta)
//ellipse(240,240,a,a)
for (var i =0; i<nPoints; i++){
var t = map(i,0,nPoints,0, TWO_PI);
x=(a+b)*cos(t)-b*cos(((a+b)/b)*t+80)
y=(a+b)*sin(t)-b*sin(((a+b)/b)*t+80)
//x=o*a*((b-1)*cos(t)+cos((b-1)*t))/b
//y=o*a*((b-1)*sin(t)-sin((b-1)*t))/b
vertex(x,y);
}
//END SHAPE
endShape(CLOSE);
}
}
Many curve compositions posted on site inspired me to make this curve. I used a for loop to multiply the number of curves so it can create a much more visually appealing and interesting picture. I also found a color palette I liked and used it in this image. I transformed the common Hypotrochoid curve in the example into a beautiful and much more interesting shape.