kopia lustrzana https://github.com/villares/sketch-a-day
main
rodzic
7abaa1c7b2
commit
f31517c582
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 2.9 MiB |
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 53 KiB |
|
@ -0,0 +1,41 @@
|
|||
import py5
|
||||
import numpy as np
|
||||
|
||||
def setup():
|
||||
py5.size(600, 600)
|
||||
start()
|
||||
|
||||
def start():
|
||||
global px, w, h
|
||||
py5.background(0)
|
||||
py5.rect_mode(py5.CENTER)
|
||||
py5.stroke_weight(5)
|
||||
py5.color_mode(py5.HSB)
|
||||
py5.no_fill()
|
||||
w, h = py5.width, py5.height
|
||||
for s in range(w, 0, -20):
|
||||
py5.stroke(s % 255, 255, 255, 255)
|
||||
py5.rect(w / 2, h / 2, s, s / w * h)
|
||||
px = py5.get_np_pixels(bands='RGB')
|
||||
|
||||
def draw():
|
||||
f = py5.frame_count // 100
|
||||
py5.random_seed(f)
|
||||
direction = py5.random_choice((-1, 1))
|
||||
|
||||
channel = py5.random_choice((0, 1, 2))
|
||||
y = py5.random_int(h // 50) * 50
|
||||
px[y-100:y, :, channel] = np.roll(px[y-100:y, :, channel], direction , axis=1)
|
||||
|
||||
channel = py5.random_choice((0, 1, 2))
|
||||
x = py5.random_int(w // 50) * 50
|
||||
px[:, x-100:x, channel] = np.roll(px[:, x-100:x, channel], direction, axis=0)
|
||||
|
||||
py5.set_np_pixels(px, bands='RGB')
|
||||
|
||||
def key_pressed():
|
||||
py5.save_frame('###.png')
|
||||
start()
|
||||
|
||||
py5.run_sketch(block=False)
|
||||
|
|
@ -34,6 +34,16 @@ Here are listed some of the tools I have been using:
|
|||
2024 \| [<b>2023</b>](2023.md) \| [<b>2022</b>](2022.md) \| [<b>2021</b>](2021.md) \| [<b>2020</b>](2020.md) \| [<b>2019</b>](2019.md) \| [<b>2018</b>](2018.md)
|
||||
|
||||
|
||||
---
|
||||
|
||||
### sketch_2024_06_28
|
||||
|
||||

|
||||
|
||||
[sketch_2024_06_28](https://github.com/villares/sketch-a-day/tree/main/2024/sketch_2024_06_28) [[py5](https://py5coding.org/)]
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
### sketch_2024_06_27
|
||||
|
|
Ładowanie…
Reference in New Issue