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 smile(coordinate_x, coordinate_y, color): point = sd.get_point(coordinate_x, coordinate_y) sd.circle(center_position=point, radius=100, color=sd.COLOR_YELLOW, width=0) point = sd.get_point(coordinate_x, coordinate_y) sd.circle(center_position=point, radius=100, color=sd.COLOR_BLACK, width=2) point = sd.get_point(coordinate_x - 35, coordinate_y + 35) sd.circle(center_position=point, radius=15, color=color, width=5) point = sd.get_point(coordinate_x + 35, coordinate_y + 35) sd.circle(center_position=point, radius=15, color=color, width=5) point = sd.get_point(coordinate_x - 35, coordinate_y + 35) sd.circle(center_position=point, radius=12, color=sd.COLOR_WHITE, width=0) point = sd.get_point(coordinate_x + 35, coordinate_y + 35) sd.circle(center_position=point, radius=12, color=sd.COLOR_WHITE, width=0) point = sd.get_point(coordinate_x + 35, coordinate_y + 35) sd.circle(center_position=point, radius=10, color=sd.COLOR_BLACK, width=0) point = sd.get_point(coordinate_x - 31, coordinate_y + 35) sd.circle(center_position=point, radius=10, color=sd.COLOR_BLACK, width=0) point = [ sd.get_point(coordinate_x + -5, coordinate_y + 32), sd.get_point(coordinate_x - 25, coordinate_y - 15), sd.get_point(coordinate_x + 2, coordinate_y - 15) ] sd.lines(point_list=point, color=color, closed=False, width=3) point = [ sd.get_point(coordinate_x + -2, coordinate_y - 55), sd.get_point(coordinate_x - +35, coordinate_y - 50) ] sd.lines(point_list=point, color=color, closed=False, width=3)
def printSmileRandom(): for _ in range(100): colorSmile = simple_draw.random_color() pointSmile = simple_draw.random_point() radiusSmile = 66 startPointX = pointSmile.x startPointY = pointSmile.y eyeLeft = simple_draw.get_point(startPointX - 20, startPointY + 20) eyeRight = simple_draw.get_point(startPointX + 20, startPointY + 20) eyeRadius = 6 lipCornerLeft = simple_draw.get_point(startPointX - 20, startPointY - 20) lipCornerRight = simple_draw.get_point(startPointX + 20, startPointY - 20) lipCornerCenter = simple_draw.get_point(startPointX, startPointY - 40) simple_draw.circle(pointSmile, radiusSmile, colorSmile, 2) simple_draw.circle(eyeLeft, eyeRadius, colorSmile, 2) simple_draw.circle(eyeRight, eyeRadius, colorSmile, 2) simple_draw.lines((lipCornerLeft, lipCornerCenter, lipCornerRight), colorSmile, True, 2)
def smile(point_x, point_y, color): x = point_x y = point_y color = color point = sd.get_point(x, y) sd.circle(center_position=point, color=color) x_1 = x - 25 y_1 = y + 20 point_1 = sd.get_point(x_1, y_1) sd.circle(center_position=point_1, radius=5, width=0, color=color) x_2 = x + 25 y_2 = y + 20 point_2 = sd.get_point(x_2, y_2) sd.circle(center_position=point_2, radius=5, width=0, color=color) x_3 = x - 35 y_3 = y - 20 point_3 = sd.get_point(x_3, y_3) x_4 = x - 15 y_4 = y - 30 point_4 = sd.get_point(x_4, y_4) x_5 = x + 15 y_5 = y - 30 point_5 = sd.get_point(x_5, y_5) x_6 = x + 25 y_6 = y - 20 point_6 = sd.get_point(x_6, y_6) point_list = [point_3, point_4, point_5, point_6] sd.lines(point_list=point_list, color=color)
def paint_smile(x, y, radius_for_two_eye, color=sd.COLOR_YELLOW): central_point_head = sd.get_point(x, y) central_point_eye_1 = sd.get_point(x - 20, y + 25) central_point_eye_2 = sd.get_point(x + 20, y + 25) point_smile_1 = sd.get_point(x - 40, y - 20) point_smile_2 = sd.get_point(x - 35, y - 25) point_smile_3 = sd.get_point(x + 35, y - 25) point_smile_4 = sd.get_point(x + 40, y - 20) sd.lines((point_smile_1, point_smile_2, point_smile_3, point_smile_4), color, False, 4) sd.circle(central_point_head, 60, color, 4) sd.circle(center_position=central_point_eye_1, radius=12, color=sd.COLOR_BLUE, width=0) sd.circle(center_position=central_point_eye_2, radius=12, color=sd.COLOR_BLUE, width=0) radius_for_two_eye %= 12 sd.circle(center_position=central_point_eye_1, radius=radius_for_two_eye, color=color, width=0) sd.circle(center_position=central_point_eye_2, radius=radius_for_two_eye, color=color, width=0)
def smile(x, y, color): radius = 30 _point = sd.get_point(x=x, y=y) sd.circle(center_position=_point, radius=radius, width=3, color=sd.COLOR_BLACK) sd.circle(center_position=_point, radius=radius - 2, width=0, color=color) left_point = sd.get_point(x=x - radius // 3, y=y + radius // 3) right_point = sd.get_point(x=x - radius // 5, y=y + 2 * radius // 3) sd.ellipse(left_bottom=left_point, right_top=right_point, color=sd.COLOR_BLACK) left_point = sd.get_point(x=x + radius // 5, y=y + radius // 3) right_point = sd.get_point(x=x + radius // 3, y=y + 2 * radius // 3) sd.ellipse(left_bottom=left_point, right_top=right_point, color=sd.COLOR_BLACK) mouth = [ sd.Point(x=x - radius // 2, y=y - radius // 3), sd.Point(x=x - radius // 4, y=y - radius // 2), sd.Point(x=x + radius // 4, y=y - radius // 2), sd.Point(x=x + radius // 2, y=y - radius // 3), ] sd.lines(point_list=mouth, width=3, color=sd.COLOR_BLACK)
def smile(x, y): radius = 20 radius_eyes = 2 point = sd.get_point(x, y) sd.circle(center_position=point, radius=radius, color=sd.COLOR_YELLOW) y_eyes = y + 6 x_r_eye = x + 5 x_l_eye = x - 5 point_r_eye = sd.get_point(x_r_eye, y_eyes) point_l_eye = sd.get_point(x_l_eye, y_eyes) sd.circle(center_position=point_r_eye, radius=radius_eyes, color=sd.COLOR_YELLOW) sd.circle(center_position=point_l_eye, radius=radius_eyes, color=sd.COLOR_YELLOW) x1_mouth = x - 6 y1_mouth = y - 3 x2_mouth = x y2_mouth = y - 7 x3_mouth = x + 6 y3_mouth = y - 3 point_mouth = [ sd.get_point(x1_mouth, y1_mouth), sd.get_point(x2_mouth, y2_mouth), sd.get_point(x3_mouth, y3_mouth) ] sd.lines(point_mouth, color=sd.COLOR_YELLOW)
def smile(color, x, y): point = sd.get_point(x, y) line_x = x line_y = y x -= 25 y += 15 point1 = sd.get_point(x, y) x += 50 point2 = sd.get_point(x, y) sd.circle(center_position=point, color=color, radius=50) sd.circle(center_position=point1, radius=10, color=color) sd.circle(center_position=point2, radius=10, color=color) line_x -= 25 line_y -= 15 line1 = sd.get_point(line_x, line_y) line_x += 15 line_y -= 15 line2 = sd.get_point(line_x, line_y) line_x += 20 line3 = sd.get_point(line_x, line_y) line_x += 15 line_y += 15 line4 = sd.get_point(line_x, line_y) sd.lines(point_list=(line1, line2, line3, line4), color=color)
def draw_smiles(x, y, color): sd.circle(center_position=sd.get_point(x, y), radius=50, width=2, color=color) sd.circle(center_position=sd.get_point(x - 20, y + 20), radius=10, width=2, color=color) sd.circle(center_position=sd.get_point(x + 20, y + 20), radius=7, width=2, color=color) mouth = [sd.get_point(x - 20, y - 10), sd.get_point(x - 10, y - 20), sd.get_point(x + 10, y - 20), sd.get_point(x + 20, y - 10)] sd.lines(point_list=mouth, width=2, color=color)
def draw_smile(x, y, color): point_left = sd.get_point(x - 120, y - 100) point_right = sd.get_point(x, y) sd.ellipse(point_left, point_right, color) circle_point = sd.get_point(x - 35, y - 35) sd.circle(circle_point, 8, sd.invert_color(color)) circle_point = sd.get_point(x - 85, y - 35) sd.circle(circle_point, 8, sd.invert_color(color)) points = [ sd.get_point(x - 85, y - 65), sd.get_point(x - 80, y - 70), sd.get_point(x - 75, y - 72), sd.get_point(x - 65, y - 74), sd.get_point(x - 61, y - 74), sd.get_point(x - 57, y - 74), sd.get_point(x - 47, y - 72), sd.get_point(x - 42, y - 70), sd.get_point(x - 37, y - 65), sd.get_point(x - 42, y - 75), sd.get_point(x - 47, y - 79), sd.get_point(x - 50, y - 81), sd.get_point(x - 57, y - 82), sd.get_point(x - 61, y - 82), sd.get_point(x - 65, y - 82), sd.get_point(x - 72, y - 80), sd.get_point(x - 75, y - 78), sd.get_point(x - 80, y - 75), sd.get_point(x - 85, y - 65), ] sd.lines(points, sd.invert_color(color))
def smile(x, y, color, radius): offset_lips = (30, 10) offset_eye = (20, 10) point_center = sd.get_point(x, y) sd.circle(center_position=point_center, radius=radius, color=color, width=5) point_left_eye = sd.get_point(point_center.x - offset_eye[0], point_center.y + offset_eye[1]) sd.circle(center_position=point_left_eye, radius=5, color=color) point_right_eye = sd.get_point(point_center.x + offset_eye[0], point_center.y + offset_eye[1]) sd.circle(center_position=point_right_eye, radius=5, color=color) point1 = sd.get_point(point_center.x - offset_lips[0], point_center.y) point2 = sd.get_point(point_center.x - offset_lips[1], point_center.y - offset_lips[1]) point3 = sd.get_point(point_center.x + offset_lips[1], point_center.y - offset_lips[1]) point4 = sd.get_point(point_center.x + offset_lips[0], point_center.y) smile_point_list = [point1, point2, point3, point4] sd.lines(point_list=smile_point_list, color=color, closed=False, width=3)
def first_screen(): points = [ sd.Point(x=230, y=450), sd.Point(x=240, y=460), sd.Point(x=230, y=470), sd.Point(x=240, y=480), ] sd.polygon(point_list=points) points2 = [sd.Point(p.x + 20, p.y + 20) for p in points] sd.lines(point_list=points2, color=sd.COLOR_DARK_ORANGE, width=2) sd.line(start_point=sd.Point(x=20, y=20), end_point=sd.Point(x=40, y=300), width=2) sd.square(left_bottom=sd.Point( 400, 300, ), side=100, width=2) sd.rectangle( left_bottom=sd.Point(x=200, y=200), right_top=sd.Point(x=300, y=300), color=sd.COLOR_DARK_GREEN, width=2, ) sd.rectangle( left_bottom=sd.Point(x=400, y=300), right_top=sd.Point(x=300, y=400), color=sd.COLOR_DARK_GREEN, width=2, ) if TAKE_SNAPSHOTS: sd.take_snapshot(path=SNAPSHOTS_PATH)
def block(start_x=0, start_y=0, width=100, high=50, step=1): start_x *= width * step start_y *= high a = sd.get_point(start_x, start_y) b = sd.get_point(start_x, start_y + high) c = sd.get_point(start_x + width, start_y + high) d = sd.get_point(start_x + width, start_y) sd.lines([a, b, c, d], color=sd.random_color())
def smile(coordinates, color): sd.circle(center_position=coordinates, radius=50, color=color, width=0) left_eye = sd.get_point(x - 20, y + 12) sd.circle(center_position=left_eye, radius=9, color=sd.COLOR_BLACK, width=0) right_eye = sd.get_point(x + 20, y + 12) sd.circle(center_position=right_eye, radius=9, color=sd.COLOR_BLACK, width=0) mouth_points = (sd.get_point(x - 25,y - 12), sd.get_point(x - 15, y - 18), sd.get_point(x - 11, y - 20), sd.get_point(x + 11, y - 20),sd.get_point(x + 15, y - 18), sd.get_point(x + 25, y - 12)) sd.lines(point_list=mouth_points,color=sd.COLOR_BLACK, width=3)
def sleeve(start_point, angle, angle2, length, width, color1, color2): # для наглядности http://joxi.ru/krDajB4IJ8Qkgm angle_rad = math.radians(angle) angle2_rad = math.radians(angle2) real_start = sd.get_point(start_point.x + width / 2 * math.sin(angle_rad), start_point.y - width / 2 * math.cos(angle_rad)) joint_center = sd.get_point(start_point.x + length * math.cos(angle_rad), start_point.y + length * math.sin(angle_rad)) a1_point = start_point a_point = sd.get_point(real_start.x - width * math.sin(angle_rad), real_start.y + width * math.cos(angle_rad)) # пересчет точки B в зависимости от угла сгиба руки if angle2 - angle > 10: angle_b = angle + (angle2 - angle) / 10 angle_b_rad = math.radians(angle_b) b_point = sd.get_point(a_point.x + length / 2 * math.cos(angle_b_rad), a_point.y + length / 2 * math.sin(angle_b_rad)) else: b_point = sd.get_point(a_point.x + length / 2 * math.cos(angle_rad), a_point.y + length / 2 * math.sin(angle_rad)) d_point = sd.get_point(joint_center.x - width / 2 * math.sin(angle2_rad) + length * math.cos(angle2_rad), joint_center.y + width / 2 * math.cos(angle2_rad) + length * math.sin(angle2_rad)) e_point = sd.get_point(d_point.x + width * math.sin(angle2_rad), d_point.y - width * math.cos(angle2_rad)) g_point = real_start # пересчет точки C в зависимости от угла сгиба руки if angle2 - angle > 2: angle_c = angle - (angle2 - angle) / 5 angle_c_rad = math.radians(angle_c) c1_point = sd.get_point(b_point.x + length / 2 * math.cos(angle_c_rad), b_point.y + length / 2 * math.sin(angle_c_rad)) else: c1_point = sd.get_point(b_point.x + length / 2 * math.cos(angle_rad), b_point.y + length / 2 * math.sin(angle_rad)) c2_point = sd.get_point(d_point.x - length * math.cos(angle2_rad), d_point.y - length * math.sin(angle2_rad)) if angle2 == 0: c_point = c1_point elif angle2 == 90: c_point = c2_point else: c_points = joint_point(b_point, c1_point, d_point, c2_point) c_point = sd.get_point(c_points[0], c_points[1]) f1_point = sd.get_point(e_point.x - length * math.cos(angle2_rad), e_point.y - length * math.sin(angle2_rad)) f2_point = sd.get_point(real_start.x + length * math.cos(angle_rad), real_start.y + length * math.sin(angle_rad)) if angle2 == 0: f_point = f1_point elif 89 < angle < 90: f_point = f1_point else: f_points = joint_point(e_point, f1_point, g_point, f2_point) f_point = sd.get_point(f_points[0], f_points[1]) contur = (a1_point, a_point, b_point, c_point, d_point, e_point, f_point, g_point) sd.polygon(contur, color=color1, width=0) sd.lines(contur, color=color2, closed=True, width=2)
def smile(x, y, color): mouth_point_list = [sd.get_point(x-25, y), sd.get_point(x-7, y-15), sd.get_point(x+7, y-15), sd.get_point(x+25, y)] left_bottom_point = sd.get_point(x-35, y-30) right_top_point = sd.get_point(x+35, y+30) sd.ellipse(left_bottom=left_bottom_point, right_top=right_top_point, color=color, width=2) sd.lines(point_list=mouth_point_list, color=sd.COLOR_ORANGE, closed=False, width=2) left_eye_point =sd.get_point(x-15, y+5) right_eye_point= sd.get_point(x+15,y+5) sd.circle(center_position=left_eye_point, radius=3, color=sd.COLOR_YELLOW,width=0) sd.circle(center_position=right_eye_point, radius=3, color=sd.COLOR_YELLOW, width=0)
def window_and_roof(): points_for_roof = [ sd.Point(350, 250), sd.Point(750, 250), sd.Point(550, 330) ] sd.lines(points_for_roof, width=0, closed=True) sd.rectangle(sd.Point(500, 110), sd.Point(600, 210), width=0) sd.polygon(points_for_roof, color=sd.COLOR_RED, width=0) sd.square(sd.Point(500, 110), 100, color=sd.COLOR_BLACK, width=4)
def bone(start_point, angle, length, width, color1=sd.background_color, color2=sd.background_color): angle_rad = math.radians(angle) real_start = sd.get_point(start_point.x + width / 2 * math.sin(angle_rad), start_point.y - width / 2 * math.cos(angle_rad)) contur = (start_point, real_start, sd.get_point(real_start.x + length * math.cos(angle_rad), real_start.y + length * math.sin(angle_rad)), sd.get_point(real_start.x - width * math.sin(angle_rad) + length * math.cos(angle_rad), real_start.y + width * math.cos(angle_rad) + length * math.sin(angle_rad)), sd.get_point(real_start.x - width * math.sin(angle_rad), real_start.y + width * math.cos(angle_rad)) ) sd.polygon(contur, color=color1, width=0) sd.lines(contur, color=color2, closed=True, width=2)
def smile(x, y, color): point = sd.get_point(x, y) sd.circle(point, radius=50, color=color, width=1) left_eye = sd.get_point(x - 20, y + 20) right_eye = sd.get_point(x + 20, y + 20) sd.circle(left_eye, radius=5, color=color, width=1) sd.circle(right_eye, radius=5, color=color, width=1) mouth = (sd.get_point(x - 20, y - 10), sd.get_point(x, y), sd.get_point(x + 20, y - 10)) sd.lines(point_list=mouth, color=color, closed=False, width=1)
def draw_face(x, y, color): left_point = sd.get_point(x, y) right_point = sd.get_point(x + 150, y + 120) sd.ellipse(left_point, right_point, color, 2) sd.circle(sd.get_point(x + 40, y + 70), 10, color, 2) sd.circle(sd.get_point(x + 110, y + 70), 10, color, 2) points = [ sd.get_point(x + 30, y + 40), sd.get_point(x + 60, y + 30), sd.get_point(x + 90, y + 30), sd.get_point(x + 120, y + 40) ] sd.lines(points, color)
def smile(position_x=300, position_y=300, radius=50, color=sd.COLOR_GREEN): ''' Функция отрисовки смайлика ''' if radius < 10: radius = 10 center = sd.get_point(position_x, position_y) mesh_size = radius//10 right_eye_bottom = sd.get_point( position_x - mesh_size * 5, position_y + mesh_size * 2) right_eye_top = sd.get_point( position_x - mesh_size * 3, position_y + mesh_size * 6) right_eye_center = sd.get_point( position_x - mesh_size * 4, position_y + mesh_size * 4) left_eye_bottom = sd.get_point( position_x + mesh_size * 3, position_y + mesh_size * 2) left_eye_top = sd.get_point( position_x + mesh_size * 5, position_y + mesh_size * 6) left_eye_center = sd.get_point( position_x + mesh_size * 4, position_y + mesh_size * 4) eye_apple_radius = radius // 20 if radius // 20 > 0 else 1 mouth = [ sd.get_point( position_x - mesh_size * 6, position_y - mesh_size * 4), sd.get_point( position_x - mesh_size * 4, position_y - mesh_size * 5), sd.get_point( position_x - mesh_size * 2, position_y - mesh_size * 6), sd.get_point( position_x + mesh_size * 2, position_y - mesh_size * 6), sd.get_point( position_x + mesh_size * 4, position_y - mesh_size * 5), sd.get_point( position_x + mesh_size * 6, position_y - mesh_size * 4), ] sd.circle(center_position=center, radius=radius, color=color) sd.ellipse(left_bottom=right_eye_bottom, right_top=right_eye_top, color=color, width=1) sd.circle(center_position=right_eye_center, radius=eye_apple_radius, color=color, width=0) sd.ellipse(left_bottom=left_eye_bottom, right_top=left_eye_top, color=color, width=1) sd.circle(center_position=left_eye_center, radius=eye_apple_radius, color=color, width=0) sd.lines(point_list=mouth, color=color, closed=True)
def smile(x_coord, y_coord, color): point_main = sd.get_point(x_coord, y_coord) radius_main = 50 point_1 = sd.get_point(x_coord - 20, y_coord + 20) radius_1 = 5 point_2 = sd.get_point(x_coord + 20, y_coord + 20) p1 = sd.get_point(x_coord - 25, y_coord - 20) p2 = sd.get_point(x_coord - 10, y_coord - 25) p3 = sd.get_point(x_coord + 10, y_coord - 25) p4 = sd.get_point(x_coord + 25, y_coord - 20) lines = p1, p2, p3, p4 sd.circle(center_position=point_main, radius=radius_main, color=color) sd.circle(center_position=point_1, radius=radius_1, color=color) sd.circle(center_position=point_2, radius=radius_1, color=color) sd.lines(point_list=lines, color=color, closed=False, width=1)
def smile(cord_x, cord_y, color): point_x = sd.get_point(cord_x + 10, cord_y + 50) point_y = sd.get_point(cord_x + 150, cord_y + 150) sd.ellipse(left_bottom=point_x, right_top=point_y, color=color, width=2) for x in range(55, 110, 50): point = sd.get_point(cord_x + x, cord_y + 125) sd.circle(center_position=point, radius=6, color=color, width=1) x = sd.get_point(cord_x + 40, cord_y + 85) y = sd.get_point(cord_x + 60, cord_y + 70) z = sd.get_point(cord_x + 100, cord_y + 70) z_1 = sd.get_point(cord_x + 120, cord_y + 85) point_list = (x, y, z, z_1) sd.lines(point_list=point_list, color=color, closed=False, width=3)
def ulibka(x, y, color): x3 = x - 50 y3 = y - 10 x4 = x - 25 y4 = y - 25 x5 = x + 25 y5 = y - 25 x6 = x + 50 y6 = y - 10 point3 = sd.Point(x3, y3) point4 = sd.Point(x4, y4) point5 = sd.Point(x5, y5) point6 = sd.Point(x6, y6) point_list = (point3, point4, point5, point6) sd.lines(point_list, color, False, 2)
def smile(x, y, color): point = sd.get_point(x, y) coord_1_eye = sd.get_point(x - 30, y) coord_2_eye = sd.get_point(x - 10, y + 20) coord_3_eye = sd.get_point(x + 10, y) coord_4_eye = sd.get_point(x + 30, y + 20) face = sd.circle(point, color=color, width=4) eye1 = sd.ellipse(coord_1_eye, coord_2_eye, color=color) eye2 = sd.ellipse(coord_3_eye, coord_4_eye, color=color) s1 = sd.get_point(x - 25, y - 20) s2 = sd.get_point(x - 10, y - 35) s3 = sd.get_point(x + 10, y - 35) s4 = sd.get_point(x + 25, y - 20) smile_list = [s1, s2, s3, s4] sd.lines(point_list=smile_list, width=4, color=color)
def smile(coordinates, color): sd.circle(center_position=coordinates, radius=100, color=color, width=0) left_eye = sd.get_point(x - 40, y + 25) sd.circle(center_position=left_eye, radius=18, color=sd.COLOR_BLACK, width=6) right_eye = sd.get_point(x + 40, y + 25) sd.circle(center_position=right_eye, radius=18, color=sd.COLOR_BLACK, width=6) mouth_points = (sd.get_point(x - 40, y - 25), sd.get_point(x - 25, y - 35), sd.get_point(x - 11, y - 40), sd.get_point(x + 11, y - 40), sd.get_point(x + 25, y - 35), sd.get_point(x + 40, y - 25)) sd.lines(point_list=mouth_points, color=sd.COLOR_BLACK, width=4)
def smile(x=sd.randint(0, 1200), y=sd.randint(0, 600), color=sd.random_color()): smile_cencer = sd.get_point(x, y) left_bottom = sd.get_point(x - 100, y - 75) right_top = sd.get_point(x + 100, y + 75) sd.ellipse(left_bottom, right_top, width=1, color=color) left_eye_center = sd.get_point(x - 40, y + 25) sd.circle(left_eye_center, 20, color=color) right_eye_center = sd.get_point(x + 40, y + 25) sd.circle(right_eye_center, 25, color=color) point_1 = sd.get_point(x - 50, y - 25) point_2 = sd.get_point(x - 25, y - 35) point_3 = sd.get_point(x + 25, y - 35) point_4 = sd.get_point(x + 50, y - 25) point_list = [point_1, point_2, point_3, point_4] sd.lines(point_list, color=color)
def smile(_x, _y, color): """Функция рисуюет смайл""" center_position = sd.Point(_x, _y) center_position_left_eye = sd.Point(_x - 15, _y + 15) center_position_right_eye = sd.Point(_x + 15, _y + 15) first_dot_smile = sd.Point(_x - 25, _y - 10) second_dot_smile = sd.Point(_x - 5, _y - 20) third_dot_smile = sd.Point(_x + 5, _y - 20) four_dot_smile = sd.Point(_x + 25, _y - 10) point_list = [first_dot_smile, second_dot_smile, third_dot_smile, four_dot_smile] radius = 50 radius_eye = 5 sd.circle(center_position=center_position, radius=radius, color=color, width=4) sd.circle(center_position=center_position_left_eye, radius=radius_eye, color=color, width=3) sd.circle(center_position=center_position_right_eye, radius=radius_eye, color=color, width=3) sd.lines(point_list=point_list, color=color, width=3)
def chel(x_coord=1100, y_coord=230, color=sd.COLOR_DARK_YELLOW): left_leg = sd.get_point(1050, 80) right_leg = sd.get_point(1150, 80) body_low = sd.get_point(1100, 130) body_top = sd.get_point(1100, 180) body_hands = sd.get_point(1100, 165) left_hand = sd.get_point(1150, 130) right_hand = sd.get_point(1050, 130) point_main = sd.get_point(x_coord, y_coord) radius_main = 50 point_1 = sd.get_point(x_coord - 20, y_coord + 20) radius_1 = 5 point_2 = sd.get_point(x_coord + 20, y_coord + 20) p1 = sd.get_point(x_coord - 25, y_coord - 20) p2 = sd.get_point(x_coord - 10, y_coord - 25) p3 = sd.get_point(x_coord + 10, y_coord - 25) p4 = sd.get_point(x_coord + 25, y_coord - 20) lines = p1, p2, p3, p4 sd.circle(center_position=point_main, radius=radius_main, color=color) sd.circle(center_position=point_1, radius=radius_1, color=color) sd.circle(center_position=point_2, radius=radius_1, color=color) sd.lines(point_list=lines, color=color, closed=False, width=1) sd.line(start_point=left_leg, end_point=body_low, color=sd.COLOR_DARK_YELLOW, width=1) # Левая нога sd.line(start_point=right_leg, end_point=body_low, color=sd.COLOR_DARK_YELLOW, width=1) # Правая нога sd.line(start_point=body_low, end_point=body_top, color=sd.COLOR_DARK_YELLOW, width=1) # Тело sd.line(start_point=body_hands, end_point=left_hand, color=sd.COLOR_DARK_YELLOW, width=1) # Левая рука sd.line(start_point=body_hands, end_point=right_hand, color=sd.COLOR_DARK_YELLOW, width=1) # Правая рука
def smiley(x, y, new_colour): import simple_draw as sd point = sd.get_point(x, y) point_left_eye = sd.get_point(x - 15, y + 12) point_right_eye = sd.get_point(x + 15, y + 12) sd.circle(point, radius=50, color=new_colour, width=1) #круг sd.circle(point_left_eye, radius=3, color=new_colour, width=2) #левый глаз sd.circle(point_right_eye, radius=3, color=new_colour, width=2) #правый глаз point_mouth_1 = sd.get_point(x - 17, y - 15) point_mouth_2 = sd.get_point(x - 2, y - 20) point_mouth_3 = sd.get_point(x + 2, y - 20) point_mouth_4 = sd.get_point(x + 17, y - 15) list_point = [point_mouth_1, point_mouth_2, point_mouth_3, point_mouth_4] sd.lines(point_list=list_point, color=sd.COLOR_YELLOW, closed=False, width=1)
def smile(cord_1, cord_2, color): cord_x, cord_y = 440, 40 point_x = sd.get_point(cord_x + 30, cord_y + 50) point_y = sd.get_point(cord_x + 125, cord_y + 125) sd.ellipse(left_bottom=point_x, right_top=point_y, color=color, width=2) for x in range(55, 110, 30): point = sd.get_point(cord_x + x, cord_y + 100) sd.circle(center_position=point, radius=2, color=color, width=1) x = sd.get_point(cord_x + 40, cord_y + 85) y = sd.get_point(cord_x + 60, cord_y + 70) z = sd.get_point(cord_x + 90, cord_y + 70) z_1 = sd.get_point(cord_x + 110, cord_y + 85) point_list = (x, y, z, z_1) sd.lines(point_list=point_list, color=color, width=3)