WEEK 2

Chris Xianyao XIA
Data Mining the City
1 min readNov 4, 2017
def setup():
size(500, 500)
stroke(204, 102, 0) #this is made with 3 rgb values
strokeWeight(10)

global moods
moods = ['happy', 'meh', 'sad', 'sick'] # mood = "happy"

def draw():
background(255, 204, 0)

eyeRadius = 30
eyeYPosition = (height/2) - 70
leftEyeXPosition = (width/2) - 30
rightEyeXPosition = (width/2) + 30
mouthWidth = 80
mouthHeight = 20
mouthX = (width/2) - mouthWidth/2
mouthY = (height/2) - mouthHeight/2
myFaceMood = 'normal'
fill(255, 0, 0)
ellipse(leftEyeXPosition, eyeYPosition, eyeRadius, eyeRadius)
fill(0, 0, 0)
ellipse(rightEyeXPosition, eyeYPosition, eyeRadius, eyeRadius)
fill(0, 255, 0)


if mouseX <125:
myFaceMood = moods[0]
elif mouseX <250 and mouseX >125:
myFaceMood = moods[1]
elif mouseX >250 and mouseX <375:
myFaceMood = moods[3]
else:
myFaceMood = moods[2]


if myFaceMood == 'happy':
triangle(mouthX - 20,mouthY,mouthX + 80,mouthY,mouthX + 30,mouthY + 50)
elif myFaceMood == 'meh':
ellipse(mouthX, mouthY, mouthWidth*3, mouthHeight*3)
elif myFaceMood == 'sad':
ellipse(mouthX+40, mouthY, mouthWidth, mouthHeight)
else:
ellipse(mouthX+40, mouthY, mouthWidth, mouthHeight/3)

--

--