kopia lustrzana https://github.com/villares/sketch-a-day
main
rodzic
a239041c10
commit
af3307773d
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 56 KiB |
|
@ -0,0 +1,37 @@
|
|||
|
||||
def setup():
|
||||
size(512 +128, 512 + 128) #, PDF, "a.pdf")
|
||||
rectMode(CENTER)
|
||||
noFill()
|
||||
stroke(0, 0, 255)
|
||||
noSmooth()
|
||||
noLoop()
|
||||
|
||||
def draw():
|
||||
background(0)
|
||||
rec_grid(width / 2, height / 2, 8, width)
|
||||
saveFrame("###.png")
|
||||
|
||||
def keyPressed():
|
||||
redraw()
|
||||
|
||||
def rec_grid(x, y, n, tw):
|
||||
cw = float(tw) / n
|
||||
margin = (cw - tw) / 2.0
|
||||
for i in range(n):
|
||||
nx = x + cw * i + margin
|
||||
for j in range(n):
|
||||
ny = y + cw * j + margin
|
||||
if cw > 8 and random(10) < 9:
|
||||
rec_grid(nx, ny, 2, cw)
|
||||
else:
|
||||
squarish(nx, ny, cw-2)
|
||||
|
||||
def squarish(x, y, w):
|
||||
xa, ya = x - w / 2, y - w / 2
|
||||
xb, yb = x + w / 2, y - w / 2
|
||||
xc, yc = x + w / 2, y + w / 2
|
||||
xd, yd = x - w / 2, y + w / 2
|
||||
coords = (xa, ya, xb, yb, xc, yc, xd, yd)
|
||||
rnd_coords = (c + int(random(-10, 10) * (y / height)) for c in coords)
|
||||
quad(*rnd_coords)
|
|
@ -26,6 +26,12 @@ Here are listed some of the tools I have been using:
|
|||
|
||||
---
|
||||
|
||||

|
||||
|
||||
[sketch_2021_01_19a](https://github.com/villares/sketch-a-day/tree/master/2021/sketch_2021_01_19a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
||||
[sketch_2021_01_18a](https://github.com/villares/sketch-a-day/tree/master/2021/sketch_2021_01_18a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
|
||||
|
|
Ładowanie…
Reference in New Issue