diff --git a/2025/sketch_2025_09_14/Aiga_departingflights.svg b/2025/sketch_2025_09_14/Aiga_departingflights.svg new file mode 100644 index 00000000..86290dde --- /dev/null +++ b/2025/sketch_2025_09_14/Aiga_departingflights.svg @@ -0,0 +1,14 @@ + + + + + diff --git a/2025/sketch_2025_09_14/sketch_2025_09_14.png b/2025/sketch_2025_09_14/sketch_2025_09_14.png new file mode 100644 index 00000000..2f3d67c8 Binary files /dev/null and b/2025/sketch_2025_09_14/sketch_2025_09_14.png differ diff --git a/2025/sketch_2025_09_14/sketch_2025_09_14.py b/2025/sketch_2025_09_14/sketch_2025_09_14.py new file mode 100644 index 00000000..bb1eb7fc --- /dev/null +++ b/2025/sketch_2025_09_14/sketch_2025_09_14.py @@ -0,0 +1,42 @@ +import py5 + +S = 10 # scale factor + +def setup(): + global osb, svg, mask + py5.size(500, 500) + py5.color_mode(py5.CMAP, py5.mpl_cmaps.VIRIDIS_R, 255) + w, h = 500 * S, 500 * S + osb = py5.create_graphics(w, h) + py5.no_loop() + + svg = py5.load_shape('Aiga_departingflights.svg') + svg.disable_style() + mask = py5.create_graphics(w, h) + mask.begin_draw() + mask.no_stroke() + mask.shape(svg, w * 0.05, h * 0.05, w * 0.9, h * 0.9) + mask.end_draw() + osb.no_smooth() # before begin_draw! + osb.begin_draw() + osb.stroke_cap(py5.SQUARE) + osb.background(py5.color(0)) + osb.scale(S) + for _ in range(200): + x = py5.random_int(-255, 500 + 255) + y = py5.random_int(-255, 500 + 255) + for i in range(255): + if py5.random_int(1, 10) > 5: + # you need to use py5.color() with Py5Graphics attributes + osb.stroke(py5.color(i)) + else: + osb.stroke(0, 0) + osb.line(x + i, y, x + i, y + 255) + osb.end_draw() + osb.mask(mask) + py5.background('black') + py5.image(osb, 0, 0, py5.width, py5.height) + osb.save('out.png', drop_alpha=False) # necessary for the masking! + + +py5.run_sketch(block=False) diff --git a/2025/sketch_2025_09_14/sketch_2025_09_14_test.py b/2025/sketch_2025_09_14/sketch_2025_09_14_test.py new file mode 100644 index 00000000..2b274aaf --- /dev/null +++ b/2025/sketch_2025_09_14/sketch_2025_09_14_test.py @@ -0,0 +1,26 @@ +import py5 + +S = 2 # scale factor + +def setup(): + global osb, svg, mask + py5.size(500, 500) + w, h = 500 * S, 500 * S + osb = py5.create_graphics(w, h) + mask = py5.create_graphics(w, h) + mask.begin_draw() + mask.no_stroke() + mask.circle(w / 2, h / 2, w) + mask.end_draw() + osb.begin_draw() + osb.background(py5.color(0)) + osb.scale(S) + for x in range(0, py5.width, 10): + osb.stroke('white') + osb.line(x, 0, x, py5.height) + osb.end_draw() + osb.mask(mask) + py5.image(osb, 0, 0, py5.width, py5.height) + osb.save('out.png', drop_alpha=False) + +py5.run_sketch(block=False) diff --git a/docs/README.md b/docs/README.md index 281f311c..7a2e0594 100644 --- a/docs/README.md +++ b/docs/README.md @@ -26,6 +26,16 @@ If you appreciate what I have been doing, you may also support my artistic work, +--- + +### sketch_2025_09_14 + +![sketch_2025_09_14](https://raw.githubusercontent.com/villares/sketch-a-day/main/2025/sketch_2025_09_14/sketch_2025_09_14.png) + +[sketch_2025_09_14](https://github.com/villares/sketch-a-day/tree/main/2025/sketch_2025_09_14) [[py5](https://py5coding.org/)] + +I like the public domain AIGA pictogram for departures :) + --- ### sketch_2025_09_13