# Avatar – Clock

This is my sketch for my clock about my ex boyfriend, In Bad Taste. It is a collage of my resentment that he liked video games more than me, that I wasn’t invited on this vacation to Sedona, and how frequently he called me a bad girlfriend. Alas.

Here is my inspiration for the project.

The slot machine/ clock rotates with the time of day. When the digits of the clock are the same balloons pop up letting you know that the time is now.

```// Global variables.   PImage bg; PImage fg; PImage armChair; PImage slotMachine; PImage the; PImage time; PImage is; PImage now; PImage cherry; PImage[] numbers = new PImage[10]; int x; int y;         void setup() { size (1000, 600); frameRate(60); bg = loadImage("background.png"); fg = loadImage("foreground.png"); armChair = loadImage("armChair.png"); slotMachine = loadImage("slotMachine.png"); the = loadImage("the.png"); time = loadImage("time.png"); is = loadImage("is.png"); now = loadImage("now.png"); cherry = loadImage("cherry.png"); for(int i = 0; i &lt; 10; i++) { numbers[i] = loadImage(str(i) + ".png"); } }   float clamp(float x, float min, float max) { if(x &lt; min) return min; if(x &gt; max) return max; return x; }   void draw() { float hr = hour(); float mn = minute(); float sc = second(); float ml = (float)(System.currentTimeMillis() % 60000);   sc = ml * 0.001; background(0); image(bg, 0, 0, 1000, 600);   if(hr == mn){ float amountToRise = 600.0 + 1500.0; float lengthOfRise = 8.0; //clamp(sc, 0.0, lengthOfRise) float t = (clamp(sc, 0.0, lengthOfRise) / lengthOfRise); int offset = int(amountToRise * t); println(sc); moveBalloons(offset); }   image(fg, 0, 0, 1000, 600); slots(hr, mn, sc); image(slotMachine, 500, 100, 220, 380); image(cherry, 628, 44.5, 50, 65); image(armChair, 550, 250, 300, 300);     //System.out.println(hr); //System.out.println(mn);   }   void moveBalloons(int yOffset) { x = 100 ; y = 600 - yOffset; image(the, x + sin(yOffset * 0.012) * 20.0, y, 360, 240); image(time, x - 30 + sin(yOffset * 0.010) * 10.0, y + 150, 420, 280); image(is, x + 60 + sin(yOffset * 0.014) * 15.0, y + 340, 240, 260); image(now, x + sin(yOffset * 0.006) * 11.0, y + 520, 350, 250);   }   void slots(float hour, float minute, float second) { PImage[] currentHr = returnTime((int)floor(hour)); PImage[] nextHr = returnTime(((int)floor(hour) + 1 )% 24); pushMatrix(); translate(558, 195); scale(0.06, 0.09); rotate(-0.05); float heightm = currentHr[0].height; float tenhourLeft = ((hour % 10.0)) / 10.0; image(currentHr[0], 0, - heightm * tenhourLeft); image(nextHr[0], 0, heightm -heightm * tenhourLeft); popMatrix();   pushMatrix(); translate(590, 196); scale(0.05, 0.09); rotate(-0.05); float heighth = currentHr[1].height; float hourLeft = (minute) / 60.0; image(currentHr[1], 0, - heighth * hourLeft); image(nextHr[1], 0, heighth -heighth * hourLeft); popMatrix();   PImage[] currentMn = returnTime((int)floor(minute)); PImage[] nextMn = returnTime(((int)floor(minute) + 1 )% 60); pushMatrix(); translate(622, 192); scale(0.05, 0.09); rotate(-0.05); float tenminLeft = ((minute % 10.0))/10.0; float heighto = currentMn[0].height; image(currentMn[0], 0, - heighto * tenminLeft); image(nextMn[0], 0, heighto -heighto * tenminLeft); popMatrix();   pushMatrix(); translate(654, 194); scale(0.045, 0.09); rotate(-0.05); float heightn = currentMn[1].height; float minuteLeft = (second)/ 60.0; image(currentMn[1], 0, - heightn * minuteLeft); image(nextMn[1], 0, heightn -heightn * minuteLeft); popMatrix();       }   PImage[] returnTime(int time) { int firstD = time % 10; int secondD = time / 10; print(secondD, firstD); PImage[] currentNum = {numbers[secondD], numbers[firstD]}; return currentNum; }```