Stream 9B Do problem 9A, this time with a temporal display of the difference in display area. back to movies page
# import math def stream2 (y1): for a in range (0, 200): y = 200-a-y1 x1= 200-(int(a/2*math.sin(math.pi/30*a))+y) x2 = 200-(int(a/2*math.sin(math.pi/30*a))+y)+int(a/2) x3= 200-(int(a/2*math.sin(math.pi/30*a))+y)+int(a/3) g.setPixel(x1+1, y, 100) g.setPixel(x2, y, 100) g.setPixel(x3, y, 100) g.pause(1) for a in range (0, 200): y = 200-a-y1 x1= 200-(int(a/2*math.sin(math.pi/30*a))+y) x2 = 200-(int(a/2*math.sin(math.pi/30*a))+y)+int(a/2) x3= 200-(int(a/2*math.sin(math.pi/30*a))+y)+int(a/3) g.setPixel(x1+1, y, 0) g.setPixel(x2, y, 0) g.setPixel(x3, y, 0) g.pause(1) def mountains(): g.line(76, 200, 0, 114) for a in range (76, 200): x = a y = 200-abs((int(a/3*math.cos(math.pi/50*a)))) g.setPixel(x, y, 100) mountains () def snow (x1, x2, y1, color): for a in range(x1, x2): x=a y=y1-abs((int(8*math.cos(math.pi/14*a)))) g.setPixel(x, y, color) def snowmelt(): snow(56, 88, 185,0) snow (112, 134, 180,0) snow (160, 188, 160,0) snow(66,86,190,100) snow(117,132,187,100) snow(165,185,175,100) g.pause(25) snow(66,86,190,0) snow(117,132,187,0) snow(165,185,175,0) snow(67,80,195, 100) snow(122,129,194, 100) snow(170,180,190,100) g.pause(25) snow(67,80,195, 0) snow(122,129,194, 0) snow(170,180,190,0) snow(56, 88, 185,100) snow (112, 134, 180,100) snow (160, 188, 160,100) snowmelt() stream2 ( 40)