Skip to content

Commit 4495585

Browse files
committed
hydra - further resize improvements
1 parent 2dd51a4 commit 4495585

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

server/priv/static/hydra.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,18 @@
5454
function runDefaultSketch() {
5555
// Simple colorful Hydra sketch
5656
// Creates flowing gradients with rotation
57-
osc(10, 0.1, 1.2)
57+
const defaultCode = `osc(10, 0.1, 1.2)
5858
.color(0.9, 0.7, 0.8)
5959
.diff(osc(12, 0.08)
6060
.rotate(0.3))
6161
.modulateScale(osc(2)
6262
.rotate(() => time * 0.05), 0.5)
6363
.blend(o0, 0.4)
64-
.out(o0);
64+
.out(o0)`;
65+
66+
eval(defaultCode);
67+
// Save as current sketch so it persists through resize
68+
window.currentSketch = defaultCode;
6569
}
6670

6771
// Function to update Hydra sketch with new code
@@ -76,6 +80,9 @@
7680
// Evaluate the new sketch code
7781
eval(code);
7882

83+
// Save the current sketch code for resize events
84+
window.currentSketch = code;
85+
7986
// Notify parent that sketch was updated successfully
8087
if (window.parent) {
8188
window.parent.postMessage({

0 commit comments

Comments
 (0)