-
Notifications
You must be signed in to change notification settings - Fork 0
/
patternC.py
65 lines (58 loc) · 2.81 KB
/
patternC.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
Anaelisa Aburto
Quilt Project
Pattern C
"""
import turtle
def patternC(patPosX, patPosY, sq_size, t):
##############################################################################################
#--------------------------------------- SET UP ---------------------------------------------#
##############################################################################################
# Change color value format to RGB 0-255
turtle.colormode(255)
# Pen draw size
t.width(2)
##############################################################################################
#------------------------------------- MOVE FUNCTION ----------------------------------------#
##############################################################################################
# To move without drawing
def move(positionX,positionY,t):
t.pu()
t.setpos(patPosX+positionX,patPosY+positionY)
t.pd()
##############################################################################################
#------------------------------------ SQUARE FUNCTION ---------------------------------------#
##############################################################################################
def drawSquare(color, size,t):
t.fillcolor(color)
t.fill(True)
for i in range(0,4):
t.fd(sq_size*size)
t.right(90)
t.fill(False)
##############################################################################################
#------------------------------------ DRAW SQUARES ------------------------------------------#
##############################################################################################
move(-sq_size*.4,+sq_size*.4,t)
drawSquare((236,142,150),.8,t)
move(-sq_size*.3,+sq_size*.3,t)
drawSquare((43,16,84),.6,t)
##############################################################################################
#----------------------------------- DIAMOND FUNCTION ---------------------------------------#
##############################################################################################
def drawDiamond(color, size,t):
t.fillcolor(color)
t.fill(True)
t.circle(sq_size*size, 360, 4)
t.fill(False)
##############################################################################################
#------------------------------------ DRAW DIAMONDS -----------------------------------------#
##############################################################################################
move(0,-sq_size*.35,t)
drawDiamond((48,128,169),.35,t)
move(0,-sq_size*.25,t)
drawDiamond((116,35,61),.25,t)
move(0,-sq_size*.15,t)
drawDiamond((12,76,51),.15,t)
move(0,-sq_size*.05,t)
drawDiamond((245,164,48),.05,t)