Computational Portrait

At first I really did not know how to start off with my portrait. I looked and reread the timeline for a while until I decided I wanted to do some sort of recreation of Chuck Close’s portraits. Instead of using colors to create skin tone, I ended up sticking with the pixel colors that I got using .get for my images. It took me the longest to set up my photo than to actually get my random walk to work.

Figuring Out pixel size
Playing around with accuracy in pixel size

So to get my work to be more like Close’s I made an array of two different size circles inside my pixels. I thought this looked really cool but I was hoping to get more definition in my features by doing this.

Circles and Squares

So I ended up using my Ipad to make a grid of areas in the face that I wanted to be more or less pixelated. I ended up counting and working from this top image to make sure I was using the right constrains in my for loops. I probably could have shortened my code for this project, but I was happy with how it was so I did not bother.

Figuring out proportions

So, for every new and smaller square I was building I was also making my two circles on the top, unless the pixels got too small. I played around with the numbers a lot here. I felt that my image was very stagnant and decided to use noise to get my circles to vibrate in certain parameters. I thought doing this was quite funny because it reminded my a bit of the saying that the Mona Lisas eyes follow you across the room and, I felt that my entire face was doing the same.

file>

var noiseParam = 0;
var noiseStep = 0.1;
var img;
function preload(){
   img = loadImage("https://i.imgur.com/5n4h1dT.png");
}


function setup() {
    img.resize(img.width/3, img.height/3);//pixel image info
    createCanvas(img.width, img.height * .9);
}
function main(dx,dy){
    for(var col = 0; col < img.width; col += 8){ //main
        for(var row = 0; row < img.height; row += 8){
            var c = img.get(col,row);
            fill(color(c));
            noStroke();
            rect(col,row,8,8);
            ellipse((col + 4) + dx, (row - 4) + dy, 6, 6);
            ellipse((col + 4) + dx, (row - 12) + dy, 3, 3);
        }
    }
}

function face(){
    for(var col = 88; col < 248; col += 6){ //whole face
        for(var row = 120; row < 320 ; row += 6){
            var c = img.get(col, row);
            fill(color(c));
            noStroke();
            rect((col + 1.5), (row + 1.5), 5, 5);
            ellipse((col + 5.5) + dx, (row - 4) + dy, 5, 5);
            ellipse((col + 5.5) + dx, (row - 10) + dy, 2.5, 2.5);
        }
    }
}

function mainFeature(){
    for(var col = 104; col < 230; col += 4){ //clarity for face features == more pixels
        for(var row = 160; row < 216 ; row += 4){
            var c = img.get(col,row);
            fill(color(c));
            noStroke();
            rect((col + 4.5), (row + 4.5), 3, 3);
            ellipse((col + 8.5) + dx , (row - 4) + dy, 2, 2);
            ellipse((col + 8.5) + dx , (row - 6) + dy, 1.5, 1.5);
        } 
    }

    for(var col = 128; col < 186; col += 4){ //cont.
        for(var row = 216; row < 296 ; row += 4){
            var c = img.get(col,row);
            fill(color(c));
            noStroke();
            rect((col + 4.5), (row + 4.5), 3, 3);
            ellipse((col + 8.5) + dx ,(row - 4) + dy, 2, 2);
            ellipse((col + 8.5) + dx , (row - 6) + dy, 1.5, 1.5);

        }
    }
}

function eyes(){
    for(var col = 104; col < 136; col += 2){ //eye area 1: no circle, too small
        for(var row = 184; row < 216 ; row += 2){
            var c = img.get(col,row);
            fill(color(c));
            noStroke();
            rect((col + 6.5), (row + 6.5), 1, 1);
        }
    }
    for(var col = 176; col < 232; col += 2){ //eye area 2: no circle, too small
        for(var row = 184; row < 216 ; row += 2){
            var c = img.get(col, row);
            fill(color(c));
            noStroke();
            rect((col + 6.5), (row + 6.5), 1, 1);
        }
    }
}

function draw() {
    background(0);
    var offset = noise(noiseParam);
    offset = map(offset, 0, 1, -8, 8);
    dx = offset;
    dy = offset;
    main(dx, dy);
    face(dx, dy);
    mainFeature(dx, dy);
    eyes(dx, dy);
    noiseParam += noiseStep;
}

