Skip to content

Commit

Permalink
6
Browse files Browse the repository at this point in the history
  • Loading branch information
villares committed Jan 7, 2025
1 parent 8f2ecdb commit d840abb
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 0 deletions.
Binary file added 2025/sketch_2025_01_06/out024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2025/sketch_2025_01_06/out036.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2025/sketch_2025_01_06/out041.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2025/sketch_2025_01_06/out046.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2025/sketch_2025_01_06/sketch_2025_01_06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions 2025/sketch_2025_01_06/sketch_2025_01_06.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Delaunay play
from itertools import product

import py5
from scipy.spatial import Delaunay
import numpy as np

num_points = 200
seed = 0

def setup():
py5.size(600, 600, py5.P3D)
py5.color_mode(py5.HSB)
new_points()

def new_points():
global seed_points, tris
W = 60
R = 20
py5.random_seed(seed)
seed_points = []
for i in range(2):
seed_points.extend((x + (i - 1) * py5.random(-R, R),
y + i * py5.random(-R, R),
i * R
) for x, y
in product(range(0, py5.width + W, W),
range(0, py5.height+ W, W)))
pts = np.array(seed_points)
tri = Delaunay(seed_points)
tris = pts[tri.simplices]

def draw():
py5.random_seed(seed)
py5.background(0)
py5.translate(-50, -50, 50)
py5.rotate_x(py5.radians(30))
#py5.scale(500 / 600)
for vs in tris:
shp = py5.create_shape()
with shp.begin_closed_shape():
shp.vertices(vs)
shp.set_fills(noise_colors(vs))
py5.shape(shp)
# f = py5.frame_count
# if f < 361 and f % 5 == 0:
# py5.save_frame('###.png')



def noise_colors(vs):
step = py5.TAU / len(vs)
colors = []
for i, (xo, yo, zo) in enumerate(vs):
a = i * step + py5.radians(py5.frame_count)
x = py5.cos(a) + xo / 10
y = py5.sin(a) + yo / 10
h = 255 * (1 + py5.os_noise(x, y, 100)) / 2
s = 255 * (1 + py5.os_noise(x, y, 1000)) / 2
b = 255 #* (1 + py5.os_noise(x, y, 10000)) / 2
colors.append(py5.color(h, s, b))
return colors

def key_pressed():
global seed
if py5.key == ' ':
seed += 1
new_points()
elif str(py5.key).lower() == 's':
py5.save_frame('out###.png')


py5.run_sketch(block=False)
10 changes: 10 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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_01_06

![sketch_2025_01_06](https://raw.githubusercontent.com/villares/sketch-a-day/main/2025/sketch_2025_01_06/sketch_2025_01_06.png)

[sketch_2025_01_06](https://github.com/villares/sketch-a-day/tree/main/2025/sketch_2025_01_06) [[py5](https://py5coding.org/)]



---

### sketch_2025_01_05
Expand Down

0 comments on commit d840abb

Please sign in to comment.