L-system tree · muse-spark-1.2
Using the pre-provided p5.min.js (global p5), grow a procedural L-system fractal tree that branches recursively and sways gently in the wind.
transcript · 8 messages
Using the pre-provided p5.min.js (global p5), grow a procedural L-system fractal tree that branches recursively and sways gently in the wind.
{"command":"ls -lh /tmp/ws && head -c 2000 /tmp/ws/p5.min.js | head\n"}total 1012K -rw-r--r--. 1 node node 1011K Aug 13 01:27 p5.min.js /*! p5.js v1.9.4 May 21, 2024 */ !function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).p5=e()}(function(){var s,t,r;return function o(n,s,i){function a(t,e){if(!s[t]){if(!n[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(l)return l(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=s[t]={exports:{}},n[t][0].call(r.exports,function(e){return a(n[t][1][e]||e)},r,r.exports,o,n,s,i)}return s[t].exports}for(var l="function"==typeof require&&require,e=0;e<i.length;e++)a(i[e]);return a}({1:[function(e,t,r){"use strict";r.byteLength=function(e){var e=c(e),t=e[0],e=e[1];return 3*(t+e)/4-e},r.toByteArray=function(e){var t,r,o=c(e),n=o[0],o=o[1],s=new u(function(e,t){return 3*(e+t)/4-t}(n,o)),i=0,a=0<o?n-4:n;for(r=0;r<a;r+=4)t=l[e.charCodeAt(r)]<<18|l[e.charCodeAt(r+1)]<<12|l[e.charCodeAt(r+2)]<<6|l[e.charCodeAt(r+3)],s[i++]=t>>16&255,s[i++]=t>>8&255,s[i++]=255&t;2===o&&(t=l[e.charCodeAt(r)]<<2|l[e.charCodeAt(r+1)]>>4,s[i++]=255&t);1===o&&(t=l[e.charCodeAt(r)]<<10|l[e.charCodeAt(r+1)]<<4|l[e.charCodeAt(r+2)]>>2,s[i++]=t>>8&255,s[i++]=255&t);return s},r.fromByteArray=function(e){for(var t,r=e.length,o=r%3,n=[],s=0,i=r-o;s<i;s+=16383)n.push(function(e,t,r){for(var o,n=[],s=t;s<r;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),n.push(function(e){return a[e>>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(o));return n.join("")}(e,s,i<s+16383?i:s+16383));1==o?(t=e[r-1],n.push(a[t>>2]+a[t<<4&63]+"==")):2==o&&(t=(e[r-2]<<8)+e[r-1],n.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return n.join("")};for(var a=[],l=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,s=o.length;n<s;++n)a[n]=o[n],l[o.charCodeAt(n)]=n;function c(e){var t=e.length;if(0<t%4)throw new Error("Invalid s
index.html (24964 bytes)Successfully wrote 24964 bytes to index.html
{"command":"ls -lh index.html && grep -c \"p5.min.js\" index.html && grep -E \"https?://\" index.html | head"}-rw-r--r--. 1 node node 25K Aug 13 01:28 index.html 1
Procedural L-System tree built in `index.html` using local `p5.min.js` — no external resources. **Features:** - **L-System generation:** Presets (Classic `F→FF-[-F+F+F]+[+F-F-F]`, Fern, Bushy, Sparse) with axiom rewrite up to 6 iterations, string preview, angle/scale/trunk sliders. Turtle graphics with `F,+,-,[,]` and push/pop stack builds hierarchical node tree. - **Recursion & Branching:** Trunk length scaled by `scale^depth`, thickness tapers by depth, highlights and leaf clusters on tips. - **Wind sway:** Hierarchical propagation — sinusoidal `sin(t * freq)` + Perlin noise driven wind, weighted by `depth/maxDepth` so tips flutter most. Strength/Speed sliders, auto-sway toggle, gust impulse, drag-to-gust, and subtle flutter for leaves. - **Growth animation:** Progressive reveal by generation order with length interpolation and progress bar; regenerate/randomize/zoom/dbl-click reseed. All CSS/JS inline, fully sandboxed.
TAKE IT TO CODE
A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.
RUN
EVALUATION
L-system tree renders with controls; small stubby tree barely branches, minimal sway visible, enter+space revealed extra panel UI.
Vision grade · anthropic/claude-sonnet-5
MEASUREMENTS
Raw readings from the capture, not a verdict — the grade above is the only judgement. Percentages are how much of the screen changed; the measure under-reports sparse motion on a dark background.