LO: A Focus on Women and Non-binary Practitioners in Computational Art

I looked at the work of Kate Hollenbach for this week’s blog. Hollenbach works professionally as a programmer, artist, and educator. Most of her art projects focused on users’ relationships with digital interfaces and information. I especially admired one of her projects called USER_IS_PRESENT, which uses original software to explore user habits when interacting with their smart devices. The software developed by Hollenback allowed devices to simultaneously record video from the front and back cameras and screen record. The artist later used rendering techniques to layer those recordings together into one channel. The outcome gave viewers a new perspective to look at users and their habits on digital platforms. I think the result is artistic but informative at the same time. By layering three interfaces that we usually only experience separately, Hollenbach created a new visual environment for interaction and research.

Hollenbach, USER_IS_PRESENT, 2017

Link

Project 07

sketch-mieep

var nPoints = 100;
var x = 1;

function setup() {
    createCanvas(480, 480);
    textSize(20);
    textAlign(CENTER, CENTER)
}

function draw() {
    background(0);
    noStroke();
//draws text on screen that changes with every mouse click
    if (x == 1) {
        fill(255, random(200), random(200), 220);
        text('我爱你', width/2, height/2);
    } else if (x == 2) {
        fill(255, random(200), random(200), 220);
        text('i love you', width/2, height/2);
    } else if (x == 3) {
        fill(255, random(200), random(200), 220);
        text('te amo', width/2, height/2);
    } else if (x == 4) {
        fill(255, random(200), random(200), 220);
        text('사랑해', width/2, height/2);
    } else if (x == 5) {
        fill(255, random(200), random(200), 220);
        text('愛してる', width/2, height/2);
    } else if (x == 6) {
        fill(255, random(200), random(200), 220);
        text('♡', width/2, height/2);
    }
//the code below this line starts drawing curves
//draws first curve/heart in top left corner
    fill(188, 0, 56, 200);
    drawEpitrochoidCurve();
//draws curve/heart in top right corner
    push();
    translate(width, 0);
    drawEpitrochoidCurve();
    pop();
//draws curve/heart in bottom left corner
    push();
    translate(0, height);
    drawEpitrochoidCurve();
    pop();
//draws curve/heart in bottom right corner
    push();
    translate(480, 480);
    drawEpitrochoidCurve();
    pop();
}

function mousePressed(){
    if (x == 1){
        x = 2;
    } else if (x == 2){
        x = 3;
    } else if (x == 3){
        x = 4;
    } else if (x == 4){
        x = 5;
    } else if (x == 5){
        x = 6;
    } else if (x == 6){
        x = 1;
    }
}

function drawEpitrochoidCurve() {
// Epicycloid:
 // http://mathworld.wolfram.com/Epicycloid.html
    var x;
    var y;
    var a = map(mouseX/3, 0, width, 0, 500);
    var b = a / 8;
    var h = constrain(mouseY / 8.0, 0, b);
    
    beginShape();
    for (var i = 0; i < nPoints; i++) {
        var t = map(i, 0, nPoints, 0, TWO_PI);
        x = (a + b) * cos(t) - h * cos(((a + b) / b) * t);
        y = (a + b) * sin(t) - h * sin(((a + b) / b) * t);
        vertex(x, y);
    }
    endShape();
}

Project: Curve with Composition

luca curve

//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.

Project-7: Composition with Curves

My Project

//cbtruong;
//Section B;

//sets up the variables for stroke color;
//col is the stroke color for smooth conical spiral;
//col2 is the stroke color for the rough conical spiral;
var col = 0;
var col2 = 0;
//sets up the variable for angl to allow for rotation;
var angl = 0;
//sets up the variable for the shifting fill color value;
//for the rough conical spiral;
var shiftingVal = 100;
//sets up the variable that allows for reversing the change;
//of shiftingVal;
var shiftingValChange = 1;


function setup() {
    createCanvas(480, 480);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
}

