One commited on
Commit
ca9dc46
·
verified ·
1 Parent(s): 14452e2

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +10 -4
index.html CHANGED
@@ -1008,6 +1008,9 @@ function buildScene() {
1008
  const nStalks = 2 + ((Math.random() * 3) | 0); // 2..4 stalks per bundle
1009
  for (let j = 0; j < nStalks; j++) {
1010
  const hue = clusterHue + rand(-15, 15);
 
 
 
1011
  const st = {
1012
  x: cx + rand(-20, 20),
1013
  h: rand(H * 0.35, H * 0.65), // much taller than foreground seaweed
@@ -1015,8 +1018,10 @@ function buildScene() {
1015
  phase: rand(0, Math.PI * 2),
1016
  speed: rand(0.7, 1.3), // slower, more gentle sway
1017
  hue,
1018
- width: rand(3, 6), // thinner than before (was too thick)
1019
- tipW: rand(1.5, 3),
 
 
1020
  branches: [],
1021
  // organic curve parameters (same as foreground seaweed)
1022
  cA1: rand(8, 15), cF1: rand(0.8, 1.6), cP1: rand(0, Math.PI * 2),
@@ -1444,7 +1449,7 @@ function stalkCurveX(w, f) {
1444
 
1445
  // v4: pre-rendered blurry sprites for background seaweed (no runtime blur cost)
1446
  function buildBackSeaweedSprites() {
1447
- const BLUR = 8; // blur amount baked into the sprite at build time
1448
  const PAD = 30; // extra space around stalk for blur spill
1449
 
1450
  for (const w of backSeaweeds) {
@@ -1479,7 +1484,8 @@ function buildBackSeaweedSprites() {
1479
  spr.height = bh;
1480
  const sc = spr.getContext("2d");
1481
 
1482
- // Apply blur filter (baked in at build time)
 
1483
  sc.filter = `blur(${BLUR}px)`;
1484
 
1485
  // Draw the stalk as a tapered blade
 
1008
  const nStalks = 2 + ((Math.random() * 3) | 0); // 2..4 stalks per bundle
1009
  for (let j = 0; j < nStalks; j++) {
1010
  const hue = clusterHue + rand(-15, 15);
1011
+ // v4.2: depth split — ~66% "near" (half blur, slightly thinner) for a layered look,
1012
+ // the rest stay far back with the heavy blur.
1013
+ const near = Math.random() < 0.66;
1014
  const st = {
1015
  x: cx + rand(-20, 20),
1016
  h: rand(H * 0.35, H * 0.65), // much taller than foreground seaweed
 
1018
  phase: rand(0, Math.PI * 2),
1019
  speed: rand(0.7, 1.3), // slower, more gentle sway
1020
  hue,
1021
+ near,
1022
+ blur: near ? 4 : 8, // baked into sprite at build time (no runtime cost)
1023
+ width: near ? rand(2.5, 5) : rand(3, 6),
1024
+ tipW: near ? rand(1.2, 2.4) : rand(1.5, 3),
1025
  branches: [],
1026
  // organic curve parameters (same as foreground seaweed)
1027
  cA1: rand(8, 15), cF1: rand(0.8, 1.6), cP1: rand(0, Math.PI * 2),
 
1449
 
1450
  // v4: pre-rendered blurry sprites for background seaweed (no runtime blur cost)
1451
  function buildBackSeaweedSprites() {
1452
+ const BLUR_MAX = 8; // far-back blur; near stalks use half (see st.blur)
1453
  const PAD = 30; // extra space around stalk for blur spill
1454
 
1455
  for (const w of backSeaweeds) {
 
1484
  spr.height = bh;
1485
  const sc = spr.getContext("2d");
1486
 
1487
+ // Apply per-stalk blur filter (baked in at build time — zero runtime cost)
1488
+ const BLUR = w.blur || BLUR_MAX;
1489
  sc.filter = `blur(${BLUR}px)`;
1490
 
1491
  // Draw the stalk as a tapered blade