processing frog

Yichen Ouyang
Data Mining the City
1 min readOct 15, 2017

code:

def setup():
#this is the background
size(500,500)
background(252,229,199)
def draw():
#face
fill(60,105,60)
ellipse(250,300,400,300)
#left eye
fill(255,228,49)
ellipse(150,150,100,100)
fill(255,255,255)
ellipse(150,150,70,70)
#right eye
fill(255,228,49)
ellipse(350,150,100,100)
fill(255,255,255)
ellipse(350,150,70,70)

#face detail
fill(0,0,0)
triangle(250,250,235,230,265,230)
ellipse(250,350,50,100)
if (mousePressed):
fill(250,250,250)
ellipse(250,350,110,100)
fill(0,0,0)
textSize(60)
text(“GUA “, 250,350)
else:
fill(250,250,250)
ellipse(250,350,50,100)
#interactive
r1=100
r2=70
r3=20
x1=150
y1=150
x2=350
y2=150
dx= mouseX-x1
dy= mouseY-y1
R=r1-r2
D= width
x1 += dx*R/D
y1 += dy*R/D
x2 += dx*R/D
y2 += dy*R/D
fill(0,0,0)
ellipse(x1, y1, r3, r3)
ellipse(x2, y2, r3, r3)

--

--