function draw() {
    background(220);
    stroke(0);
    //diagonal lines that hit the center of the spirals;
    line(0, 0, 120, 120);
    line(0, 480, 120, 360);
    line(480, 0, 360, 120);
    line(480, 480, 360, 360);
    //lines that outline the perimeter of the canvas;
    line(0, 0, 480, 0);
    line(0, 0, 0, 480);
    line(480, 0, 480, 480);
    line(0, 480, 480, 480);
    //lines of the innerbox whose vertices are the spiral centers;
    line(120, 120, 120, 360);
    line(120, 360, 360, 360);
    line(360, 360, 360, 120);
    line(360, 120, 120, 120);

    //draws the middle, rough concial spiral;
    strokeWeight(2);
    fill(shiftingVal);
    stroke(col2);
    push();
    translate(240, 240);
    conicalSpiralTopViewRough();
    pop();
    
    //draws the 4 smooth rotating conical spirals;
    noFill();
    stroke(col);
    for (var i = 120; i <= 360; i += 240){
        for (var j = 120; j <= 360; j += 240){
            push();
            translate(j, i);
            rotate(radians(angl));
            scale(0.5);
            conicalSpiralTopViewSmooth();
            pop();
        }
    }

    //checks if the shiftingVal is too high or low;
    //if too high, the fill becomes darker;
    //if too low, the fill becomes ligher;
    if (shiftingVal >= 255){
        shiftingValChange = shiftingValChange * -1;
    }
    else if (shiftingVal < 100){
        shiftingValChange = shiftingValChange * -1;
    }
    //changes the shiftingVal;
    shiftingVal += 1*shiftingValChange;
    //changes the angle and allows for rotation;
    //of the smooth conical spirals;
    angl += 0.1;
    

}

//function that creates the smooth conical spirals;
function conicalSpiralTopViewSmooth() {
    //variables for h, height; a, angle; r, radius;
    var h = 1;
    var a;
    var r = 30;
    
    //adds interactivity;
    //as one goes right, the size of the spiral increases;
    //as one goes down, the complexity of the spiral increases;
    var indepChangeX = map(mouseX, 0, 480, 500, 1000);
    var indepChangeY = map(mouseY, 0, 480, 800, 1000);
    a = indepChangeY;

    //actually creates the spiral;
    beginShape();
    for (var i = 0; i < indepChangeX; i++){
        var z = map(i, 0, 400, 0, PI);
        x = ((h - z) / h)*r*cos(radians(a*z));
        y = ((h - z) / h)*r*sin(radians(a*z));
        vertex(x, y);
    }
    endShape(CLOSE);

}

//function that creates the rough middle conical spiral;
function conicalSpiralTopViewRough() {
    //variables are the same as the smoothSpiral function;
    var h = 0.5;
    var a = 1000;
    var r;
    
    //adds interactivity;
    //the radius is now dependant on mouseY, going up increases size;
    //going left increases complexity;
    r = map(mouseY, 0, 480, 20, 10);
    var edgeNum = map(mouseX, 0, 480, 60, 30);
    
    //creates the spiral;
    beginShape();
    for (var i = 0; i < edgeNum; i++){
        var z = map(i, 0, 50, 0, TWO_PI);
        x = ((h - z) / h)*r*cos(radians(a*z));
        y = ((h - z) / h)*r*sin(radians(a*z));
        vertex(x, y);
    }
    endShape();
}

//mousePressed function that changes the variables col and col2;
//with random values of r, g, and b;
function mousePressed() {
    var randR = random(150);
    var randG = random(150);
    var randB = random(150);
    col = color(randR, randG, randB);
    col2 = color(randR + random(-50, 50), randG + random(-50, 50), randB + random(-50, 50));
}

I initially had no idea what to make in terms of curves. That was until I happened upon the Conical Spiral. It was supposed to be 3-D, but it ended up as a top down view of a spiral which I liked. Overall, I liked what I did with this Project.

As for how it works, clicking the mouse will change the colors of the middle “rough” Conical Spiral and the 4 “smooth” Conical Spirals. The colors of both types are similar but not the same, as seen with the use of random() in the code.

Along with that, moving the mouse right will increase the size of the “smooth” Spirals and reduce the size and complexity of the “rough” Spiral. Moving left does the opposite. Moving down increases the complexity of the “smooth” Spirals while also reducing the size of them and the “rough” Spiral.

