kopia lustrzana https://github.com/villares/sketch-a-day
358!
rodzic
fc7a8d3b56
commit
784cdd277d
42
s358/node.py
42
s358/node.py
|
|
@ -8,9 +8,9 @@ class Node():
|
|||
self.x = Node.border + Node.spacing / 2 + x * Node.spacing - width / 2
|
||||
self.y = Node.border + Node.spacing / 2 + y * Node.spacing - height / 2
|
||||
self.size_ = 1
|
||||
self.rot0 = choice((0, HALF_PI)) #, PI, PI + HALF_PI))
|
||||
self.rot1 = choice((HALF_PI , PI)) #, PI + HALF_PI))
|
||||
self.type = choice(("a", "b"))
|
||||
self.rot0 = choice((0, HALF_PI)) # , PI, PI + HALF_PI))
|
||||
self.rot1 = choice((HALF_PI, PI)) # , PI + HALF_PI))
|
||||
self.type = choice(("f1", "f2", "t", "i", "l"))
|
||||
|
||||
def plot(self, ang):
|
||||
""" draws node """
|
||||
|
|
@ -21,31 +21,37 @@ class Node():
|
|||
rotate(self.rot0 + ang)
|
||||
else:
|
||||
self.rot0 = self.rot1 - ang
|
||||
rotate(self.rot1)
|
||||
noFill() #stroke(0)
|
||||
rotate(self.rot1)
|
||||
noFill() # stroke(0)
|
||||
siz = Node.spacing * self.size_
|
||||
l = siz / 2.
|
||||
a = l / 2. - 1
|
||||
c = l / 2. + 1
|
||||
# stroke(0, 0, 200, 50)
|
||||
# rect(0, 0, siz, siz)
|
||||
for i in range(-4, 5, 4): # (-28, 29, 7):
|
||||
stroke(0, 0, 200, 50)
|
||||
rect(0, 0, siz, siz)
|
||||
for i in range(-4, 5, 4): # (-28, 29, 7):
|
||||
stroke(32, 64 + i * 8, 64 - i * 8)
|
||||
if self.type == "a":
|
||||
if self.type == "f1":
|
||||
quarter_circle(l, l, c + i, TOP + LEFT)
|
||||
quarter_circle(-l, -l, c + i, BOTTOM + RIGHT)
|
||||
quarter_circle(-l, -l, c + i, BOTTOM + RIGHT)
|
||||
quarter_circle(-l, l, c + i, TOP + RIGHT)
|
||||
quarter_circle(l, -l, c + i, BOTTOM + LEFT)
|
||||
else: #self.type == "b":
|
||||
quarter_circle(l, -l, c + i, BOTTOM + LEFT)
|
||||
elif self.type == "f2":
|
||||
half_circle(-l, 0, a - i, RIGHT)
|
||||
half_circle(l, 0, a - i, LEFT)
|
||||
half_circle(l, 0, a - i, LEFT)
|
||||
half_circle(0, l, a - i, TOP)
|
||||
half_circle(0, -l, a - i, BOTTOM)
|
||||
# else:
|
||||
# line(-l, a + i, l, a + i)
|
||||
# line(a + i, -l, a + i, l)
|
||||
# line(-l, -a + i, l, -a + i)
|
||||
# line(-a + i, -l, -a + i, l)
|
||||
elif self.type == "t":
|
||||
half_circle(-l, 0, a - i, RIGHT)
|
||||
half_circle(l, 0, a - i, LEFT)
|
||||
half_circle(0, -l, a - i, BOTTOM)
|
||||
elif self.type == "i":
|
||||
half_circle(0, l, a - i, TOP)
|
||||
half_circle(0, -l, a - i, BOTTOM)
|
||||
elif self.type == "l":
|
||||
half_circle(-l, 0, a - i, RIGHT)
|
||||
half_circle(l, 0, a - i, LEFT)
|
||||
|
||||
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Alexandre B A Villares - https://abav.lugaralgum.com/sketch-a-day
|
||||
SKETCH_NAME = "s322" # 20181116
|
||||
SKETCH_NAME = "s358" # 20181222
|
||||
OUTPUT = ".gif"
|
||||
|
||||
GRID_SIZE = 20
|
||||
BORDER = 10
|
||||
GRID_SIZE = 5
|
||||
BORDER = 50
|
||||
|
||||
from random import seed
|
||||
from random import choice
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue