//Mercedes Reys
//Section C
//mreyes@andrew.cmu.edu
//project-06-a
var nPoints = 3000; // points in outer cricel drawing curve
function setup() {
frameRate(.0001)
createCanvas(600, 600);
frameRate(10);// slow down fram rate
}
function draw() {
background(255,200,200);
drawEpitrochoid();//top curve
push();
translate(width / 2, height / 2);
drawEpitrochoid();//middle curve
translate(width / 2, height / 2);// bottom cuve
drawEpitrochoid();
pop();
}
function drawEpitrochoid() {
noStroke()
//variables
var x;
var y;
//noise
var randomness = (mouseX/40)+1; // level of noise is depenant on mouseX
var randomShift = random(0, randomness);
var a = 200.0; // diamater of original cirlce
var b = a /3.0 + randomness/nPoints;// diamater of circles added to original circle
var h = constrain(randomShift/ .3, 0, b);// grow when mouse is moved to the right
var ph = randomShift/30.0; // devide by random to reduce jerky-ness of movement
fill(200, 255, 200,150);
beginShape();
for (var i = 0; i < nPoints; i++) {
var t = map(i, 0, nPoints*random(-randomness, randomness), 0, TWO_PI);// map out nPoints to cirlce and a
//calculate vertex
x = (a + b) * cos(t) - h * cos(ph + t * (a + b) / b);
y = (a + b) * sin(t) - h * sin(ph + t * (a + b) / b);
vertex(x, y);
}
endShape(CLOSE);
push();
}
The epitrochoid curve was the only curve I could manage to understand how to make, so I started off by recreating the curve made in the example. I then wanted to make the curve grow in an more organic way. So I created a noise variable and applied that to the constraint. It wasn’t vary dynamic at that point so I experimented with adding the noise to diffrent variables and this was the result.