Project 06 – Abstract Clock

sketchDownload
// this program draws a 24/hour abacus that keeps track of day and time. 
// each row of the abacus represents a different time-telling parameter:
var rowHeight = [-140, -74, -8, 58, 125];	//  [month, day, hr, min, sec]
var rowColor;
var beadw = 7;			// width of beads 
// arrays will be filled with bead objects:
var monthBeads = [];
var dayBeads = [];
var hrBeads = [];
var minBeads = [];
var secBeads = [];
var resetMonth = [];
var resetDay = [];
var resetHr = [];
var resetMin = [];
var resetSec = [];
var allRows = [monthBeads, dayBeads, hrBeads, minBeads, secBeads];


function setup() {
    createCanvas(480, 480);
    background(220);
    rectMode(CENTER);
    
    rowColor = [color(145, 110, 205), 		// [month
				color(200, 140, 205), 		//  day
				color(145, 140, 255), 		//  hour
				color(145, 185, 215), 		//  minute
				color(145, 200, 130)];		//  second]

	// populate monthBeads array with 12 beads:
	for (i=0; i<12; i++) {							
		monthBeads[i] = {x: beadw*i, y: rowHeight[0]}
		arrayCopy(monthBeads, resetMonth);
	}
	// populate dayBeads array with 31 beads:
	for (i=0; i<31; i++) {								
		dayBeads[i] = {x: beadw*i, y: rowHeight[1]}
		arrayCopy(dayBeads, resetDay);
	}
	// populate hrBeads array with 24 beads:
	for (i=0; i<24; i++) {
		hrBeads[i] = {x: beadw*i, y: rowHeight[2]}
		arrayCopy(hrBeads, resetHr);
	}
	// populate minBeads array with 30 beads:
	for (i=0; i<30; i++) {
		minBeads[i] = {x: beadw*i, y: rowHeight[3]}
		arrayCopy(minBeads, resetMin);
	}
	// populate secBeads array with 30 beads:
	for (i=0; i<30; i++) {
		secBeads[i] = {x: beadw*i, y: rowHeight[4]}
		arrayCopy(secBeads, resetSec);
	}
}

function draw() {
	background(220);
	
	//center canvas
    translate(width/2, height/2);

    // draw frame and rows of abacus
	drawAbacus();
	
	// draw all of the beads using the array for their row:
	for (j=0; j<allRows.length; j++) {
		setBeads(allRows[j]);
	}
	
	// check the time and move the beads accordingly:
	moveBeads(monthBeads, month(), 0, resetMonth);
	moveBeads(dayBeads, day(), 1, resetDay);
	moveBeads(hrBeads, hour(), 2, resetHr);
	moveBeads(minBeads, minute(), 3, resetMin);
	moveBeads(secBeads, second(), 4, resetSec);	
	//noLoop();
}

//Draws the frame of the abacus:
function drawAbacus() {
	fill(80, 55, 30);
	//base:
    quad(-195,190, 195,190, 220,215, -220,215);
    quad(-195,190, 195,190, 200,200, -200,200);	
    quad(-200,200, 200,200, 220,220, -220,220);	
	//left post:
    quad(-190,-200, -185,-210, -192,-210, -199,-200);
    quad(-190,200, -185,190, -185,-210, -190,-200);
    rect(-195, 0, 7, 400);
	//right post:
    quad(190,-200, 185,-210, 192,-210, 199,-200);
    quad(190,200, 185,190, 185,-210, 190,-200);
    rect(195, 0, 7, 400);
    //rows for beads:
    for (i=0; i<rowHeight.length; i++) {
        rect(0, rowHeight[i], 375, 5);
    }
	//labels:
	textSize(16);
	textFont('monospace');
	fill(0);
    text('month', -181, rowHeight[0]+28);
    text('day', -181, rowHeight[1]+28);
    text('hour', -181, rowHeight[2]+28);
    text('minute', -181, rowHeight[3]+28);
    text('second', -181, rowHeight[4]+28);
}


