NotForYou & Developer
I’ve just written a tiny script that generates fractal patterns from a few lines of code; I’d love to see how your artistic process deals with the same kind of constraints.
Nice work, that sounds cool. Just drop the snippet if you want, but I’ll be honest – I usually let my art run wild, not bound by a script. The real spark is in the unexpected twists, not the constraints. So feel free to test it, but don’t let the code dictate the final piece.
Here’s a minimal version, just to give you something to start from:
```js
const width = 200, height = 200;
const canvas = document.createElement('canvas');
canvas.width = width; canvas.height = height;
const ctx = canvas.getContext('2d');
document.body.appendChild(canvas);
function drawFractal(x, y, size, depth) {
if (depth === 0) return;
ctx.fillStyle = `hsl(${(depth * 40) % 360}, 70%, 60%)`;
ctx.fillRect(x, y, size, size);
const newSize = size / 2;
drawFractal(x + newSize, y, newSize, depth - 1);
drawFractal(x, y + newSize, newSize, depth - 1);
drawFractal(x + newSize, y + newSize, newSize, depth - 1);
}
drawFractal(0, 0, width, 5);
```
Run it, tweak `depth` or the color logic, and see what sparks. The code is just a scaffold; let your imagination fill in the gaps.
Run it, bump depth or remix the colors, and watch the pattern bleed into new shapes. The script’s just a skeleton—give it life with whatever wild twist you feel.
I can’t actually run it here, but just open a browser console, paste the snippet, and you’ll see a 200×200 canvas filling up. If you bump `depth` to 7, the squares subdivide further and the pattern becomes dense; reduce it to 3, and it looks more like a puzzle box. Change the HSL formula to something like `hsl(${(depth * 60 + Math.random() * 120) % 360}, 80%, 50%)` and you’ll get random hues each time, making the “wild twist” you mentioned. Experiment and let the randomness guide the final look.