Пример #1
0
def design_06():
    sg.set_pen_style('NoPen')
    sg.set_brush_style('SolidPattern')
    sg.set_brush_color(0,0,0)
    num = 8
    for i in range(num):
        # draw the 3 leaf grass
        sg.save_stat()
        sg.translate_origin(0,120)
        sg.draw_ellipse(0,25,10,50)
        sg.rotate_origin(-20)
        sg.draw_ellipse(0,25,10,50)
        sg.rotate_origin(40)
        sg.draw_ellipse(0,25,10,50)
        sg.restore_stat()
        # rotate
        sg.rotate_origin(360/num)
    sg.set_brush_style('NoBrush')
    sg.set_pen_style('SolidLine')
    sg.set_pen_width(2)
    sg.rotate_origin(360/num/2)
    for i in range(num):
        sg.draw_rect_with_rot(0,110,65,65,45)
        sg.draw_rect_with_rot(0,100,65,65,45)
        sg.rotate_origin(360/num)
Пример #2
0
    sg.set_brush_gradient_color_at(0.4, 255, 73, 167)


sg.create_canvas(w, h)

# fill the background with gradent color
set_gradient()
sg.draw_rect(w / 2, h / 2, w, h)

# bg layer 2
sg.set_pen_color(255, 255, 255, 50)
layer_lines()
random_circles()

# draw the squares
sg.translate_origin(w / 2, h / 2)
set_gradient_for_squares()
sg.set_pen_width(0)
sg.rotate_origin(45)

for m in range(-20, 21):
    for n in range(-20, 21):
        x = m * box_dist
        y = n * box_dist
        d = distance(x, y, 0, 0)
        nsize = fit_range(d, 0, 500, 50, 0)
        sg.set_brush_style_linear_gradient(x - 40, y - 40, x + 40, y + 40, 255,
                                           255, 255, 255, 0, 0)
        sg.draw_rounded_rect(x, y, nsize * 2, nsize * 2, 10, 10)
sg.reset_origin()
Пример #3
0
    sg.set_pen_style('SolidLine')
    sg.set_pen_width(2)
    sg.rotate_origin(360/num/2)
    for i in range(num):
        sg.draw_rect_with_rot(0,110,65,65,45)
        sg.draw_rect_with_rot(0,100,65,65,45)
        sg.rotate_origin(360/num)
    
# set variables
w = 1100
h = 1100

# create the canvas
sg.create_canvas(w,h)

sg.translate_origin(w/2,h/2)
design_01()

sg.reset_origin()
sg.translate_origin(w/2,h/2)
design_02()

sg.reset_origin()
sg.translate_origin(w/2,h/2)
design_03()

sg.reset_origin()
sg.translate_origin(w/2,h/2)
design_04()

sg.reset_origin()
Пример #4
0
    sg.set_pen_width(10)
    sg.draw_point(x - 25, y - 5)
    sg.draw_point(x + 25, y - 5)

    # nose
    sg.set_pen_color(0, 0, 0, 0)
    sg.set_brush_color(0, 0, 0)
    sg.draw_ellipse(x, y - 15, 20, 15)

    # mouth
    sg.set_pen_color(0, 0, 0)
    sg.set_pen_width(2)
    sg.draw_line(x, y - 20, x, y - 40)
    sg.draw_elliptical_arc(x, y - 30, 20, 10, 180, 180)


sg.create_canvas(w, h)
sg.fill_canvas(200, 200, 200)

for i in range(5):
    for j in range(3):
        x = i * 200 + 100
        y = j * 200 + 100
        sg.reset_origin()
        sg.translate_origin(x, y)
        sg.rotate_origin(random.uniform(-30, 30))
        sc = random.uniform(0.5, 1)
        sg.scale_origin(sc)
        draw_panda(0, 0)

sg.show_canvas()