gyueunp – Project-07: Composition with Curves

Composition with Curves

//GyuEun Park
//15-104 E
//gyueunp@andrew.cmu.edu
//Project-07

//define rose curves by r = cos kθ 
var k = 7/4;

function setup() {
    createCanvas(440, 440);
    frameRate(1000);
}

function draw() {
	background(70);
	
	//change the origin to the center of canvas
	translate(width/2, height/2);

	beginShape();

	stroke(124, 9, 21);
	fill(124, 9, 21, 150);
	strokeWeight(2);
	
	for (var a = 0; a < TWO_PI * 8; a += 0.01){
		var r = map(mouseX, 0, (70 * cos(k * a)), mouseY, (200 * cos(k * a)));
		var x = r * cos(a);
		var y = r * sin(a);
		vertex(x,y);
	}

	for (var b = 0; b < TWO_PI * 4; b += 0.01){
		var r2 = map(mouseX, 0, (40 * cos(k * b)), mouseY, (20 * cos(k * b)));
		var x2 = r2 * cos(b);
		var y2 = r2 * sin(b);
		vertex(x2,y2);
	}

	endShape(CLOSE);
}

I used a rhodonea/rose curve to create a composition that bears a resemblance to a petalled flower. As seen in the code, I used one of the curves defined by , with the value 7 as the numerator and 4 as the denominator in defining k as n/d.

However, the addition of the interactive quality using mouseX and mouseY led to forms that are more fascinating and intricate than the stagnant rose. I’m glad that the project requirement pushed me to enable a broader range of possible compositions.

Screenshots :

Leave a Reply