Skip to content

Commit cbb1246

Browse files
committed
Updates
1 parent 82c7a72 commit cbb1246

19 files changed

+243
-332
lines changed

apps/apps.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,15 @@
207207
"pinned_order": 10,
208208
"created_at": "2025-11-25T17:00:00+03:00"
209209
},
210+
{
211+
"slug": "spirograph",
212+
"to": "/apps/spirograph",
213+
"title": "Spirograph Generator",
214+
"description": "Create mesmerizing geometric patterns with math.",
215+
"icon": "AtomIcon",
216+
"pinned_order": 17,
217+
"created_at": "2025-11-29T14:00:00+03:00"
218+
},
210219
{
211220
"slug": "codename-generator",
212221
"to": "/apps/codename-generator",
@@ -279,6 +288,24 @@
279288
"icon": "MagicWandIcon",
280289
"order": 3,
281290
"apps": [
291+
{
292+
"slug": "fractal-flora",
293+
"to": "/apps/fractal-flora",
294+
"title": "Fractal Flora",
295+
"description": "Grow digital trees using recursive mathematics.",
296+
"icon": "PlantIcon",
297+
"pinned_order": 18,
298+
"created_at": "2025-11-29T15:00:00+03:00"
299+
},
300+
{
301+
"slug": "l-system-art",
302+
"to": "/apps/l-system-art",
303+
"title": "L-System Art",
304+
"description": "Generate intricate fractal patterns using L-System rules.",
305+
"icon": "CodeIcon",
306+
"pinned_order": 19,
307+
"created_at": "2025-11-29T16:00:00+03:00"
308+
},
282309
{
283310
"slug": "color-palette-generator",
284311
"to": "/apps/color-palette-generator",

asset-manifest.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"files": {
3-
"main.css": "/static/css/main.4f1b96ab.css",
4-
"main.js": "/static/js/main.d0bc2e48.js",
3+
"main.css": "/static/css/main.507b177a.css",
4+
"main.js": "/static/js/main.4328588c.js",
55
"static/js/8921.3d32fb9c.chunk.js": "/static/js/8921.3d32fb9c.chunk.js",
66
"static/js/9815.b25ee880.chunk.js": "/static/js/9815.b25ee880.chunk.js",
77
"static/js/536.b6131744.chunk.js": "/static/js/536.b6131744.chunk.js",
@@ -64,7 +64,7 @@
6464
"static/js/671.5237f1b3.chunk.js": "/static/js/671.5237f1b3.chunk.js",
6565
"static/js/1245.5178d111.chunk.js": "/static/js/1245.5178d111.chunk.js",
6666
"static/js/5853.e037f2d5.chunk.js": "/static/js/5853.e037f2d5.chunk.js",
67-
"static/js/5551.c6cff509.chunk.js": "/static/js/5551.c6cff509.chunk.js",
67+
"static/js/8505.d69a13c9.chunk.js": "/static/js/8505.d69a13c9.chunk.js",
6868
"static/js/9772.2aadfb92.chunk.js": "/static/js/9772.2aadfb92.chunk.js",
6969
"static/js/1769.fec94624.chunk.js": "/static/js/1769.fec94624.chunk.js",
7070
"static/js/2811.14f2f41f.chunk.js": "/static/js/2811.14f2f41f.chunk.js",
@@ -81,12 +81,15 @@
8181
"static/js/6426.f686b129.chunk.js": "/static/js/6426.f686b129.chunk.js",
8282
"static/js/4194.3d98b82d.chunk.js": "/static/js/4194.3d98b82d.chunk.js",
8383
"static/js/9524.f0890a27.chunk.js": "/static/js/9524.f0890a27.chunk.js",
84-
"static/js/4328.4b31e6c2.chunk.js": "/static/js/4328.4b31e6c2.chunk.js",
84+
"static/js/4328.328a6140.chunk.js": "/static/js/4328.328a6140.chunk.js",
8585
"static/js/8898.7f5bf088.chunk.js": "/static/js/8898.7f5bf088.chunk.js",
8686
"static/js/5198.9d9941e7.chunk.js": "/static/js/5198.9d9941e7.chunk.js",
8787
"static/js/7423.289a4e31.chunk.js": "/static/js/7423.289a4e31.chunk.js",
8888
"static/js/9196.db857307.chunk.js": "/static/js/9196.db857307.chunk.js",
8989
"static/js/8205.dbc349fd.chunk.js": "/static/js/8205.dbc349fd.chunk.js",
90+
"static/js/7456.7394ddf6.chunk.js": "/static/js/7456.7394ddf6.chunk.js",
91+
"static/js/2725.7d5c652e.chunk.js": "/static/js/2725.7d5c652e.chunk.js",
92+
"static/js/4671.4e852be8.chunk.js": "/static/js/4671.4e852be8.chunk.js",
9093
"static/js/8039.8f66a873.chunk.js": "/static/js/8039.8f66a873.chunk.js",
9194
"static/js/9145.80aca5f3.chunk.js": "/static/js/9145.80aca5f3.chunk.js",
9295
"static/js/7692.87f2d434.chunk.js": "/static/js/7692.87f2d434.chunk.js",
@@ -120,7 +123,7 @@
120123
"index.html": "/index.html"
121124
},
122125
"entrypoints": [
123-
"static/css/main.4f1b96ab.css",
124-
"static/js/main.d0bc2e48.js"
126+
"static/css/main.507b177a.css",
127+
"static/js/main.4328588c.js"
125128
]
126129
}

images/projects/fractal-flora.png

87 KB
Loading

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html lang="en" class="dark"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><link rel="icon" type="image/svg+xml" href="/favicon.svg"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="alternate" type="application/rss+xml" title="Fezcodex RSS Feed" href="/rss.xml"/><meta name="description" content="codex by fezcode..."/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Arvo&family=Inter&family=Playfair+Display&display=swap" rel="stylesheet"><title>fezcodex</title><script defer="defer" src="/static/js/main.d0bc2e48.js"></script><link href="/static/css/main.4f1b96ab.css" rel="stylesheet"></head><body class="bg-slate-950"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1+
<!doctype html><html lang="en" class="dark"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><link rel="icon" type="image/svg+xml" href="/favicon.svg"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="alternate" type="application/rss+xml" title="Fezcodex RSS Feed" href="/rss.xml"/><meta name="description" content="codex by fezcode..."/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Arvo&family=Inter&family=Playfair+Display&display=swap" rel="stylesheet"><title>fezcodex</title><script defer="defer" src="/static/js/main.4328588c.js"></script><link href="/static/css/main.507b177a.css" rel="stylesheet"></head><body class="bg-slate-950"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

posts/how-fractal-flora-works.txt

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
Have you ever wondered how nature creates such intricate and beautiful patterns,
2+
from the branching of trees to the delicate veins of a leaf? Much of this complexity can be explained by surprisingly simple rules,
3+
often involving **fractals** and **recursion**.
4+
Our new "Fractal Flora" app lets you explore these principles by growing your own digital trees with a few sliders.
5+
6+
This post will peel back the layers and explain the core mechanics behind the app.
7+
8+
![/images/projects/fractal-flora.png](/images/projects/fractal-flora.png)
9+
10+
## What is a Fractal Tree?
11+
12+
At its heart, a fractal tree is a structure where a basic branching pattern repeats itself at smaller scales. Each branch can be thought of as a miniature version of the entire tree. This self-similarity is a hallmark of fractals.
13+
14+
In programming, this concept is perfectly suited for **recursion**, where a function calls itself to solve smaller instances of the same problem.
15+
16+
## The Recursive Algorithm: `drawBranch`
17+
18+
The entire tree is generated by a single, powerful recursive function, let's call it `branch()`. It takes a starting point, a length, an angle, and its current depth in the tree.
19+
20+
Here's a simplified look at its logic:
21+
22+
1. **Draw the Current Branch:** It draws a line segment from its starting point, at its given length and angle.
23+
2. **Base Case (Stop Condition):** If the `depth` (how many times it has branched) reaches zero, it stops. This prevents infinite recursion.
24+
3. **Branch Out:** Otherwise, it calculates the endpoint of the current branch. From this endpoint, it calls itself *twice* (or more), creating two new "sub-branches." Each sub-branch is drawn with a shorter length, a new angle (offset from the parent branch), and a reduced depth.
25+
26+
```javascript
27+
const branch = (x, y, len, ang, d) => {
28+
// 1. Calculate end point of current branch
29+
const endX = x + len * Math.cos((ang * Math.PI) / 180);
30+
const endY = y + len * Math.sin((ang * Math.PI) / 180);
31+
32+
// 2. Draw the branch (context.drawLine(x,y,endX,endY))
33+
34+
// 3. If not at max depth, recurse
35+
if (d > 0) {
36+
const nextLen = len * lengthMultiplier; // e.g., 0.7
37+
// Right branch
38+
branch(endX, endY, nextLen, ang + branchAngle, d - 1);
39+
// Left branch
40+
branch(endX, endY, nextLen, ang - branchAngle, d - 1);
41+
}
42+
};
43+
44+
// Initial call (e.g., from bottom center of canvas)
45+
// branch(canvas.width / 2, canvas.height, initialLength, -90, maxDepth);
46+
```
47+
*(Note: The actual implementation in `FractalFloraPage.js` is slightly more complex, handling canvas transformations, line widths, and randomized elements.)*
48+
49+
## The "DNA" of Your Digital Tree
50+
51+
The beauty of Fractal Flora lies in how these simple parameters (the tree's "DNA") dramatically change its appearance:
52+
53+
* **Recursion Depth (`depth`):** This controls how many times the `branch()` function calls itself. A higher depth creates a denser, more complex tree, but also requires more computation.
54+
* **Branch Angle (`angle`):** This is the angle at which new branches diverge from the parent branch. Small angles create tall, narrow trees, while larger angles create wider, more sprawling structures.
55+
* **Length Multiplier (`lengthMultiplier`):** This determines how much shorter each successive branch becomes. A value of `0.7` means a new branch is 70% the length of its parent.
56+
* **Trunk Base Size (`lengthBase`):** The initial length of the very first (main) trunk segment.
57+
* **Wind / Asymmetry (`asymmetry`):** This parameter adds a bias to the branching angle, making one side of the tree grow more dominantly, simulating the effect of wind or environmental factors.
58+
* **Organic Randomness (`randomness`):** This introduces slight, random variations to the length and angle of each branch, breaking the perfect symmetry of mathematical fractals and making the tree appear more organic and natural.
59+
60+
### Seasons and Color Palettes
61+
62+
The app also cycles through different "seasons." These aren't complex simulations, but rather pre-defined color palettes for the trunk, branches, and leaves, instantly changing the mood and appearance of your flora.
63+
64+
## From Math to Art
65+
66+
What's fascinating is how a few lines of code, driven by recursive mathematical principles, can generate forms that closely mimic those found in nature. Fractals are not just abstract mathematical concepts; they are the language of growth, efficiency, and beauty in the natural world.
67+
68+
Now that you understand the "how," dive back into the Fractal Flora app and become a digital botanist, experimenting with its DNA to create your own unique, algorithmic arboretum!

0 commit comments

Comments
 (0)