//Anna Anderson
//Section D
//aranders@andrew.cmu.edu
//project-07
var nPoints = 100;
function setup() {
createCanvas(400, 400);
frameRate(10);
}
function draw() {
background(250, 250, 200);
textSize(25);
text("GOOD", width / 2 - 38, 40);
text("LUCK", width / 2 - 33, 380);
push();
noStroke();
translate(width / 2, height / 2);
drawquadrifolium();
pop();
}
function drawquadrifolium() {
var x;
var y;
var r;
var a = constrain(mouseX, 5, 230);
fill(0, 153, 51);
beginShape();
for (var i = 0; i < nPoints; i++) {
var t = map(i, 0, nPoints, 0, TWO_PI);
r = a * sin(2 * t);
x = r * cos(t);
y = r * sin(t);
vertex(x, y);
}
endShape(CLOSE);
}
I made this shape called a quadrifolium. I found it on the website which was given to us to look at curves. I knew what I wanted to do right when I saw it. It took me a while to get the hang of the different variables within the equation, but I ended up liking the project. The image is inspired by a four leaf clover for good luck. I could use some of that for the rest of this semester. Actually, for the rest of my life.