# Winking Cat & Earthquakes

**Cat**

Made my digital cat wink when you move the mouth. Original I had its nose enlarge when you clicked, but I changed it for the GIF which looks better when the both happen at the same time.

def setup():

size(500, 700)

stroke(0)

strokeWeight(1)

background (0,255,255)

def draw():

#this is the head

fill(0)

headwidth = 400

headheight = 300

headx = 250

heady = 250

#these are the ears

leftear1x = 100

leftear1y = 150

leftear2x = 125

leftear2y = 50

leftear3x = 200

leftear3y = 105

rightear1x = 300

rightear1y = 105

rightear2x = 375

rightear2y = 50

rightear3x = 400

rightear3y = 150

#these are the eyes

lefteyex = 190

eyey = 190

righteyex = 320

eyewidth = 50

eyeheight = 70

#these are the pupils

leftpupilx = 190

pupily = 190

rightpupilx = 320

pupildiameter = 20

#these are the whiskers

whiskerx = 250

whiskery = 260

whisker13x = 105

whisker2x = 95

whisker46x = 395

whisker5x = 385

whisker14y = 220

whisker25y = 260

whisker36y = 280

#this is the nose

nosex = 250

nosey = 260

nosediameter = 20

#this is the whole cat

fill(0)

ellipse(headx, heady, headwidth, headheight)

triangle(leftear1x, leftear1y, leftear2x, leftear2y, leftear3x, leftear3y)

triangle(rightear1x, rightear1y, rightear2x, rightear2y, rightear3x, rightear3y)

fill(255,255,0)

ellipse(lefteyex, eyey, eyewidth, eyeheight)

ellipse(righteyex, eyey, eyewidth, eyeheight)

fill(0)

ellipse(leftpupilx, pupily, pupildiameter, pupildiameter)

ellipse(rightpupilx, pupily, pupildiameter, pupildiameter)

stroke(255,255,255)

line(whiskerx, whiskery, whisker13x, whisker14y)

line(whiskerx, whiskery, whisker2x, whisker25y)

line(whiskerx, whiskery, whisker13x, whisker36y)

line(whiskerx, whiskery, whisker46x, whisker14y)

line(whiskerx, whiskery, whisker5x, whisker25y)

line(whiskerx, whiskery, whisker46x, whisker36y)

fill(255,160,122)

ellipse(nosex, nosey, nosediameter, nosediameter)

if (mouseX < 250):

fill(0)

ellipse(lefteyex, eyey, eyewidth, eyeheight)

fill(255,160,122)

ellipse(nosex, nosey, nosediameter*2, nosediameter*2)

**Earthquake Data**

Next I visualized the earthquake data by making anything with a magnitude of 2 or higher become larger and red when hovered over, where as all other magnitudes stay the same size and are orange.

import csv

def setup():

size(1000, 600)

with open("quakes.csv") as f:

reader = csv.reader(f)

header = reader.next() # Skip the header row.

global magnitudes

magnitudes = []

for row in reader:

magnitude = float(row[4])

magnitudes.append(magnitude)

def draw():

background(105, 105, 105)

scalar=30

x = 0

#here are the magnitude factors

for magnitude in magnitudes:

leftEdge = x - (8)

rightEdge = x + (8)

if leftEdge < mouseX and mouseX < rightEdge:

if magnitude>2:

fill(255,0,0)

ellipse(x, height / 2, 20, magnitude*scalar*2)

else:

fill(255, 150, 50)

ellipse(x, height / 2, 10, magnitude*scalar)

else:

fill(255,255,255)

ellipse(x, height / 2, 10, magnitude*scalar)

x += 12