Ashin.mandal (talk | contribs) |
Ashin.mandal (talk | contribs) |
||
| Line 1: | Line 1: | ||
== | == Little Shitty Robot == | ||
[[File:Ashin_little_shitty_robot.png]] | [[File:Ashin_little_shitty_robot.png]] | ||
== Little Shitty Robot Animated == | |||
[[File:Ashin_little_shitty_robot.gif]] | |||
== Little Shitty Robot Code == | |||
<pre> | |||
""" | |||
Little shitty robot. | |||
""" | |||
def setup(): | |||
size(400, 400) | |||
def draw(): | |||
# Clean canvas | |||
background(215) | |||
# Legs | |||
pushMatrix() | |||
translate(160, 200) | |||
fill(155) | |||
rect(0, 0, 20, 40) | |||
rect(60, 0, 20, 40) | |||
fill(255) | |||
popMatrix() | |||
# Feet | |||
pushMatrix() | |||
translate(140, 240) | |||
fill(0) | |||
rect(0, 0, 40, 20) | |||
rect(80, 0, 40, 20) | |||
fill(255) | |||
popMatrix() | |||
# Left Hand | |||
pushMatrix() | |||
translate(85, 100) | |||
rotate(-PI/8 * sin(frameCount * 0.1)) | |||
fill(155) | |||
rect(-30, 15, 30, 10) | |||
fill(0) | |||
rect(-50, 0, 20, 40) | |||
popMatrix() | |||
# Right Hand | |||
pushMatrix() | |||
translate(315, 100) | |||
rotate(PI/8 * sin(frameCount * 0.1)) | |||
fill(155) | |||
rect(0, 15, 30, 10) | |||
fill(0) | |||
rect(30, 0, 20, 40) | |||
fill(255) | |||
popMatrix() | |||
# Head | |||
rect(75, 50, 250, 150) | |||
# Eyes | |||
pushMatrix() | |||
translate(150, 100) | |||
stroke(random(255)) | |||
strokeWeight(3) | |||
ellipse(0, 0, 30, 30) | |||
stroke(random(255)) | |||
strokeWeight(2) | |||
ellipse(0, 0, 20, 20) | |||
stroke(random(255)) | |||
strokeWeight(1) | |||
ellipse(0, 0, 10, 10) | |||
stroke(random(255)) | |||
strokeWeight(3) | |||
ellipse(100, 0, 30, 30) | |||
stroke(random(255)) | |||
strokeWeight(2) | |||
ellipse(100, 0, 20, 20) | |||
stroke(random(255)) | |||
strokeWeight(1) | |||
ellipse(100, 0, 10, 10) | |||
stroke(0) | |||
popMatrix() | |||
# Nose / Mouth | |||
fill(155) | |||
triangle(200, 150, 180, 170, 220, 170) | |||
fill(0) | |||
textSize(32) | |||
text("Dance with me!", 85, 345) | |||
fill(255) | |||
saveFrame("Little_###.png") | |||
</pre> | |||
Revision as of 04:02, 27 April 2015
Little Shitty Robot
Little Shitty Robot Animated
Little Shitty Robot Code
"""
Little shitty robot.
"""
def setup():
size(400, 400)
def draw():
# Clean canvas
background(215)
# Legs
pushMatrix()
translate(160, 200)
fill(155)
rect(0, 0, 20, 40)
rect(60, 0, 20, 40)
fill(255)
popMatrix()
# Feet
pushMatrix()
translate(140, 240)
fill(0)
rect(0, 0, 40, 20)
rect(80, 0, 40, 20)
fill(255)
popMatrix()
# Left Hand
pushMatrix()
translate(85, 100)
rotate(-PI/8 * sin(frameCount * 0.1))
fill(155)
rect(-30, 15, 30, 10)
fill(0)
rect(-50, 0, 20, 40)
popMatrix()
# Right Hand
pushMatrix()
translate(315, 100)
rotate(PI/8 * sin(frameCount * 0.1))
fill(155)
rect(0, 15, 30, 10)
fill(0)
rect(30, 0, 20, 40)
fill(255)
popMatrix()
# Head
rect(75, 50, 250, 150)
# Eyes
pushMatrix()
translate(150, 100)
stroke(random(255))
strokeWeight(3)
ellipse(0, 0, 30, 30)
stroke(random(255))
strokeWeight(2)
ellipse(0, 0, 20, 20)
stroke(random(255))
strokeWeight(1)
ellipse(0, 0, 10, 10)
stroke(random(255))
strokeWeight(3)
ellipse(100, 0, 30, 30)
stroke(random(255))
strokeWeight(2)
ellipse(100, 0, 20, 20)
stroke(random(255))
strokeWeight(1)
ellipse(100, 0, 10, 10)
stroke(0)
popMatrix()
# Nose / Mouth
fill(155)
triangle(200, 150, 180, 170, 220, 170)
fill(0)
textSize(32)
text("Dance with me!", 85, 345)
fill(255)
saveFrame("Little_###.png")