// draws all of the beads into their rows
function setBeads(beadArray) {
    fill(rowColor[j]);				// color taken from for loop in draw function
    strokeWeight(1.5);
	for (i=0; i<beadArray.length; i++) {		
		if (beadArray.length == 31) { ellipse(beadArray[i].x-30, beadArray[i].y, beadw, 30) }
	    else if (beadArray.length == 30) { ellipse(beadArray[i].x-23, beadArray[i].y, beadw, 30) }
	    else if (beadArray.length == 24) { ellipse(beadArray[i].x+19, beadArray[i].y, beadw, 30) }
	    else if (beadArray.length == 12) { ellipse(beadArray[i].x+103, beadArray[i].y, beadw, 30) }        
	}
}

// checks time and moves the corresponding beads:
function moveBeads(row, func, ind, rowReset) {
	var dist;
	if (row.length == 12) {dist = 283 }		//different distances based on number of beads in the row
	if (row.length == 31) {dist = 150 }
	if (row.length == 24) {dist = 199 }
	if (row.length == 30) {dist = 157 }
	for (i=0; i<func; i++) {
		// the minutes and seconds beads will move every 2x they are passed bc it looks better like that:
		if (dist == 157) {
			row[i/2] = {x: beadw*i/2-dist, y: rowHeight[ind]}
		} else {						
		    row[i] = {x: beadw*i-dist, y: rowHeight[ind]}
		}
		// february has 28 days:
		if (func == 28 & row.length == 31 && month()==2) { resetBeads(rowReset, monthBeads) }
		// 30 days has september, april, june, and november:
		if (func == 30 && row.length == 31 && month()==9) { resetBeads(rowReset, monthBeads) }
		if (func == 30 && row.length == 31 && month()==4) { resetBeads(rowReset, monthBeads) }
		if (func == 30 && row.length == 31 && month()==6) { resetBeads(rowReset, monthBeads) }
		if (func == 30 && row.length == 31 && month()==11) { resetBeads(rowReset, monthBeads) }

	}
	// once the time parameter resets to 0, so do the beads:
	if (func == 0) { resetBeads(rowReset, row) }
}
			
// sets the beads back to their original position, by row:
function resetBeads(rowReset, row) {
    arrayCopy(rowReset, row);

}

This project took me way longer than I had hoped, but I am so so pleased with the outcome. After thinking about a few ideas, I decided to make an abacus because I think it would be very helpful for me personally to visualize time in that way. I struggled a lot to get the beads where they are supposed to go, but eventually I figured out how to use the arrayCopy function to my advantage.

initial sketch of the project

Looking Outwards 06: Randomness

The piece I have chosen to write about this week is Zauberflöte by Michael Hansmeyer. Hansmeyer is a computational architect, and the series of structures he designed as Zauberflöte were created as the set for the 2018 production of Mozart’s Magic Flute, directed by Romoeo Castellucci. Using generative design, Hansmeyer was able to explore and play around with countless design possibilities as he created the pieces. I love the grander of the designs, especially in contrast with the extremely simple greyscale color theme that covers the entire stage area. As said by the artist, “the design process strikes a balance between the expected and the unexpected” because although the process is deterministic, the outcome is unknown and impossible to imagine. I have no idea how the algorithm for these pieces work, but the visual result is very reminiscent of other types of computed art due to the symmetry, repetition of patterns, and extremely clean lines.

Zauberflöte, 2018
Michael Hansmeyer

Hansmeyer used generative design to help create the grotto set for Mozart’s opera.

Project 06 – Abstract Clock

I remember learning about the Korean water clock that was invented in the Chosun dynasty in elementary school, which inspired me to create a simplified version of it through p5.js.

엄마표 과학] 만공한국사, 자격루 만들기 - 물시계의 원리 : 네이버 블로그
reference image
sketch
var angle = 180;
function setup() {
    createCanvas(420, 400);
    // rectMode(CENTER);
}

