def main(): points = [Point(x=230, y=450), Point(x=240, y=460), Point(x=230, y=470), Point(x=240, y=480)] polygon(point_list=points) points2 = [Point(p.x + 20, p.y + 20) for p in points] lines(point_list=points2, color=COLOR_DARK_ORANGE) line(start_point=Point(x=20, y=20), end_point=Point(x=40, y=300)) square(left_bottom=Point(400, 300, ), side=100) rectangle( left_bottom=Point(x=200, y=200), right_top=Point(x=300, y=300), color=COLOR_DARK_GREEN ) rectangle( left_bottom=Point(x=400, y=300), right_top=Point(x=300, y=400), color=COLOR_DARK_GREEN ) sleep(2) clear_screen() vector(start=Point(x=230, y=260), angle=70, length=200, color=COLOR_PURPLE) for i in range(10): point = random_point() color = random_color() radius = random_number(20, 60) circle(center_position=point, radius=radius, color=color, width=0) sleep(2) clear_screen() for i in range(10): point = random_point() color = random_color() dx = random_number(30, 100) dy = random_number(30, 100) right_top = Point(x=point.x + dx, y=point.y + dy) ellipse(left_bottom=point, right_top=right_top, color=color) v3 = Vector(start_point=Point(0, 0), direction=45, length=50) for direction in range(0, 181, 20): v = Vector(start_point=Point(x=300, y=300), direction=direction, length=100) v.draw() v2 = Vector(start_point=v.end_point, direction=direction + 30, length=50) v2.draw(color=COLOR_GREEN) v2.add(v3) v2.draw(color=COLOR_ORANGE) snowflake(center=Point(), length=60, factor_b=0.2, factor_c=100) sleep(2) for k in range(2): y = 500 for i in range(10): clear_screen() y -= 30 for x in [100, 200, 300, 400, 500]: radius = random_number(30, 50) point = Point(x=x, y=y) snowflake(center=point, length=radius) mouse_point, mouse_buttons = get_mouse_state() print("mouse_state is {} + {}".format(mouse_point, mouse_buttons)) if user_want_exit(sleep_time=0.1): break if user_want_exit(0): break
def show_snow(count_flake): snow_params = [] for _ in range(count_flake): snow_params.append([sd.random_number(0, 1000), sd.random_number(500, 600), sd.random_number(20, 40)]) while True: for flake in snow_params: x, y, length = flake draw_flake(x, y, length, sd.COLOR_WHITE) sd.finish_drawing() sd.sleep(0.1) for key, flake in enumerate(snow_params): x, y, length = flake draw_flake(x, y, length, sd.background_color) snow_params[key][0] += sd.random_number(-25, 25) snow_params[key][1] -= sd.random_number(1, 25) if y < 0: break if sd.user_want_exit(): break
def snowfall(N): snowflake = [] for _ in range(N): snowflake.append(([sd.random_number(-50, 1250), sd.random_number(550, 1600), sd.random_number(23, 47)])) while True: sd.start_drawing() for snow in snowflake: x, y, length = snow point = sd.get_point(x, y) sd.snowflake(center=point, length=length, color=sd.background_color, factor_a=0.6) if y > 50: snow[1] -= 10 snow[0] -= 10 point_fall = sd.get_point(x, y) sd.snowflake(point_fall, length=length, color=sd.COLOR_WHITE) else: last_point = sd.get_point(x, y - 1) sd.snowflake(last_point, length, color=sd.COLOR_WHITE) snow[1] += 1250 sd.finish_drawing() sd.sleep(0.05) if sd.user_want_exit(): break sd.clear_screen()
def snowflakes(_x1, _y1, _x2, _y2): def new_snowflake(): _x = sd.random_number(_x1, _y1) _y = sd.random_number(_x2, _y2) _length = sd.random_number(10, 20) _my_dict = {'x': _x, 'y': _y, 'length': _length} snowflakes[i] = _my_dict snowflakes = {} for i in range(50): new_snowflake() while True: sd.start_drawing() for i, snowflake in snowflakes.items(): sd.snowflake(center=sd.get_point(snowflake['x'], snowflake['y']), length=snowflake['length'], color=sd.background_color) snowflake['y'] -= 10 if snowflake['x'] >= 340: snowflake['x'] += sd.random_number(-51, -50) snowflake['x'] += sd.random_number(-50, 50) sd.snowflake(center=sd.get_point(snowflake['x'], snowflake['y']), length=snowflake['length'], color=sd.COLOR_WHITE) if snowflake['y'] < snowflake['length']: new_snowflake() continue sd.sleep(0.005) sd.finish_drawing() if sd.user_want_exit(): break sd.pause()
def sno(): sd.resolution = (1200, 600) x = [ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190 ] y = [ 590, 593, 595, 598, 596, 598, 599, 594, 597, 598, 599, 596, 599, 598, 599, 597, 598, 599, 599, 596 ] long = random.randint(3, 8) background_color = (0, 8, 98) while True: for idx, val in enumerate(x): point = sd.get_point(x[idx], y[idx]) sd.snowflake(center=point, length=long, color=background_color) y[idx] -= random.randint(0, 20) point = sd.get_point(x[idx], y[idx]) sd.snowflake(center=point, length=long) if y[idx] < 20: y[idx] = 600 if sd.user_want_exit(): break return
def falling_snowflake(): snowflakes_length = [sd.random_number(10, 101) for _ in range(20)] snowflakes_point = { i: [sd.random_number(0, 500), 500, i] for i in range(20) } old_points_arr = [[snowflakes_point[key][0], snowflakes_point[key][1]] for key, val in snowflakes_point.items()] while True: sd.start_drawing() for i in range(20): if len(old_points_arr) < 20: sd.snowflake(center=old_points_arr[i], length=snowflakes_length[i], color=sd.background_color) x, y, delay = snowflakes_point[i] if delay < 1: point = sd.get_point(x, y) sd.snowflake(center=sd.Point(old_points_arr[i][0], old_points_arr[i][1]), length=snowflakes_length[i], color=sd.background_color) sd.snowflake(center=point, length=snowflakes_length[i]) if y < 20: snowflakes_point[i][1] = 500 continue snowflakes_point[i][1] -= 9 snowflakes_point[i][0] += sd.random_number(-10, 10) old_points_arr[i] = [x, y] snowflakes_point[i][2] -= .2 sd.finish_drawing() sd.sleep(0.1) if sd.user_want_exit(): break
def snow(): x_list = [] y_list = [] flake_length_list = [] number_of_snowflakes = 20 for _ in range(number_of_snowflakes): x_list.append(sd.random_number(0, sd.resolution[0])) y_list.append(sd.random_number(sd.resolution[1], sd.resolution[1] * 2)) flake_length_list.append(sd.random_number(20, 50)) while True: sd.start_drawing() for x, y, length, i in zip(x_list, y_list, flake_length_list, range(number_of_snowflakes)): if y_list[i] > 65: sd.snowflake(sd.get_point(x, y), length, color=sd.background_color) x_list[i] += sd.random_number(-15, 15) y_list[i] -= sd.random_number(4, 30) if y_list[i] < 50: y_list[i] = sd.random_number(sd.resolution[1], sd.resolution[1] * 2) sd.snowflake(sd.get_point(x_list[i], y_list[i]), length) sd.finish_drawing() sd.sleep(0.1) if sd.user_want_exit(): break
def snowfall(): flakes = dict(x=[], y=[], size=[]) for i in range(N): flakes['x'].append(sd.random_number(0, sd.resolution[0] // 5)) flakes['y'].append(sd.random_number(sd.resolution[1] - 400, sd.resolution[1] - 200)) flakes['size'].append(sd.random_number(5, 30)) while True: sd.start_drawing() if 'points' in locals(): for index in range(N): sd.snowflake(center=points[index], length=flakes['size'][index], color=sd.background_color) points = [] for index in range(N): point = sd.get_point(flakes['x'][index], flakes['y'][index]) points.append(point) sd.snowflake(center=point, length=flakes['size'][index]) if flakes['y'][index] > sd.random_number(130, 160): flakes['y'][index] -= sd.random_number(2, 10) flakes['x'][index] += sd.random_number(-5, 5) sd.finish_drawing() sd.sleep(0.1) if sd.user_want_exit(): break
def falling(): while True: sd.start_drawing() for i in range(N - 1): size = size_list[i] sd.snowflake(center=sd.get_point(x=x_list[i], y=y_list[i]), length=size, color=sd.background_color) y_list[i] -= speed_list[i] sd.snowflake(center=sd.get_point(x=x_list[i], y=y_list[i]), length=size, color=sd.COLOR_WHITE) if y_list[i] < 40: y_list[i] = 600 point1 = sd.get_point(x_list[i], y_list[i]) sd.snowflake(center=point1, length=size, color=sd.COLOR_WHITE, factor_a=0.6, factor_b=0.35, factor_c=60) sd.sleep(0.001) sd.finish_drawing() if sd.user_want_exit(): break
def snowflake(): ground_level = 50 k = 0 while True: sd.start_drawing() for i in snowflakes_param: x = i[0] y = i[1] point = sd.get_point(x, y) snowflake_length = i[2] sd.snowflake(center=point, length=snowflake_length, color=sd.background_color) i[1] -= sd.random_number(0, 20) i[0] += sd.random_number(-20, 20) point_1 = sd.get_point(i[0], i[1]) sd.snowflake(center=point_1, length=snowflake_length, color='white') if y < ground_level: ind = snowflakes_param.index(i) fallen.append(snowflakes_param.pop(ind)) flake_add(snowflakes_param, 1) k += 1 if k >= 10: ground_level += 5 k = 0 sd.finish_drawing() sd.sleep(0.1) if sd.user_want_exit(): break
def snowfall(N): snowflake = [] for _ in range(N): snowflake.append(([ sd.random_number(50, 1250), sd.random_number(550, 1600), sd.random_number(23, 47) ])) for snow in snowflake: x, y, length = snow point = sd.get_point(x, y) sd.snowflake(center=point, length=length, color=sd.background_color, factor_a=0.6) if y > 10: snow[1] = sd.random_number(-30, 50) snow[0] = sd.random_number(-30, 1850) point_fall = sd.get_point(x, y) sd.snowflake(point_fall, length=length, color=sd.COLOR_WHITE) else: last_point = sd.get_point(x, y - 1) sd.snowflake(last_point, length, color=sd.COLOR_WHITE) snow[1] = sd.random_number(10, 30) break # sd.sleep(0.1) if sd.user_want_exit(): break
def snowflakes(quantity): x_list = [] y_list = [] size_list = [] length_list = [] for _ in range(quantity): new_x = sd.random_number(50, 1150) x_list.append(new_x) new_y = sd.random_number(0, 600) y_list.append(new_y) new_size = sd.random_number(10, 40) size_list.append(new_size) new_length = round(sd.random_number(10, 90) / 100, 1) length_list.append(new_length) while True: sd.start_drawing() sd.clear_screen() for i, x in enumerate(x_list): if y_list[i] < 0: y_list[i] = 600 point = sd.get_point(x_list[i], y_list[i]) sd.snowflake(center=point, length=size_list[i], factor_b=length_list[i]) y_list[i] -= 10 sd.finish_drawing() sd.sleep(0.1) if sd.user_want_exit(): break
def snowfall(): for k in range(2): y = 500 for i in range(10): sd.clear_screen() y -= 30 for x in [100, 200, 300, 400, 500]: radius = sd.random_number(30, 50) point = sd.Point(x=x, y=y) sd.snowflake(center=point, length=radius) mouse_point, mouse_buttons = sd.get_mouse_state() print("mouse_state is {} + {}".format(mouse_point, mouse_buttons)) if sd.user_want_exit(sleep_time=0.1): break if sd.user_want_exit(0): break
def snowfall_main(): n = 20 # Переменная length_of_snowflake не используется. # length_of_snowflake = sd.random_number(10, 100) snowflakes = [] # Переменная snowflake не используется. # snowflake = [] # генерация списка из 20 снежинок for quantity_snowflakes in range(n): x = sd.random_number(50, 100) y = sd.random_number(720, 800) length_of_snowflake = sd.random_number(10, 25) snowflake = [x, y, length_of_snowflake] snowflakes.append(snowflake) while True: sd.start_drawing() for i, (x, y, length) in enumerate(snowflakes): if y < 0: # Если высота падения снежинки становится меньше нуля,то: point = sd.get_point(x, y) sd.snowflake(center=point, length=length, color=sd.background_color) x = sd.random_number( 50, 100) # генерация новой координаты х для новой снежинки y = sd.random_number( 720, 800) # генерация новой координаты у для новой снежинки length_of_snowflake = sd.random_number( 10, 25) # генерация новой длины для новой снежинки snowflake = [x, y, length_of_snowflake ] # генерация новой снежинки, взамен удаленной snowflakes[i] = snowflake # замена снежинки по индексу break point = sd.get_point(x, y) sd.snowflake(center=point, length=length, color=sd.background_color) x += sd.random_number(-10, 10) y -= sd.random_number(1, 5) snowflakes[i] = [x, y, length] point2 = sd.get_point(x, y) sd.snowflake(center=point2, length=length, color=sd.COLOR_WHITE) sd.finish_drawing() sd.sleep(0.05) if sd.user_want_exit(): break
def snowfall_print(point, lengths, step, color, angle): while point.y > 0: if sd.user_want_exit(): break sd.snowflake(point, lengths, color, factor_c=angle) if point.y < lengths * 0.5: break sd.snowflake(point, lengths, sd.background_color, factor_c=angle) point.y -= step
def falling(): x = 50 while True: snowflakes(N=8, y_shift=x) sd.sleep(0.1) snowflakes(N=8, y_shift=x, color=sd.background_color) x -= 50 if sd.user_want_exit(): break
def fall(self): while True: self.clear_previous_picture() self.move() self.draw() if self.cant_fall(): break sd.sleep(0.1) if sd.user_want_exit(): break
def snowfall(n): speed, coord, length = [], [], [] for i in range(n): speed.append(random.randint(10, 50)) x = random.randint(10, 250) y = random.randint(300, 350) coord.append([x, y]) length.append(random.randint(5, 10)) while True: for i in range(n): sd.start_drawing() wind = random.randint(-20, 20) point = sd.get_point(coord[i][0], coord[i][1]) sd.snowflake(center=point, length=length[i], color=sd.background_color) coord[i][0] -= wind coord[i][1] -= speed[i] x0, y0 = coord[i][0], coord[i][1] point = sd.get_point(x0, y0) sd.snowflake(center=point, length=length[i]) if coord[i][1] <= 20 and speed != 0: speed[i] = 0 coord[i].pop() coord[i].pop() sd.finish_drawing() if speed[i] == 0: speed.pop(i) speed.insert(i, random.randint(5, 30)) if len(coord[i]) == 0: length.pop(i) length.insert(i, random.randint(5, 10)) coord.remove([]) x = random.randint(10, 250) y = random.randint(300, 350) coord.insert(i, [x, y]) sd.sleep(0.1) if sd.user_want_exit(): break # sd.pause() # def main(): # snowfall(10) # main()
def snowfall(): x = [randint(100, 500) for i in range(20)] y = [randint(450, 600) for i in range(20)] length_list = [randint(5, 50) for i in range(20)] while True: sd.clear_screen() for i in range(20): point = sd.get_point(x[i], y[i]) sd.snowflake(center=point, length=length_list[i]) y[i] += (randint(5, 15) * -1) if y[i] < 0: break x[i] += randint(-15, 15) sd.sleep(0.1) if sd.user_want_exit(): break sd.sleep(0.1) if sd.user_want_exit(): break
def for_painting(length): x_list = [] y_list = [] N = 50 for x in range(0, N - 1): k = sd.random_number(0, 300) x_list.insert(x, k) for y in range(0, N - 1): k = sd.random_number(600, 800) y_list.insert(y, k) for i in range(N - 1): x = x_list[i] y = y_list[i] while True: sd.start_drawing() sd.snowflake(center=sd.get_point(x, y), length=length, color=sd.background_color) y -= 20 sd.snowflake(center=sd.get_point(x, y), length=length, color=sd.COLOR_WHITE) sd.sleep(0.005) if 0 <= i < N - 30: if y < 75: y = 70 break elif N - 30 <= i < N - 20: if y < 95: y = 90 break elif N - 20 <= i < N - 12: if y < 111: y = 110 break elif N - 12 <= i < N - 5: if y < 121: y = 120 break elif N - 5 <= i < N: if y < 141: y = 140 break sd.finish_drawing() if sd.user_want_exit(): break
def snowfall(): list = [] N = 20 for i in range(N): local = [sd.random_number(400, 600), sd.random_number(100, 300)] list.append(local) while True: #sd.clear_screen() lenght = sd.random_number(10, 70) for item in list: sd.start_drawing() point = sd.get_point(item[1], item[0]) sd.snowflake(center=point, length=lenght, color=sd.background_color) item[0] -= sd.random_number(-20, 50) if item[0] < 50: point = sd.get_point(item[1], item[0]) sd.snowflake(center=point, length=lenght, color=sd.COLOR_WHITE) item[1] = item[1] + sd.random_number(1, 50) point = sd.get_point(item[1], item[0]) sd.snowflake(center=point, length=lenght, color=sd.COLOR_WHITE) sd.finish_drawing() sd.sleep(0.01) if sd.user_want_exit(): break sd.pause() # подсказка! для ускорения отрисовки можно # - убрать clear_screen() # - в начале рисования всех снежинок вызвать sd.start_drawing() # - на старом месте снежинки отрисовать её же, но цветом sd.background_color # - сдвинуть снежинку # - отрисовать её цветом sd.COLOR_WHITE на новом месте # - после отрисовки всех снежинок, перед sleep(), вызвать sd.finish_drawing() # 4) Усложненное задание (делать по желанию) # - сделать рандомные отклонения вправо/влево при каждом шаге # - сделать сугоб внизу экрана - если снежинка долетает до низа, оставлять её там, # и добавлять новую снежинку # Результат решения см https://youtu.be/XBx0JtxHiLg #зачет!
def snowfall(): x_snow = [] y_snow = [] len_snow = [] coin_iteration = [] coin_snow = 10 # количество снежинок speed_snow = [] for i in range(coin_snow - 1): x_snow.insert(i, randint( 20, 600)) # первоначальное размещение снежинок вверху по горизонтали y_snow.insert(i, 830) # высота первоначального размещения снежинок len_snow.insert(i, randint(10, 30)) # длина лучей снежинки speed_snow.insert(i, randint( 1, 10)) # смещение снежинки вниз на каждом шаге coin_iteration.insert(i, 3) # количество падений каждой снежинки def snow_draw(x, y, len): # отрисовка снежинки point = sd.get_point(x, y) sd.snowflake(center=point, length=len) def snow_clear(x, y, len): # закрашивание снежинки point = sd.get_point(x, y) color_clear = sd.background_color sd.snowflake(center=point, length=len, color=color_clear) while True: for i in range(coin_snow - 1): snow_clear(x=x_snow[i], y=y_snow[i], len=len_snow[i]) # sd.sleep(0.1) if y_snow[i] <= 30: # высота на которой снежинка останавливается snow_draw(x=x_snow[i], y=y_snow[i], len=len_snow[i]) coin_iteration[i] -= 1 x_end, y_end, len_end = x_snow, y_snow, len_snow x_snow[i] = randint(20, 600) y_snow[i] = 830 len_snow[i] = randint(10, 30) speed_snow[i] = randint(1, 10) if coin_iteration[i] <= 0: speed_snow[i] = 0 x_snow, y_snow, len_snow = x_end, y_end, len_end y_snow[i] -= speed_snow[i] snow_draw(x=x_snow[i], y=y_snow[i], len=len_snow[i]) # sd.sleep (0.1) # print('coin_iteration - ', coin_iteration) # print('speed_snow - ', speed_snow) # print(set(speed_snow)) if sd.user_want_exit(): break if set(speed_snow) == {0}: sd.sleep(3) break
def show_figure2(): word = "skillbox" dist = 15 start_spell = sd.get_point(100, 250) sd.start_drawing() clear_screen() snakes = [] angle = 360 / len(word) for idx, ch in enumerate(word): scale_val = 0.3 figure = Figure() figure.radius = 0 figure.points = copy(segments[ch]['data']) figure.prepare_points() figure.scale([scale_val, scale_val, 1]) figure.origin = start_spell # figure.draw() start_spell = sd.get_point(x=start_spell.x + segments[ch]['width'] * scale_val + dist, y=start_spell.y) snake = Snake(figure) snake.color = sd.random_color() center = sd.get_point(400, 300) radius = 1000 x = sd.sin(angle * idx) * radius + center.x y = sd.cos(angle * idx) * radius + center.y snake.set_start_position([x, y]) snakes.append(snake) sd.sleep(0.1) sd.finish_drawing() dist = 15 for step in range(210): dist -= step / 500 sd.start_drawing() clear_screen() for snake in snakes: snake.go_forward(dist) snake.draw() sd.sleep(0.1) sd.finish_drawing() if sd.user_want_exit(): break
def run(self): while True: for flake in self.flakes: if not flake.skip: flake.clear_previous_picture() flake.move(flake.delta_x, flake.delta_y) flake.draw() fallen_flakes = self.get_fallen_flakes() if fallen_flakes: self.generate_flakes(count=fallen_flakes) self.level += fallen_flakes / 5 sd.sleep(0.1) if sd.user_want_exit(): break
def draw_branches(start_point, angle, length, n, alfa): if length < 15: return for x, alfa in zip(range(n), range(-30, 31, 60)): vector = sd.get_vector(start_point=start_point, angle=angle + alfa, length=length, width=3) color = random.randint(1, 7) vector.draw(color=color_tuple[color]) coefficient = random.uniform(.75 * .8, .75 * 1.2) draw_branches(vector.end_point, angle + alfa, length * coefficient, n, alfa) if sd.user_want_exit(): break
def snowfall(n): flakes = [Snowflake() for _ in range(n)] while True: sd.start_drawing() for flake in flakes: flake.draw_snow(color=sd.background_color) if not flake.move(): flakes.append(Snowflake()) flake.save_low_snow(color=sd.COLOR_WHITE) flakes.remove(flake) flake.draw_snow(color=sd.COLOR_WHITE) sd.finish_drawing() sd.sleep(0.1) if sd.user_want_exit(sleep_time=0.1): break
def snowfall(N): flakes = [Snowflake() for _ in range(N)] while True: sd.start_drawing() for flake in flakes: flake.draw_snow(color=sd.background_color) if not flake.move(): flakes.insert(0, Snowflake()) flake.save_low_snow(color=sd.COLOR_WHITE) flakes.remove(flake) flake.draw_snow(color=sd.COLOR_WHITE) print(len(flakes)) # просто для теста чтобы понять что список бесконечно не растет sd.finish_drawing() sd.sleep(0.1) if sd.user_want_exit(sleep_time=0.1): break
def snowflake(x, y): a = 1 while True: sd.clear_screen() for i in range(len(x)): point = sd.get_point(x[i],y[i]) sd.snowflake(center=point, length=50, color='white') h = sd.randint(0, 20) y[i] -= h if y[i] < 50: break a = sd.randint(-1,1) x[i] = x[i] + h*a sd.sleep(0.05) if sd.user_want_exit(): break
def draw_snowfall(count=999, start_point=50, end_point=200, earth=100): snowfall_points_tuple = [] for i in range(count): snowfall_points_tuple.append( sd.get_point(sd.random_point().x, sd.resolution[1])) for _ in range(count): while True: if sd.user_want_exit(): break sd.snowflake(snowfall_points_tuple[_], 15) if snowfall_points_tuple[_].y < earth: break sd.snowflake(snowfall_points_tuple[_], 15, sd.background_color) snowfall_points_tuple[_].y -= 10
def snowflakes(): N = 200 y_list = [] x_list = [] length_list = [] for _ in range(N): x_list.append(sd.random_number(0, 1200)) y_list.append(sd.random_number(5, 30)) length_list.append(sd.random_number(5, 20)) for i, y in enumerate(x_list): point = sd.get_point(x_list[i], y_list[i]) sd.snowflake(center=point, length=length_list[i]) if sd.user_want_exit(): break
def go_go(_sleep): sd.take_background() cloud_length = 160 while True: x = -500 coordinates = [] for _ in range(N): coordinates.append([sd.random_number(x-50, x+cloud_length), sd.random_number(660, 670), sd.random_number(10, 50)]) while x < sd.resolution[0]+cloud_length*3: if x == -152: sd.draw_background() sad_smile(x=480, y=125, color=sd.COLOR_DARK_ORANGE) sd.take_background() if x == sd.resolution[0] + cloud_length*1.5: sd.draw_background() smile(x=480, y=125, color=sd.COLOR_YELLOW) sd.take_background() coordinates.append([sd.random_number(x-50, x+cloud_length), sd.random_number(660, 670), sd.random_number(10, 30)]) sd.start_drawing() sd.draw_background() _delta = sd.random_number(10, 45) x += 4 sun(_delta=_delta) if x % 10 == 0: rainbow(rainbow_colors[0]) else: rainbow(rainbow_colors[1]) cloud(_x=x) for i, item in enumerate(coordinates): point = sd.get_point(item[0], item[1]) sd.snowflake(center=point, length=item[2]) if item[1] < 10: del coordinates[i] if i != 0: i -= 1 coordinates.append([sd.random_number(x-50, x + cloud_length), sd.random_number(660, 670), sd.random_number(10, 30)]) item[1] -= sd.random_number(10, 20) item[0] += sd.random_number(-5, 5) sd.finish_drawing() sd.sleep(_sleep) if sd.user_want_exit(): break