kopia lustrzana https://github.com/villares/sketch-a-day
main
rodzic
1e926fc4db
commit
6420ef2ceb
Plik binarny nie jest wyświetlany.
|
Po Szerokość: | Wysokość: | Rozmiar: 815 KiB |
|
|
@ -4,35 +4,40 @@ from py5_tools import animated_gif
|
|||
|
||||
mode = 1
|
||||
N = 5
|
||||
R = 0.333
|
||||
|
||||
def setup():
|
||||
global w, wa, wb
|
||||
py5.size(500, 500)
|
||||
py5.rect_mode(py5.CENTER)
|
||||
w = py5.width / N
|
||||
wa = w * R
|
||||
wb = w * (1 - R)
|
||||
animated_gif('out.gif', duration=0.1,
|
||||
|
||||
animated_gif('out.gif', duration=0.15,
|
||||
frame_numbers=range(1, 361, 6))
|
||||
|
||||
def draw():
|
||||
ang = py5.radians(py5.frame_count)
|
||||
r = (2 + py5.sin(ang)) / 3
|
||||
wa = w * r
|
||||
wb = w * (1 - r)
|
||||
rot = ang / 2
|
||||
if mode == 1:
|
||||
py5.background(255)
|
||||
py5.fill(0)
|
||||
py5.blend_mode(py5.SUBTRACT)
|
||||
for i in range(N + 1):
|
||||
for j in range(N + 1):
|
||||
x = i * w + wa / 2 - w / 2
|
||||
y = j * w + wa / 2 - w / 2
|
||||
rr(x, y, wa, wa)
|
||||
rr(x, y, wa, wa, rot)
|
||||
rr(x + (wa + wb) / 2,
|
||||
y + (wa + wb) / 2, wb, wb)
|
||||
y + (wa + wb) / 2, wb, wb, rot)
|
||||
|
||||
def rr(x, y, w, h):
|
||||
def rr(x, y, w, h, rot):
|
||||
with py5.push_matrix():
|
||||
py5.translate(x, y)
|
||||
py5.rotate(py5.radians(py5.frame_count))
|
||||
py5.rect(0, 0, w, h)
|
||||
for i in range(3):
|
||||
py5.rotate(rot)
|
||||
py5.fill(('cyan', 'magenta', 'yellow')[i])
|
||||
py5.rect(0, 0, w, h)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,16 @@ If you appreciate what I have been doing, you may also support my artistic work,
|
|||
|
||||
2025 \| [<b>2024</b>](2024.md) \| [<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_2025_03_01
|
||||
|
||||

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