-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyColorsShapes.py
More file actions
146 lines (99 loc) · 3.43 KB
/
Copy pathmyColorsShapes.py
File metadata and controls
146 lines (99 loc) · 3.43 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
from p5 import *
#colors
white = (255,255,255)
lgray = (250,250,250)
gray = (200,200,200)
dgray = (150,150,150)
ddgray = (100,100,100)
black = (0,0,0)
blue = (0,0,255)
green = (0,255,0)
red = (255,0,0)
lred = (255,150,150)
dblue = (0,0,100)
dred = (100,0,0)
aqua = (0,200,200)
dgreen = (0,100,0)
yellow = (235, 207, 30)
purple = (150,0,200)
#shapes
def set_bg(color):
r,g,b = color # define a cor
background(r,g,b)
def custom_ln(x1,y1,x2,y2,thicc,color):
r,g,b = color # define a cor
stroke(r,g,b)
strokeWeight(thicc) # define a grossura
line(x1,y1,x2,y2)
def custom_ln_tr(x1,y1,x2,y2,origin,angle,thicc):
x,y = origin # define o ponto de origem
with push_matrix(): #cria uma nova linha num angulo
translate(x,y)
rotate(radians(angle))
custom_ln(x1,y1,x2,y2,thicc,black)
def custom_tr(x1,y1,x2,y2,x3,y3,inside,color,thicc,lcolor):
r,g,b = color # define a cor
lr,lg,lb = lcolor # define a cor do traçado
stroke(lr,lg,lb)
if (thicc > 0):
strokeWeight(thicc) # define a grossura do traçado
else:
noStroke() # sem traçado
if (inside): # define se a forma será preenchida ou não
fill(r,g,b) # define a cor
else:
noFill() # sem preenchimento
triangle(x1,y1,x2,y2,x3,y3)
def custom_cr(x,y,d,inside,color,thicc,lcolor):
r,g,b = color # define a cor
lr,lg,lb = lcolor # define a cor do traçado
stroke(lr,lg,lb)
if (thicc > 0):
strokeWeight(thicc) # define a grossura do traçado
else:
noStroke() # sem traçado
if (inside): # define se a forma será preenchida ou não
fill(r,g,b) # define a cor
else:
noFill() # sem preenchimento
circle(x,y,d)
def custom_arc(x1,y1,rdx,rdy,angle,inside,color,thicc,lcolor):
r,g,b = color # define a cor
lr,lg,lb = lcolor # define a cor do traçado
stroke(lr,lg,lb)
if (thicc > 0):
strokeWeight(thicc) # define a grossura do traçado
else:
noStroke() # sem traçado
if (inside): # define se a forma será preenchida ou não
fill(r,g,b) # define a cor
else:
noFill() # sem preenchimento
start,end = angle # define o principio e o fim do angulo
arc((x1, y1), rdx, rdy, radians(start), radians(end))
def custom_sq(x1,y1,size,inside,color,thicc,lcolor):
r,g,b = color # define a cor
lr,lg,lb = lcolor # define a cor do traçado
stroke(lr,lg,lb)
if (thicc > 0):
strokeWeight(thicc) # define a grossura do traçado
else:
noStroke() # sem traçado
if (inside): # define se a forma será preenchida ou não
fill(r,g,b) # define a cor
else:
noFill() # sem preenchimento
square(x1,y1,size)
def custom_rec(x1,y1,width,height,inside,color,thicc,lcolor):
r,g,b = color # define a cor
lr,lg,lb = lcolor # define a cor do traçado
stroke(lr,lg,lb)
if (thicc > 0):
strokeWeight(thicc) # define a grossura do traçado
else:
noStroke() # sem traçado
if (inside): # define se a forma será preenchida ou não
fill(r,g,b) # define a cor
else:
noFill() # sem preenchimento
rect(x1,y1,width,height)