656
edits
Line 81: | Line 81: | ||
centerx = diameter / 2 | centerx = diameter / 2 | ||
centery = diameter / 2 | centery = diameter / 2 | ||
boxsize = | boxsize = 100 | ||
boxsize2 = 200 | |||
boxsize3 = 70 | |||
# Drawing style | # Drawing style | ||
def setup(): | def setup(): | ||
# Set up Canvas | # Set up Canvas | ||
colorMode(RGB, 1) | colorMode(RGB, 1) | ||
size(diameter, diameter) | size(diameter, diameter) | ||
frameRate(10) | |||
def draw(): | def draw(): | ||
boxsize = 100 + 50 | |||
angle = PI/5 * sin(frameCount * 0.5) | |||
boxsize = 100 + 50 | background(0.5, .8, .7) | ||
angle = PI/ | |||
background( | |||
# define style | # define style | ||
fill(1, . | fill(1, .2) | ||
rectMode(CENTER) | rectMode(CENTER) | ||
fill(1, . | fill(1, .8) | ||
stroke( | stroke(0) | ||
strokeWeight(10) | strokeWeight(10) | ||
# | # Face | ||
rect(centerx, centery, boxsize, | rect(centerx, centery, boxsize, boxsize2) | ||
# | # Ears positions | ||
position1x = centerx - boxsize / 2 | position1x = centerx - boxsize / 2 | ||
position1y = centery - boxsize / 2 | position1y = centery - boxsize / 2 | ||
Line 114: | Line 116: | ||
position2y = centery - 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() | pushStyle() | ||
translate(2,150) | |||
fill(.5, .5 ,1, .5) | fill(.5, .5 ,1, .5) | ||
ellipse(centerx, centery - | ellipse(centerx, centery - 70, boxsize /2 , boxsize /2) | ||
popStyle() | 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) | |||
def | #print(frameRate) | ||
#saveFrame("Dog.gif") | |||
def drawEars(xpos, ypos, direction, angle = -TWO_PI /8): | |||
pushMatrix() | pushMatrix() | ||
translate(xpos, ypos) | translate(xpos, ypos) | ||
Line 141: | Line 154: | ||
rect(0, 0, 20, 150) | rect(0, 0, 20, 150) | ||
popMatrix() | popMatrix() | ||
</pre> | </pre> |
edits