Letter Bounce 8B Choose 1 of your 10 keyverbs/keyadjectives from class and represent it as a single interactive piece with no typography (except I used typography for this one). No static representations allowed. Many in class used nouns -- no nouns allowed. Be sure to leave the keyverb/keyadjective as a comment at the top of your code. back to movies page
#bounce g.norefresh() import math def distance (a,b,c,d): return math.sqrt(pow(c-a, 2)+pow(d-b, 2)) def fillCircle (x, y, d,c): for i in range (x, x+d): for j in range (y, y+d): if distance (i, j, (x+(d/2)), (y+(d/2))) < (d/2): g.setPixel(i,j, c) def DrawB(x, y): fillCircle(x, y, 15, 100) fillCircle(x, y+8, 8, 100) fillCircle(x, y+14, 8, 100) fillCircle(x+6, y+6, 5, 0) def DrawO(x, y): fillCircle(x, y, 15, 100) fillCircle(x+6, y+6, 5, 0) def DrawU(x, y): fillCircle(x, y, 15, 100) fillCircle(x+5, y+7, 5, 0) fillCircle(x+5, y+10, 5, 0) def DrawN(x, y): fillCircle(x, y, 15, 100) fillCircle(x+5, y+3, 5, 0) fillCircle(x+5, y, 5, 0) fillCircle(x, y+10, 5, 100) def DrawC(x, y): fillCircle(x, y, 15, 100) fillCircle(x+10, y+5, 5,0) fillCircle(x+7, y+5, 5, 0) def DrawE(x, y): fillCircle(x, y, 15, 100) fillCircle(x+10, y+3, 4,0) fillCircle(x+8, y+3, 4, 0) fillCircle(x+5, y+8, 3, 0) fillCircle(x+6, y+8, 3, 0) fillCircle(x+5, y+9, 3, 0) fillCircle(x+6, y+9, 3, 0) #a=amplitude, b=# of bounces, h = height def bounceB (a, n, h): n=100/n for x in range (0, 100): y=int(abs(a*math.sin(math.pi/n*x))+h) DrawB(x,y) g.refresh() g.pause(3) g.paper(0) def bounceO (a, n, h): n=100/n for x in range (0, 100): y=int(abs(a*math.sin(math.pi/n*x))+h) DrawO(x,y) g.refresh() g.pause(3) g.paper(0) def bounceU (a, n, h): n=100/n for x in range (0, 100): y=int(abs(a*math.sin(math.pi/n*x))+h) DrawU(x,y) g.refresh() g.pause(3) g.paper(0) def bounceN (a, n, h): n=100/n for x in range (0, 100): y=int(abs(a/2*math.sin(math.pi/n*x))+h/10) DrawN(x,y) g.refresh() g.pause(3) g.paper(0) def bounceC (a, n, h): n=100/n for x in range (0, 100): y=int(abs(a/2*math.sin(math.pi/n*x))+h/10) DrawC(x,y) g.refresh() g.pause(3) g.paper(0) def bounceE (a, n, h): n=100/n for x in range (0, 100): y=int(abs(a/2*math.sin(math.pi/n*x))+h/10) DrawE(x,y) g.refresh() g.pause(3) g.paper(0) bounceB(60, 3, 40) bounceO(g.getMouse(2), (int(g.getMouse(2))%4 +2), g.getMouse(1)) bounceU(g.getMouse(2), (int(g.getMouse(2))%4 +2), g.getMouse(1)) bounceN(g.getMouse(2), (int(g.getMouse(2))%4 +2), g.getMouse(1)) bounceC(g.getMouse(2), (int(g.getMouse(2))%4 +2), g.getMouse(1)) bounceE(g.getMouse(2), (int(g.getMouse(2))%4 +2), g.getMouse(1))