Isabella Hong – Project 11 – Composition

For the composition project this week, I decided to attempt to create an abstract rendering of a rose. To start with, I looked at the properties of Turtle Graphics that we had learned and implemented last week and began my project.

Here is what it looked like throughout the process of creating my “rose petals.”

screen-shot-2016-11-11-at-7-22-57-pm

In the process of creating my rose petals

‘I found that when I was incrementing by numbers larger than one, I was getting the desired density in the center of my graphic, essentially the center of the flower. When I switched my incrementation to i++, I got the exact look I was going for – a heavily filled in center that spiraled outwards to create a beautiful abstract rose.

Here’s the final result:

ijhong-11

// Isabella Hong
// Section A
// ijhong@andrew.cmu.edu
// Project 11 

//angle to turn and reposition by in degrees 
var turnAngle = 110;
//the degree by which the turtle turns by 
var adegree = 120;   

function setup() {
    createCanvas(400, 400);
    //pale yellow background 
    background(250, 255, 200);
    strokeJoin(MITER); 
    strokeCap(PROJECT); 
    var turtle = makeTurtle(width / 2, 265);
    //pink color for rose 
    turtle.setColor(color(255, 174, 188));
     
//loops that will continue to draw the base figure to create the rose
    for (var i = 0; i < 100; i++) { 
      for (var length = 0; length < 200; length += 100) {
        //base figure for the rose 
          //set the line weight 
          turtle.setWeight(2); 
          turtle.forward(length); 
          turtle.right(adegree); 
          turtle.forward(length); 
          turtle.right(adegree); 
          turtle.forward(length); 
          turtle.right(adegree); 
          turtle.forward(length);
          turtle.right(adegree);   
        //push the base figure by turnAngle each time it is drawn
          turtle.penUp(); 
          turtle.forward(i * 2);
          turtle.right(turnAngle); 
          turtle.penDown();   
        }
    }
    //save on computation
    noLoop();  
}

function draw() {   
}

//turtle graphics API 

function turtleLeft(d){this.angle-=d;}function turtleRight(d){this.angle+=d;}
function turtleForward(p){var rad=radians(this.angle);var newx=this.x+cos(rad)*p;
var newy=this.y+sin(rad)*p;this.goto(newx,newy);}function turtleBack(p){
this.forward(-p);}function turtlePenDown(){this.penIsDown=true;}
function turtlePenUp(){this.penIsDown = false;}function turtleGoTo(x,y){
if(this.penIsDown){stroke(this.color);strokeWeight(this.weight);
line(this.x,this.y,x,y);}this.x = x;this.y = y;}function turtleDistTo(x,y){
return sqrt(sq(this.x-x)+sq(this.y-y));}function turtleAngleTo(x,y){
var absAngle=degrees(atan2(y-this.y,x-this.x));
var angle=((absAngle-this.angle)+360)%360.0;return angle;}
function turtleTurnToward(x,y,d){var angle = this.angleTo(x,y);if(angle< 180){
this.angle+=d;}else{this.angle-=d;}}function turtleSetColor(c){this.color=c;}
function turtleSetWeight(w){this.weight=w;}function turtleFace(angle){
this.angle = angle;}function makeTurtle(tx,ty){var turtle={x:tx,y:ty,
angle:0.0,penIsDown:true,color:color(128),weight:1,left:turtleLeft,
right:turtleRight,forward:turtleForward, back:turtleBack,penDown:turtlePenDown,
penUp:turtlePenUp,goto:turtleGoTo, angleto:turtleAngleTo,
turnToward:turtleTurnToward,distanceTo:turtleDistTo, angleTo:turtleAngleTo,
setColor:turtleSetColor, setWeight:turtleSetWeight,face:turtleFace};
return turtle;}


	


	


	


	

Leave a Reply