# Project: Curve with Composition

``````//lucacao
//section D

var np = 200;

function setup() {
createCanvas(480, 480);
}

function draw() {
background(127, 222, 255);
stroke(229, 116, 188);
fill(229, 116, 188);

push();
translate(120,120);
drawEightCurve();
pop();//draw first shape

push();
translate(240,240);
drawEightCurve();
pop();//draw second shape

push();
translate(360,360);
drawEightCurve();
pop();//draw third shape

push();
translate(360,120);
drawEightCurve();
pop();//draw fourth shape

push();
translate(120,360);
drawEightCurve();
pop();//draw fifth shape

}

function drawEightCurve(){
var x;
var y;
var t;
var a = mouseX/2;

beginShape();
for (var i = 0; i < np; i++){
var t = map(i,0,np,0,TWO_PI);
x = a*(sin(t*5));//x parametric
y = a*(sin(t*5))*cos(t*5);//y parametric
vertex(x,y);//draw shape
}
endShape();

}
``````

I found this project quite challenging because it requires an understanding of parametric functions, which I am not too familiar with. I watched some Khan Academy and learned the general features of the functions. I wanted to make my shapes change in size, so I used “mouseX” to control that. The function that I chose also creates a dynamic composition. Most of my process was actually changing around the variables and see what it does to the shapes. Overall, I am happy with the outcome.