(10 intermediate revisions by the same user not shown) | |||
Line 19: | Line 19: | ||
""" | """ | ||
My | My Dog Bot | ||
""" | """ | ||
Line 60: | Line 60: | ||
# saveFrame("sminKimRobot2.png") | # saveFrame("sminKimRobot2.png") | ||
</pre> | |||
==== Animation Dog Bot ==== | |||
[[File:Dog2.gif|200x200px|thumb|left]] | |||
<br style="clear:both"> | |||
==== Animation Dog Bot Code ==== | |||
<pre style="font-size:smaller" > | |||
""" | |||
robot animation | |||
""" | |||
# Parameters | |||
diameter = 400 | |||
centerx = diameter / 2 | |||
centery = diameter / 2 | |||
boxsize = 100 | |||
boxsize2 = 200 | |||
boxsize3 = 70 | |||
# Drawing style | |||
def setup(): | |||
# Set up Canvas | |||
colorMode(RGB, 1) | |||
size(diameter, diameter) | |||
frameRate(10) | |||
def draw(): | |||
boxsize = 100 + 50 | |||
angle = PI/5 * sin(frameCount * 0.5) | |||
background(0.5, .8, .7) | |||
# define style | |||
fill(1, .2) | |||
rectMode(CENTER) | |||
fill(1, .8) | |||
stroke(0) | |||
strokeWeight(10) | |||
# Face | |||
rect(centerx, centery, boxsize, boxsize2) | |||
# Ears positions | |||
position1x = centerx - boxsize / 2 | |||
position1y = centery - boxsize / 2 | |||
position2x = centerx + boxsize / 2 | |||
position2y = centery - boxsize / 2 | |||
# Right Ears | |||
drawEars(position2x, position2y, +1, angle - TWO_PI * 1/9) | |||
# Left Ears | |||
drawEars(position1x, position1y, -1, angle -TWO_PI * 1/9) | |||
# Nose | |||
pushStyle() | |||
translate(2,150) | |||
fill(.5, .5 ,1, .5) | |||
ellipse(centerx, centery - 70, boxsize /2 , boxsize /2) | |||
popStyle() | |||
# Eyes | |||
translate(115,0) | |||
ellipse(centerx/10, boxsize3/4 ,boxsize3,boxsize3) | |||
ellipse(centerx-50, boxsize3/4 ,boxsize3, boxsize3) | |||
ellipse(boxsize3 + 80 , boxsize3/4 ,boxsize/10, boxsize/10) | |||
ellipse(boxsize3 - 50, boxsize3/4 ,boxsize/10, boxsize/10) | |||
#print(frameRate) | |||
#saveFrame("Dog.gif") | |||
def drawEars(xpos, ypos, direction, angle = -TWO_PI /8): | |||
pushMatrix() | |||
translate(xpos, ypos) | |||
scale(direction, 1) | |||
rotate(angle) | |||
rectMode(CORNER) | |||
rect(0, 0, 20, 150) | |||
popMatrix() | |||
</pre> | </pre> |
Latest revision as of 23:19, 27 April 2015
Hello world!
My name is Smin Kim. I'm studying in Media art and design Bauhaus University Weimar Master course. live and work in Weimar. Nice to see you here!
SNS
lovely Bot
Dog Bot Code
""" My Dog Bot """ # Drawing style size(400,400) background("#FF8000") fill(255,0,100,90) strokeWeight(10) rect(150,120,100,200) # Nose ellipse(200,300,60,60) # Eears pushMatrix() translate(250,120) rotate(-TWO_PI /10) rect(0,0,20,150) popMatrix() pushMatrix() translate(150,120) scale(-1,1) rotate(-TWO_PI /8) rect(0,0,20,150) popMatrix() # Eyes pushMatrix() translate(275,120) scale(-1,1) ellipse(50,70,10,10) ellipse(100,70,10,10) strokeWeight(5) ellipse(120,70,30,30) ellipse(30,70,30,30) popMatrix() # saveFrame("sminKimRobot2.png")
Animation Dog Bot
Animation Dog Bot Code
""" robot animation """ # Parameters diameter = 400 centerx = diameter / 2 centery = diameter / 2 boxsize = 100 boxsize2 = 200 boxsize3 = 70 # Drawing style def setup(): # Set up Canvas colorMode(RGB, 1) size(diameter, diameter) frameRate(10) def draw(): boxsize = 100 + 50 angle = PI/5 * sin(frameCount * 0.5) background(0.5, .8, .7) # define style fill(1, .2) rectMode(CENTER) fill(1, .8) stroke(0) strokeWeight(10) # Face rect(centerx, centery, boxsize, boxsize2) # Ears positions position1x = centerx - boxsize / 2 position1y = centery - boxsize / 2 position2x = centerx + boxsize / 2 position2y = centery - boxsize / 2 # Right Ears drawEars(position2x, position2y, +1, angle - TWO_PI * 1/9) # Left Ears drawEars(position1x, position1y, -1, angle -TWO_PI * 1/9) # Nose pushStyle() translate(2,150) fill(.5, .5 ,1, .5) ellipse(centerx, centery - 70, boxsize /2 , boxsize /2) popStyle() # Eyes translate(115,0) ellipse(centerx/10, boxsize3/4 ,boxsize3,boxsize3) ellipse(centerx-50, boxsize3/4 ,boxsize3, boxsize3) ellipse(boxsize3 + 80 , boxsize3/4 ,boxsize/10, boxsize/10) ellipse(boxsize3 - 50, boxsize3/4 ,boxsize/10, boxsize/10) #print(frameRate) #saveFrame("Dog.gif") def drawEars(xpos, ypos, direction, angle = -TWO_PI /8): pushMatrix() translate(xpos, ypos) scale(direction, 1) rotate(angle) rectMode(CORNER) rect(0, 0, 20, 150) popMatrix()