r/generative

▲ 537 r/generative+1 crossposts

I spent way too much time on this, but it's totally worth it (p5.js + react)

[SOUND ON! 🔊]

This video is a montage of p5.js sketches I've collected into a gallery website: https://vasilyev-maksim.github.io/p5-experiments/.

Source code: https://github.com/vasilyev-maksim/p5-experiments.

The classic modern-day story of a software engineer, and at the same time, a backstory on this project: I got burned out from extensive AI use at work.

Looking for a cure, I remembered three things:

  1. A book called "The Nature of Code" which uses p5.js for all its code samples (btw, you should definitely check it out, it's free to read online, and it's fantastic!)
  2. I have a degree in maths
  3. I used to paint as a kid and, generally speaking, have a decent eye for visuals (or so I hope)

Combining these three things led me to give p5.js a try. That decision genuinely brought me back to life, both as an engineer and as a creative person.

Over time, the sketches became more numerous, more complex and visually richer. They evolved from static images into actual animations, so I decided to bring them together in a form of gallery website.

The next step was to make every sketch parametrizable and connect those parameters to UI controls. That's when it started to feel like real generative art with all its emergent properties. And it really does have an emergent nature. Most of the parameter combinations I saved as presets are just random configurations I happened to stumble upon and liked enough to keep.

I'll post a video in the comments showing the gallery UI in action.

Some things I'm particularly proud of (yeah, I like lists, it's not an AI slop 😆):

  • It's entirely handmade. No AI involved in the creative process or the implementation (well, to be completely honest, there's exactly one AI-generated file, 86 lines long. That's it).
  • I've been working on this for about 1.5 years (not full-time, obviously, just whenever I had some free time). With this project I've finally managed to (almost entirely) satisfy my inner perfectionist.
  • I've never learned so much from a single project. Not even close. And I've rarely explored things at such a deep level, either in personal projects or at work.
  • The entire UI was built from scratch. All the animations, the visual style, the icons, and the illustrations - everything is handmade. No 3rd party UI component libraries (even built my own slider component instead of using the native <input type="range">, LOL). The only dependencies are React, react-spring, and p5.js.
  • I've built a draft of an open source React library for managing UI animation timing and events. I hope I'll release it someday. 🤞
  • I've built a custom React wrapper around p5.js. It connects UI controls to sketch parameters, supports memoized and animated values derived from those parameters (including colors and arrays), and provides timeline controls (play/pause, fast-forward, and rewind).
  • One of my favorite visual details is the sketch opening animation. Each tile is actually a cropped and carefully positioned view of a sketch's canvas, with the sketch itself paused. (Yes, I'm aware this approach might have scalability issues if the gallery grows significantly.)
  • Each sketch has two independent timelines: one for the actual animation and another for parameter transitions. This means parameter changes are still smoothly animated even when the sketch itself is paused.
  • The gallery supports fullscreen viewing, exporting, and sharing. Every parameter change is reflected in the URL, so you can share a link and someone else will see the exact same sketch configuration.

Feel free to check it out, play around with the parameters and share your own presets in the comments (just copy and paste the URL + write a name for the preset).
I'll add the coolest ones to the source code!

P.S. There's also a little easter egg referencing my favorite game Outer Wilds. See if you can find it!

u/ColdVolume6314 — 6 days ago
▲ 24 r/generative+1 crossposts

I made the same mosaic portrait with 12 different matching methods

I’ve been making mosaics since the late ’80s. These are twelve versions of the same portrait, made with different matching methods in my software. Some hold the face together better from a distance; others let more of the small patterned pieces come through.
Working on this sent me back through the research, from Bell Labs in 1966 to recent methods. I put what I found into a history of photographic mosaic algorithms, with a few opinions of my own:
https://www.tsevis.com/blog/history-of-mosaic-algorithms
Which version works best for you, and at what distance?

u/tsevis — 6 days ago

The Painted Calamity

A variation of the 'generalized rainbow smoke algorithm' (which I saw from a youtube video).

It's basically two breadth-first-searches bouncing off each other. One samples colors from an input image, the other samples positions to place the colors in the output image. The animation comes from 'rolling' the input image underneath the mapping and re-generating the output (this also makes it loop).

u/Single-Lab-5692 — 11 days ago
▲ 26 r/generative+1 crossposts

smol talk

I like the idea that weather is the ultimate small talk subject.

So I made smol talk.

80 years of Melbourne weekly minimum temperatures, compressed into one big field of tiny marks.

There’s a pattern in there somewhere.

Probably.

Every little mark is a week.
Every bigger, more chaotic mark is a colder week.

u/dumbdataguy — 9 days ago