// Jennifer Shin // Section D // jshin1@andrew.cmu.edu // Copyright © Jennifer Shin February 2011 Pittsburgh, PA 15221 All Rights Reserved // Rachel Carr // no one int diameter; void setup( ) { size( 500, 500 ); // You can alter the size and shape of // the window to make your program look better. // It does not have to be square. smooth( ); // initialize any global variables here diameter = 75; } void draw( ) { background ( 106, 75, 247 ); drawInitials ( diameter, diameter, ( ( frameCount + width / 2 ) % ( width + diameter / 2 ) ) - ( diameter + width / 2 ), ( height - diameter ) / 2 ); drawInitials ( diameter, diameter, width - ( ( ( frameCount + ( width / 2 ) ) % ( width + ( diameter / 2 ) ) ) - width / 2), ( height - diameter ) / 2 ); drawInitials ( diameter, diameter, ( width - diameter ) / 2, height - ( ( frameCount + height / 2 ) % ( height + diameter / 2 ) ) - ( height / 2 + diameter / 2 )); drawInitials ( diameter, diameter, ( width - diameter ) / 2,( frameCount + height / 2 ) % ( height + diameter / 2 ) + ( height / 2 - diameter / 2 )); } // Copy and paste your drawInitials( float, float, float, float) function // from homework #4 and define any new functions you need here: void drawInitials ( float wd, float ht, float x, float y ) { noStroke ( ); fill ( 44, 232, 171 ); ellipse ( x + ( .5 * wd ), y + ( .5 * ht ), wd, ht ); fill ( 0, 0, 0 ); noFill ( ); strokeWeight ( .0125 * width ); stroke ( 244, 245, 25 ); beginShape ( ); curveVertex ( x - ( .05 * wd ), y - (.05 * ht ) ); curveVertex ( x + ( .01 * wd ), y + ( .55 * ht ) ); curveVertex ( x + ( .08 * wd ), y + ( .75 * ht ) ); curveVertex ( x + ( .15 * wd ), y + ( .8 * ht ) ); curveVertex ( x + ( .2 * wd ), y + ( .8 * ht ) ); curveVertex ( x + ( .24 * wd ), y + ( .7 * ht ) ); curveVertex ( x + ( .25 * wd ), y + ( .6 * ht ) ); curveVertex ( x + ( .25 * wd ), y + ( .1 * ht ) ); curveVertex ( x + ( .25 * wd ), y + ( .05 * ht ) ); endShape ( ); stroke ( 255, 105, 5 ); beginShape ( ); curveVertex ( x + ( .8 * wd ), y + ( .1 * ht ) ); curveVertex ( x + ( .68 * wd ), y + ( .05 * ht ) ); curveVertex ( x + ( .5 * wd ), y ); curveVertex ( x + ( .3 * wd ), y + ( .1 * ht ) ) ; curveVertex ( x + ( .4 * wd ), y + ( .3 * ht ) ); curveVertex ( x + ( .5 * wd ), y + ( .325 * ht ) ); curveVertex ( x + ( .6 * wd ), y + ( .35 * ht ) ); curveVertex ( x + ( .67 * wd ), y + ( .5 * ht ) ); curveVertex ( x + ( .67 * wd ), y + ( .66 * ht ) ); curveVertex ( x + ( .62 * wd ), y + ( .92 * ht ) ); curveVertex ( x + ( .5 * wd ), y + ht ); curveVertex ( x + ( .37 * wd ), y + ( .96 * ht ) ); curveVertex ( x + ( .3 * wd ), y + ( .8 * ht ) ); curveVertex ( x + ( .275 * wd ), y + ( .63 * ht ) ); curveVertex ( x + ( .26 * wd ), y + ( .6 * ht ) ); endShape ( ); stroke ( 250, 28, 113 ); line ( x + ( .7 * wd ), y + ( .05 * ht ), x + ( .7 * wd ), y + ( .95 * ht ) ); beginShape ( ); curveVertex ( x + ( .95 * wd ), y + ( .17 * ht ) ); curveVertex ( x + ( .9 * wd ), y + ( .22 * ht ) ); curveVertex ( x + ( .86 * wd ), y + ( .3 * ht ) ); curveVertex ( x + ( .77 * wd ), y + ( .4 * ht ) ); curveVertex ( x + ( .7 * wd ), y + ( .45 * ht ) ); curveVertex ( x + ( .65 * wd ), y + ( .45 * ht ) ); endShape ( ); beginShape ( ); curveVertex ( x + ( .65 * wd ), y + ( .45 * ht ) ); curveVertex ( x + ( .7 * wd ), y + ( .45 * ht ) ); curveVertex ( x + ( .77 * wd ), y + ( .47 * ht ) ); curveVertex ( x + ( .82 * wd ), y + ( .52 * ht ) ); curveVertex ( x + ( .87 * wd ), y + ( .61 * ht ) ); curveVertex ( x + ( .92 * wd ), y + ( .75 * ht ) ); curveVertex ( x + ( .95 * wd ), y + ( .8 * ht ) ); endShape ( ); } // Handy dandy tool kit functions to help you debug your code: // This stops the iteration of draw when the user presses the mouse button. void mousePressed( ) { noLoop( ); println("Animation stopped."); } void mouseReleased( ) { loop( ); println("Animation restarted."); } // This restarts the iteration of draw when the user presses any key on the keyboard. //void keyPressed( ) //{ // saveFrame( "HW5.jpg" ); //}