Interactive Baymax

Weijian Bi
Data Mining the City
1 min readSep 27, 2017
Shining Baymax

I’ve used random color function to create a shining effect (background, heart, pocket).

P.S. Don’t stare at it too long.

Code:

def setup():
size(500,500)

def draw():
#color variables
a = floor(random(255))
b = floor(random(100,255))
c = floor(random(100,255))
mouthColorHighlight = color(a,b,c)
mouthColorUnHighlighted = color(a, b, c)

if mouseX < width/2:
background(mouthColorHighlight)
else:
background(mouthColorUnHighlighted)

#head
fill(252,252,252)
stroke(252,252,252)
ellipseMode(CENTER);
ellipse(250,150,220,150);
#righteye
fill(0,0,0)
stroke(0,0,0)
ellipse(200,150,30,30)
#lefteye
fill(0,0,0)
ellipse(300,150,30,30)
#line between left and right eye
fill(0,0,0)
strokeWeight(2)
line(200,150,300,150)
#leftblush
fill(255,201,160)
stroke(255,201,160)
ellipse(180,180,20,10)
#rightblush
fill(255,201,160)
stroke(255,201,160)
ellipse(320,180,20,10)
#body
fill(252,252,252)
stroke(252,252,252)
ellipse(250,400,380,400)

if mouseX<width/2.5:
#text
f=createFont("Chalkduster",40)
textFont(f,40)
fill(144,152,145)
text("Hello!", mouseX/2, mouseY)
#port
d = floor(random(255))
e = floor(random(204,241))
f = floor(random(54))
fill(d,e,f)
stroke(0,0,0)
ellipse(340,300,50,50)
line(317,300,330,300)
line(330,300,330,290)
line(330,290,350,290)
line(350,290,350,300)
line(350,300,365,300)

else:
#text
f=createFont("Chalkduster",40)
textFont(f,40)
fill(242,113,7)
text("Goodluck!", mouseX, mouseY)
#heart
g = floor(random(188,255))
h = floor(random(5,152))
i= floor(random(5,100))
smooth();
noStroke();
fill(g,h,i);
beginShape();
vertex(340, 285);
bezierVertex(340, 255, 400, 270, 340, 322.5);
vertex(340, 285);
bezierVertex(340, 255, 280 , 270, 340, 322.5);
endShape();

--

--