kopia lustrzana https://github.com/villares/sketch-a-day
2020_01_10 & renames
rodzic
040f693d55
commit
f2dd61c398
Przed Szerokość: | Wysokość: | Rozmiar: 835 KiB Po Szerokość: | Wysokość: | Rozmiar: 835 KiB |
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 3.6 MiB |
|
@ -0,0 +1,42 @@
|
|||
t = 0
|
||||
def setup():
|
||||
size(500, 500)
|
||||
# noLoop()
|
||||
# noStroke()
|
||||
strokeWeight(0.1)
|
||||
|
||||
def draw():
|
||||
global t
|
||||
t += 0.00004
|
||||
grade(0, 0, width - 1, height - 1, 4)
|
||||
|
||||
def grade(xg, yg, wxg, wyg, n=None):
|
||||
n1 = n or 1 + int(6 * noise(xg * 0.1, t))
|
||||
x = xg
|
||||
sry = special_range(n1, wyg)
|
||||
n2 = n or 1 + int(6 * noise(yg * 0.1, xg * 0.1, t))
|
||||
for wx in special_range(n2, wxg):
|
||||
y = yg
|
||||
for wy in sry:
|
||||
if wy < 12 or wx < 12:
|
||||
fill((wy * 10) % 256,
|
||||
(wx * 10) % 256,
|
||||
(2 * wx * wy) % 256, 100)
|
||||
rect(x, y, wx, wy)
|
||||
else:
|
||||
grade(x, y, wx, wy)
|
||||
y += wy
|
||||
x += wx
|
||||
|
||||
def special_range(n, target, pos=None):
|
||||
""" Return a list of n float numbers that add up to target."""
|
||||
precalc = [noise(i * 0.1 + target, t)
|
||||
for i in range(n)]
|
||||
total = sum(precalc)
|
||||
if not pos:
|
||||
return [map(precalc[i], 0, total, 0, target)
|
||||
for i in range(n)]
|
||||
|
||||
|
||||
# def keyPressed():
|
||||
# redraw()
|
|
@ -26,6 +26,12 @@ Some of the tools I have used:
|
|||
|
||||
---
|
||||
|
||||

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

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