function draw() {
    background(0);
    fill(255);
    textAlign(CENTER);
    textSize(30);
    text('The water clock', width/2, 50);
    textSize(10);
    textAlign(LEFT);

    let hr = hour();
    let mn = minute();
    let sc = second();

   
    fill(255);
    text(hr + ':' + mn + ':' + sc, 10, 150);
    text('24:00:00', width-65, 150);
    rect(100, 140, 30, 5);
    rect(200, 140, 30, 10);
    
    //hour
    push();
    fill(255);
    translate(350, 380);
    rotate(radians(180)); //rotation to make the rectangle grow upwards
    rect(0, 0, 120, 240);
    fill(0, 0, 255);
    translate(5, 0);
    rect(0, 0, 110, hr*10);
    pop();

    //minute
    push();
    fill(255); //red rectangle
    translate(205, 260);
    rotate(radians(180)); //rotation to make the rectangle grow upwards
    rect(0, 0, 80, 120);
    fill(0, 75, 255);
    translate(5, 0);
    rect(0, 0, 70, mn*2);
    if (mn==59) { //when each the mn container is full, water is transferred to the hr contatiner
        translate(-30, 115);
        stroke(0, 100, 255);
        strokeWeight(5);
        line(-8, 0, 30, 0);
        stroke(0, 0, 255);
        line(-8, 0, -8, -115);
    }
    pop();

    //second
    noStroke();
    push();
    fill(255); 
    translate(100, 200);
    rotate(radians(angle)); //rotation to make the rectangle grow upwards
    rect(0, 0, 40, 60);
    fill(0, 150, 255);
    translate(5, 0);
    rect(0, 0, 30, sc);
    if (sc==59) { //when each the sc container is full, water is transferred to the mn contatiner
        translate(-30, 57.5);
        stroke(0, 150, 255);
        strokeWeight(3);
        line(-8, 0, 30, 0);
        stroke(0, 100, 255);
        line(-8, 0, -8, -115);
    }
    pop();
}
 
   
    

    

   

Project 6: Abstract Clock

For my project, I decided to create an abstract clock that tells the time through an animated frog. In this project, the frog slow closes its eyes following every passing second, and when a minute passes its eyes jump back to their starting position. The background itself is programmed to change subtly for every minute that passes. At the bottom of the canvas are blades of grass, one representing each hour that has already passed in the day.

sketch frog

var flyX = 225;
var flyY = 0;

function setup() {
    createCanvas(480, 480);
    background(255, 220, 220);
    ellipseMode(CENTER);
    rectMode(CENTER);
}

//function that draws the frog on canvas
function frog(){
//frog body
    stroke(163, 207, 144);
    fill(163, 207, 144);
    quad(20, 480, 460, 480, 340, 308, 140, 308);
//frog head
    stroke(176, 217, 159);
    fill(176, 217, 159);
    ellipse(width/2, height/2, 360, 302);
    ellipse(130, 130, 126, 120);
    ellipse(350, 130, 126, 120);
//frog blush
    stroke(240, 142, 117)
    fill(240, 142, 117);
    ellipse(70, 218, 83, 46);
    ellipse(410, 218, 83, 46);
}

//function for the flies that surround the frog
function flies(x, y){
    translate(width/2, height/2)
    for(var i = 0; i < 24; i++){
        push();
        rotate(TWO_PI*i/24);
        fill(0);
        rect(x, y, 1, 1);
        pop();
        }
    for(var i = 0; i < 12; i++){
        push();
        noStroke();
        fill(0);
        rotate(TWO_PI*i/12);
        rect(x, y, 5, 5)
        pop();
    }
}

function grass(){
    var x = 0;
    var hr = hour();
    for(var x = 0; x <= 20*(hr-1); x += 20){
        fill(61, 118, 37);
        triangle(x, 480, x+20, 480, x+10, 460);
    }
}

function draw() {
//initializaing variables for time
    var sec = second();
    var min = minute();
    var hr = hour();
    var eyeX = 56;
    var eyeY = 66;

    background(min*5, min*3.5, min*3);
//draws the frog on to the canvas
    frog(); 
//draws blades of grass on canvas that represent the hour of the day
    noStroke();   
    grass();
//frog mouth and eyes
    stroke(0);
    strokeWeight(2);
    fill(0);
    ellipse(350, 140, eyeX, eyeY-sec**1);
    ellipse(130, 140, eyeX, eyeY-sec**1);
    line(210, 168, 270, 168);
//calling function to draw flies
    flies(flyX, flyY);
    flyX += random(-1, 1);
    flyY += random(-1, 1);
//draws blades of grass
}