<?xml version="1.0" encoding="UTF-8"?>

<MNPreset formatVersion="1">
  <metadata name="Scene Mario" author="Darc Sector" category="Visual" type="Effect"
            purpose="effect" description="Cinemnode: a cinemagraph tool by Darc Sector. Effects to lay over a picture of your own (a Widget Image under the see-through Scene, 1920 x 1080). Signs with a shader that you drag into shape over the picture (perspective, corner by corner), lit windows, neon, and lights that blink, twinkle or flicker. Edit mode for placing, and a clean picture for full screen in Perform."
            bundle="" tags="scene,visual,shader,photo" createdAt="1792930574335"
            modifiedAt="1792937853085" pluginVersion="1.1.7" isFavorite="0"
            preferredOpenMode="perform"/>
  <state>
    <marionietoworld.MNodes_State pv="1.1.7" gridActive="1" gridSize="60" viewOffsetX="-4696.51513671875"
                                  viewOffsetY="-6033.33154296875" zoom="5.924045085906982" didInitView="1"
                                  toolbarX="-1" toolbarY="-1" toolbarExpanded="1" transportBpm="120.0"
                                  transportSync="0" transportTimeSigNum="4" transportTimeSigDen="4">
      <lab recipeType="0" tagMask="17" instTagMask="16" complexity="45"
           createNewPatch="1" replaceSelectedSubgraph="0" wrapInSubgraph="0"
           generateFrontPanel="1" panelStyle="1" panelMode="0" creativity="30"
           instVoicing="1" instVoices="3" instGlide="1" instSource="0"/>
      <nodes nextId="25">
        <node id="1" type="visual.gpucanvas" title="Cinemnode" expanded="0"
              x="0.0" y="0.0" w="1920.0" h="1114.0">
          <state in="0.0" inb="0.0" codein="0.0" zonesin="0.0" setrow="0.0" scriptin="0.0"
                 appearanceRow="0.0" pcount="31" speed="1.0" p1="0.07776671648025513"
                 p2="0.4982042610645294" p3="0.132221981883049" p4="0.4939879179000854"
                 p5="0.1392892748117447" p6="0.7678016424179077" p7="0.09143856167793274"
                 p8="0.7711165547370911" p9="0.3499999940395355" p10="0.7000619173049927"
                 p11="0.0" p12="0.6000000238418579" p13="0.6000000238418579" p14="0.0"
                 p15="0.0" p16="0.0" p17="0.0" p18="1.0" p19="0.6039215922355652"
                 p20="0.2352941185235977" p21="0.3499999940395355" p22="0.300000011920929"
                 p23="0.03573033586144447" p24="0.0" p25="0.5021874904632568"
                 p26="0.5082551836967468" p27="0.06697916984558105" p28="0.0"
                 p29="0.0" p30="0.0" p31="0.5" mousex="0.6477627754211426" mousey="0.07567065954208374"
                 wheel="0.0" dragx="0.2822152972221375" dragy="0.3216468691825867"
                 imouse="0.6478 0.0757 0.6478 0.0757" code="// Made by the Cinemnode Script: change the Script, not this.&#10;// LZ is 0, but the compiler cannot know it: loops stay loops instead of being unrolled, so the shader compiles faster&#10;#define LZ min(iFrame, 0)&#10;// the picture, read with no mipmap guess: works the same inside those loops on every graphics driver&#10;vec4 tex0(vec2 uv) { return textureLod(iImage0, uv, 0.0); }&#10;// Cinemnode (was Scene Kit): shared helpers and effects. The Script adds mainImage with every element.&#10;float h11(float n) { return fract(sin(n * 12.9898) * 43758.5453); }&#10;float h21(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }&#10;float vnoise(vec2 p)&#10;{&#10;    vec2 i = floor(p), f = fract(p);&#10;    f = f * f * (3.0 - 2.0 * f);&#10;    return mix(mix(h21(i), h21(i + vec2(1.0, 0.0)), f.x), mix(h21(i + vec2(0.0, 1.0)), h21(i + vec2(1.0, 1.0)), f.x), f.y);&#10;}&#10;float vnoise1(float x)&#10;{&#10;    float i = floor(x), f = fract(x);&#10;    f = f * f * (3.0 - 2.0 * f);&#10;    return mix(h11(i), h11(i + 1.0), f);&#10;}&#10;&#10;// Where p lies in the quad a (top left), b (top right), c (bottom right), d (bottom left): 0..1 each way, v down.&#10;// A perspective (projective) map, so a flat sign photographed at an angle is filled the way it really is.&#10;vec2 quadUV(vec2 p, vec2 a, vec2 b, vec2 c, vec2 d)&#10;{&#10;    float sx = a.x - b.x + c.x - d.x, sy = a.y - b.y + c.y - d.y;&#10;    float dx1 = b.x - c.x, dx2 = d.x - c.x, dy1 = b.y - c.y, dy2 = d.y - c.y;&#10;    float den = dx1 * dy2 - dx2 * dy1;&#10;    if (abs(den) &lt; 1e-9) return vec2(-10.0);&#10;    float g = (sx * dy2 - dx2 * sy) / den;&#10;    float h = (dx1 * sy - sx * dy1) / den;&#10;    float A = b.x - a.x + g * b.x, B = d.x - a.x + h * d.x, C = a.x;&#10;    float D = b.y - a.y + g * b.y, E = d.y - a.y + h * d.y, F = a.y;&#10;    // the inverse, by the adjugate (the determinant cancels in the division)&#10;    float i00 = E - F * h, i01 = C * h - B, i02 = B * F - C * E;&#10;    float i10 = F * g - D, i11 = A - C * g, i12 = C * D - A * F;&#10;    float i20 = D * h - E * g, i21 = B * g - A * h, i22 = A * E - B * D;&#10;    vec3 r = vec3(i00 * p.x + i01 * p.y + i02, i10 * p.x + i11 * p.y + i12, i20 * p.x + i21 * p.y + i22);&#10;    vec2 m = (a + b + c + d) * 0.25;&#10;    float wm = i20 * m.x + i21 * m.y + i22;&#10;    if (r.z * wm &lt;= 0.0) return vec2(-10.0);   // beyond the vanishing line&#10;    return r.xy / r.z;&#10;}&#10;&#10;// ---------- effects for a sign: each gives a colour and how much of it covers ----------&#10;vec4 fxPlasma(vec2 uv, float t, vec3 tint)&#10;{&#10;    vec2 p = uv * 6.0;&#10;    float v = sin(p.x + t) + sin(p.y * 1.3 - t * 1.1) + sin((p.x + p.y) * 0.7 + t * 0.8) + sin(length(p - 3.0) * 1.5 - t * 1.6);&#10;    vec3 c = 0.5 + 0.5 * cos(6.2832 * (v * 0.15 + vec3(0.0, 0.33, 0.67)) + t * 0.3);&#10;    return vec4(mix(c, c * tint, 0.35), 1.0);&#10;}&#10;&#10;vec4 fxText(vec2 uv, float t, vec3 tint, float cov)&#10;{&#10;    vec3 bg = vec3(0.015, 0.015, 0.03) + tint * 0.05 * (0.5 + 0.5 * sin(uv.y * 300.0));&#10;    vec3 c = mix(bg, tint * 1.5 + 0.15, cov);&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;vec4 fxGlitch(vec2 uv, float t, vec3 tint)&#10;{&#10;    float band = floor(uv.y * 24.0);&#10;    float g = step(0.82, h21(vec2(band, floor(t * 8.0))));&#10;    vec2 u = uv;&#10;    u.x += g * (h21(vec2(band, floor(t * 16.0))) - 0.5) * 0.3;&#10;    vec3 c = vec3(h21(floor(u * vec2(160.0, 90.0)) + floor(t * 24.0))) * 0.3;&#10;    vec2 cell = floor(u * vec2(8.0, 4.0) + vec2(t * 0.5, 0.0));&#10;    c += tint * step(0.6, h21(cell + floor(t * 2.0))) * 0.75;&#10;    c.r += 0.35 * g;&#10;    c.b += 0.3 * step(0.9, h21(vec2(band * 3.1, floor(t * 12.0))));&#10;    c *= 0.8 + 0.2 * sin(uv.y * 420.0);&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;vec4 fxBars(vec2 uv, float t, vec3 tint)&#10;{&#10;    float x = fract(uv.x + t * 0.04);&#10;    float i = floor(x * 7.0);&#10;    vec3 c = vec3((i &lt; 1.5 || (i &gt; 3.5 &amp;&amp; i &lt; 5.5)) ? 1.0 : 0.0, i &lt; 3.5 ? 1.0 : 0.0, mod(i, 2.0) &lt; 0.5 ? 1.0 : 0.0) * 0.8;&#10;    if (uv.y &gt; 0.78) c = vec3(fract(uv.x * 4.0 - t * 0.2)) * 0.9;&#10;    float roll = fract(uv.y - t * 0.15);&#10;    c *= 1.0 - 0.35 * smoothstep(0.9, 1.0, roll);&#10;    c += (h21(floor(uv * vec2(200.0, 120.0)) + floor(t * 30.0)) - 0.5) * 0.08;&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;vec4 fxRetro(vec2 uv, float t, vec3 tint)&#10;{&#10;    vec2 p = vec2(uv.x - 0.5, 1.0 - uv.y);&#10;    float hz = 0.42;&#10;    vec3 c;&#10;    if (p.y &gt; hz) {&#10;        c = mix(vec3(0.35, 0.05, 0.4), vec3(0.03, 0.0, 0.12), (p.y - hz) / (1.0 - hz));&#10;        vec2 s = vec2(p.x * 1.6, p.y - 0.62);&#10;        float r = length(s);&#10;        float gaps = step(0.5, fract((p.y - hz) * 22.0 + t * 0.6)) + step(0.7, p.y);&#10;        c = mix(c, mix(vec3(1.0, 0.25, 0.5), vec3(1.0, 0.85, 0.2), (p.y - 0.42) / 0.38), (1.0 - smoothstep(0.24, 0.25, r)) * min(gaps, 1.0));&#10;    } else {&#10;        float z = 0.08 / max(hz - p.y, 0.001);&#10;        vec2 g = vec2(p.x * z * 6.0, z + t);&#10;        vec2 f = abs(fract(g) - 0.5);&#10;        float w = 0.04 * z;&#10;        float line = max(1.0 - smoothstep(0.0, w + 0.02, 0.5 - f.x), 1.0 - smoothstep(0.0, w + 0.02, 0.5 - f.y));&#10;        c = mix(vec3(0.03, 0.0, 0.08), tint * 0.6 + vec3(0.6, 0.1, 0.8) * 0.6, line * exp(-z * 0.05));&#10;    }&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;&#10;vec4 fxWindow(vec2 uv, float t, vec3 tint)   // added to the photo: a lit window&#10;{&#10;    float e = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));&#10;    float f = 0.85 + 0.15 * vnoise1(t * 5.0);&#10;    float lit = (0.6 + 0.4 * smoothstep(0.0, 0.12, e)) * (1.0 - 0.3 * uv.y);   // lighter towards the ceiling lamp&#10;    return vec4(tint * f * lit * 0.8, 1.0);&#10;}&#10;&#10;vec4 fxNeon(vec2 uv, float t, vec3 tint)     // added to the photo: a neon tube along the edge&#10;{&#10;    float e = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));&#10;    float tube = 1.0 - smoothstep(0.006, 0.016, abs(e - 0.035));&#10;    float glow = exp(-abs(e - 0.035) * 30.0) * 0.5;&#10;    float on = 0.85 + 0.15 * sin(t * 40.0) * step(0.93, h11(floor(t * 3.0)));&#10;    return vec4(tint * (tube * 1.6 + glow) * on, 1.0);&#10;}&#10;&#10;// ---------- lights ----------&#10;// mode: 0 on, 1 slow blink, 2 twinkle, 3 broken tube, 4 pulse, 5 strobe, 6 candle, 7 traffic light (its colour changes, see trafficCol),&#10;// 8 aircraft (a double flash now and then), 9 lens flare (on, with a flare drawn by fxFlare)&#10;float lampAmp(int mode, float t, float seed)&#10;{&#10;    if (mode == 1) { float s = fract(t * 0.5 + seed); return smoothstep(0.0, 0.08, s) * (1.0 - smoothstep(0.5, 0.58, s)); }&#10;    if (mode == 2) { float n = vnoise1(t * 4.0 + seed * 37.0); return 0.12 + 1.2 * n * n * n; }&#10;    if (mode == 3) {&#10;        float bad = h11(floor(t * 0.7) + seed * 91.0);&#10;        float fast = step(0.4, h11(floor(t * 17.0) + seed * 13.0));&#10;        return bad &gt; 0.55 ? fast * 0.95 : 0.9 + 0.1 * vnoise1(t * 30.0);&#10;    }&#10;    if (mode == 4) return 0.55 + 0.45 * sin(6.2832 * (t * 0.5 + seed));&#10;    if (mode == 5) { float s = fract(t * 2.0 + seed); return 1.0 - smoothstep(0.0, 0.07, s); }&#10;    if (mode == 6) return 0.7 + 0.3 * vnoise1(t * 7.0 + seed * 20.0) * (0.6 + 0.4 * vnoise1(t * 2.3 + seed * 5.0));&#10;    if (mode == 8) { float s = fract(t * 0.6 + seed); return 1.0 - smoothstep(0.0, 0.04, s) + (1.0 - smoothstep(0.12, 0.16, s)) * step(0.1, s); }&#10;    return 1.0;&#10;}&#10;&#10;vec3 trafficCol(float t)   // red, then green, then amber, round again&#10;{&#10;    float s = mod(t, 8.0);&#10;    return s &lt; 3.5 ? vec3(1.0, 0.08, 0.05) : s &lt; 7.0 ? vec3(0.1, 1.0, 0.35) : vec3(1.0, 0.6, 0.05);&#10;}&#10;&#10;vec3 lamp(vec2 fc, vec2 pos, float r, float amp, vec3 lc, float rays)&#10;{&#10;    vec2 d = fc - pos;&#10;    float l = length(d) / r;&#10;    if (rays &lt; 0.5 &amp;&amp; l &gt; 1.45) return vec3(0.0);   // past its reach it adds nothing: skip the rest&#10;    float g = exp(-l * l * 18.0) * 1.6 + 0.5 / (1.0 + l * l * 10.0) * (1.0 - smoothstep(0.4, 1.4, l));&#10;    vec2 a = abs(d) / r;&#10;    g += rays * (exp(-a.x * 40.0 - a.y * 2.2) + exp(-a.y * 40.0 - a.x * 2.2)) * 0.8;&#10;    return lc * amp * g;&#10;}&#10;&#10;// light added to what is drawn so far: C is the colour times its cover, A the cover&#10;void glowAdd(inout vec3 C, inout float A, vec3 add)&#10;{&#10;    C += add;&#10;    A = max(A, clamp(max(add.r, max(add.g, add.b)), 0.0, 1.0));&#10;}&#10;&#10;// rain: thin streaks falling a little slanted, in three layers (far ones smaller, slower and fainter).&#10;// p is the place on the screen in screen heights (y up), so the drops keep their size on any sign&#10;vec4 fxRain(vec2 p, float t, vec3 tint)&#10;{&#10;    float a = 0.0;&#10;    for (int i = 0; i &lt; 3 + LZ; i++) {&#10;        float fi = float(i);&#10;        float sc = 1.0 + fi * 0.8;                    // far layers: more, smaller drops&#10;        float cols = 70.0 * sc;&#10;        float x = (p.x + p.y * 0.12) * cols;          // slanted by the wind&#10;        float cx = floor(x);&#10;        float r1 = h21(vec2(cx, fi * 17.0)), r2 = h21(vec2(cx, fi * 31.0 + 5.0));&#10;        float len = 0.10 / sc;                         // a drop's streak, in screen heights&#10;        float y = p.y * (1.0 / len) * 0.25 + t * (9.0 - fi * 2.0) * (0.8 + 0.4 * r1) + r2 * 10.0;&#10;        float drop = fract(y);&#10;        float streak = smoothstep(0.0, 0.05, drop) * (1.0 - smoothstep(0.08, 0.25, drop));&#10;        float thin = 1.0 - smoothstep(0.06, 0.16, abs(fract(x) - 0.5));&#10;        float here = step(0.55, h21(vec2(cx, floor(y) + fi * 7.0)));   // not every column has a drop each time&#10;        a += streak * thin * here * (0.6 - fi * 0.17);&#10;    }&#10;    return vec4(tint, clamp(a, 0.0, 1.0));   // only the streaks cover: the picture shows between them&#10;}&#10;&#10;// ripples in water: rings that start in the middle of the sign and spread out, three at a time, fading as they go.&#10;// The crests are drawn light (tint), the troughs dark, each only as much as strength says; between the rings it is clear.&#10;// size: how far a ring gets (0.5 = to the edge of the sign)&#10;float rippleV(vec2 uv, float t, float size)   // the water's height: + crests, - troughs&#10;{&#10;    float r = length(uv - 0.5) * 2.0;             // 0 in the middle, 1 at the sides&#10;    float rmax = 0.15 + 1.25 * size;&#10;    float v = 0.0;&#10;    for (int k = 0; k &lt; 3 + LZ; k++) {&#10;        float age = fract(t * 0.25 + float(k) / 3.0);&#10;        float d = r - age * rmax;                  // how far behind the front of this ring&#10;        float w = 0.05 + 0.08 * age;               // the rings widen as they spread&#10;        v += sin(d / w * 3.1416 * 1.5) * exp(-d * d / (w * w * 2.0)) * (1.0 - age) * (1.0 - age);&#10;    }&#10;    return v * (1.0 - smoothstep(0.85, 1.0, r));  // dies out before the edge of the sign&#10;}&#10;&#10;vec4 fxRipple(vec2 uv, float t, vec3 tint, float size, float strength)&#10;{&#10;    float v = rippleV(uv, t, size);&#10;    float a = clamp(abs(v) * strength * 1.6, 0.0, 1.0);&#10;    return vec4(v &gt; 0.0 ? tint : vec3(0.0), a);&#10;}&#10;&#10;// ---------- edit aids (only with a background in Image 1) ----------&#10;float lumaAt(vec2 uv) { return dot(tex0(uv).rgb, vec3(0.299, 0.587, 0.114)); }&#10;&#10;// how much of an edge the picture has here (Sobel), so windows, signs and lamps stand out to place things on&#10;float edgeAt(vec2 uv)&#10;{&#10;    vec2 e = 1.5 / iResolution.xy;&#10;    float tl = lumaAt(uv + vec2(-e.x, e.y)), t = lumaAt(uv + vec2(0.0, e.y)), tr = lumaAt(uv + e);&#10;    float l = lumaAt(uv - vec2(e.x, 0.0)), r = lumaAt(uv + vec2(e.x, 0.0));&#10;    float bl = lumaAt(uv - e), b = lumaAt(uv - vec2(0.0, e.y)), br = lumaAt(uv + vec2(e.x, -e.y));&#10;    float gx = tr + 2.0 * r + br - tl - 2.0 * l - bl;&#10;    float gy = tl + 2.0 * t + tr - bl - 2.0 * b - br;&#10;    return smoothstep(0.08, 0.3, length(vec2(gx, gy)));&#10;}&#10;&#10;// a round magnifier beside the point p (pixels): the background 4 times bigger, with a cross on p&#10;void magnifier(inout vec3 C, vec2 fc, vec2 p)&#10;{&#10;    vec2 R = iResolution.xy;&#10;    float S = R.y / 1080.0, rad = 110.0 * S;&#10;    vec2 off = vec2(p.x &gt; R.x - 300.0 * S ? -150.0 : 150.0, p.y &gt; R.y - 300.0 * S ? -150.0 : 150.0) * S;&#10;    vec2 m = p + off;&#10;    float d = length(fc - m);&#10;    if (d &gt; rad + 3.0 * S) return;&#10;    vec2 src = p + (fc - m) / 4.0;&#10;    vec3 col = tex0(src / R).rgb;&#10;    vec2 a = abs(fc - m);&#10;    float cross = (1.0 - smoothstep(0.5, 1.5, min(a.x, a.y) / S)) * step(max(a.x, a.y), 18.0 * S);&#10;    col = mix(col, vec3(0.54, 0.25, 1.0), cross);&#10;    C = mix(col, vec3(0.54, 0.25, 1.0), smoothstep(rad - 1.0, rad, d));&#10;}&#10;&#10;// ---------- v1.6 ----------&#10;float lum(vec3 c) { return dot(c, vec3(0.299, 0.587, 0.114)); }&#10;float fbm(vec2 p)&#10;{&#10;    float v = 0.0, a = 0.5;&#10;    for (int i = 0; i &lt; 5 + LZ; i++) { v += a * vnoise(p); p = p * 2.03 + vec2(1.7, 9.2); a *= 0.5; }&#10;    return v;&#10;}&#10;&#10;// how an effect follows the picture under it: 1 its light and shade show through, 2 only on bright parts, 3 only on dark parts&#10;void picReact(inout vec4 s, int mode, vec3 pic)&#10;{&#10;    float l = lum(pic);&#10;    if (mode == 1) s.rgb *= 0.25 + 1.5 * l;&#10;    if (mode == 2) s.a *= smoothstep(0.3, 0.6, l);&#10;    if (mode == 3) s.a *= 1.0 - smoothstep(0.3, 0.6, l);&#10;}&#10;&#10;// clouds drifting across the board, see-through between them, fading at its edges&#10;vec4 fxClouds(vec2 uv, float t, vec3 tint)&#10;{&#10;    vec2 p = uv * vec2(3.0, 2.0) + vec2(t * 0.15, 0.0);&#10;    float n = fbm(p + 0.5 * fbm(p * 0.7 - vec2(t * 0.05, 0.0)));&#10;    float a = smoothstep(0.42, 0.75, n);&#10;    vec3 col = mix(tint * 0.55, tint, smoothstep(0.45, 0.9, n));   // lit tops, darker bellies&#10;    float e = smoothstep(0.0, 0.15, uv.x) * smoothstep(0.0, 0.15, 1.0 - uv.x) * smoothstep(0.0, 0.15, uv.y) * smoothstep(0.0, 0.15, 1.0 - uv.y);&#10;    return vec4(col, a * e);&#10;}&#10;&#10;// smoke rising from the middle of the board's bottom edge, swaying and widening as it goes up, gone at the top&#10;vec4 fxSmoke(vec2 uv, float t, vec3 tint)&#10;{&#10;    float h = 1.0 - uv.y;                          // 0 at the bottom, 1 at the top&#10;    float x = uv.x - 0.5;&#10;    float sway = (fbm(vec2(h * 1.5 - t * 0.25, 3.0)) - 0.5) * 0.5 * h;&#10;    float wdt = 0.05 + 0.32 * h;&#10;    float plume = exp(-pow((x - sway) / wdt, 2.0));&#10;    float n = fbm(vec2(x * 4.0 / (0.3 + h), h * 3.0 - t * 0.8));&#10;    float a = plume * (0.35 + 0.65 * smoothstep(0.2, 0.65, n)) * (1.0 - smoothstep(0.5, 1.0, h)) * smoothstep(0.0, 0.06, h);&#10;    return vec4(tint * (0.6 + 0.4 * n), clamp(a * 0.9, 0.0, 1.0));&#10;}&#10;&#10;// a lit rectangle (cov: how much of the pixel is inside) with a glow round it, glow 0..1 its reach&#10;vec4 fxLightBox(vec2 uv, float cov, float amp, vec3 tint, float glow)&#10;{&#10;    vec2 d = max(abs(uv - 0.5) - 0.5, 0.0);&#10;    float g = exp(-length(d) * (3.0 + 30.0 * (1.0 - glow)));&#10;    return vec4(tint * amp * (cov * 0.95 + (1.0 - cov) * g * 0.7), 1.0);&#10;}&#10;&#10;// the picture's colour round a spot (5 samples, so one odd pixel does not decide it)&#10;vec3 keyColour(vec2 k)&#10;{&#10;    vec2 e = 2.0 / iResolution.xy;&#10;    return (tex0(k).rgb + tex0(k + vec2(e.x, 0.0)).rgb + tex0(k - vec2(e.x, 0.0)).rgb +&#10;            tex0(k + vec2(0.0, e.y)).rgb + tex0(k - vec2(0.0, e.y)).rgb) / 5.0;&#10;}&#10;&#10;// light added where the picture has (nearly) the key colour: tol how near, soft how gently it fades&#10;vec4 fxKeyGlow(vec3 pic, vec3 key, float tol, float soft, float amp, vec3 tint)&#10;{&#10;    float t0 = 0.02 + 0.45 * tol;&#10;    float mk = 1.0 - smoothstep(t0, t0 + 0.02 + 0.3 * soft, length(pic - key));&#10;    return vec4(tint * mk * amp * (0.6 + 0.8 * lum(pic)), 1.0);&#10;}&#10;&#10;// ---------- v1.7: edges that tell straight from round ----------&#10;// the picture's brightness gradient (Sobel), measured e pixels apart&#10;vec2 gradAt(vec2 uv, vec2 e)&#10;{&#10;    float tl = lumaAt(uv + vec2(-e.x, e.y)), t = lumaAt(uv + vec2(0.0, e.y)), tr = lumaAt(uv + e);&#10;    float l = lumaAt(uv - vec2(e.x, 0.0)), r = lumaAt(uv + vec2(e.x, 0.0));&#10;    float bl = lumaAt(uv - e), b = lumaAt(uv - vec2(0.0, e.y)), br = lumaAt(uv + vec2(e.x, -e.y));&#10;    return vec2(tr + 2.0 * r + br - tl - 2.0 * l - bl, tl + 2.0 * t + tr - bl - 2.0 * b - br);&#10;}&#10;&#10;// Edges with a filter: 0 all (green straight, pink round, white the rest), 1 straight only, 2 round only.&#10;// An edge is straight when it runs the same way a little further along it on both sides, round when it turns&#10;// gently (a corner turns sharply and counts as neither). sens 0..1 finds fainter edges, width 0..1 draws them wider.&#10;void edgeView(inout vec3 C, vec2 uv, int filt, float sens, float width)&#10;{&#10;    vec2 px = 1.0 / iResolution.xy;&#10;    vec2 e = px * (1.0 + 3.0 * width);&#10;    vec2 g = gradAt(uv, e);&#10;    float mag = length(g);&#10;    float thr = 0.8 * pow(0.04, sens);            // sens 0: only hard edges, 1: faint ones too&#10;    float on = smoothstep(thr * 0.7, thr * 1.3, mag);&#10;    if (on &lt;= 0.0) return;&#10;    vec2 n = g / max(mag, 1e-5);&#10;    // look about 24 pixels along the edge each way; a curve has bent away from the straight line by then,&#10;    // so search a little across it for where the edge is strongest&#10;    vec2 e2 = px * 2.5 * (1.0 + width);&#10;    vec2 n0 = gradAt(uv, e2);&#10;    n0 /= max(length(n0), 1e-5);&#10;    vec2 tg = vec2(-n0.y, n0.x) * 24.0 * px * (1.0 + width);&#10;    vec2 ga = vec2(0.0), gb = vec2(0.0);&#10;    for (int k = -3; k &lt;= 3; k++) {&#10;        vec2 o = n0 * float(k) * 3.0 * px;&#10;        vec2 a = gradAt(uv + tg + o, e2), b = gradAt(uv - tg + o, e2);&#10;        if (length(a) &gt; length(ga)) ga = a;&#10;        if (length(b) &gt; length(gb)) gb = b;&#10;    }&#10;    float ma = length(ga), mb = length(gb);&#10;    // how far the edge turns on each side, in radians; a side with no edge counts as a sharp turn&#10;    float ta = ma &gt; thr * 0.5 ? acos(clamp(abs(dot(n0, ga / ma)), 0.0, 1.0)) : 2.0;&#10;    float tb = mb &gt; thr * 0.5 ? acos(clamp(abs(dot(n0, gb / mb)), 0.0, 1.0)) : 2.0;&#10;    float turn = max(ta, tb);&#10;    float straight = 1.0 - smoothstep(0.05, 0.09, turn);&#10;    // round: both sides turn, gently (a corner turns about 1.57 and is neither)&#10;    float round_ = smoothstep(0.08, 0.14, min(ta, tb)) * (1.0 - smoothstep(0.7, 1.0, turn));&#10;    vec3 green = vec3(0.25, 1.0, 0.45), pink = vec3(1.0, 0.35, 0.85);&#10;    if (filt == 1) { C = mix(C, green, on * straight * 0.9); return; }&#10;    if (filt == 2) { C = mix(C, pink, on * round_ * 0.9); return; }&#10;    vec3 col = straight &gt; 0.5 ? green : round_ &gt; 0.5 ? pink : vec3(0.85);&#10;    C = mix(C, col, on * (straight &gt; 0.5 || round_ &gt; 0.5 ? 0.9 : 0.45));&#10;}&#10;&#10;// ---------- v1.8: how much of this pixel the quad covers, measured on screen ----------&#10;// The smallest distance in pixels to the four sides (plus half a pixel), so the edge is smooth however steep the&#10;// perspective. Measuring on the board's own 0..1 (as before) broke down near its vanishing line: thin stray lines.&#10;float sideDist(vec2 p, vec2 u, vec2 v, float s)&#10;{&#10;    vec2 t = v - u;&#10;    return s * (t.x * (p.y - u.y) - t.y * (p.x - u.x)) / max(length(t), 1e-4);&#10;}&#10;float quadCov(vec2 q, vec2 a, vec2 b, vec2 c, vec2 d, vec2 R)&#10;{&#10;    vec2 p = q * R; a *= R; b *= R; c *= R; d *= R;&#10;    float area = (a.x * b.y - b.x * a.y) + (b.x * c.y - c.x * b.y) + (c.x * d.y - d.x * c.y) + (d.x * a.y - a.x * d.y);&#10;    float s = area &lt; 0.0 ? -1.0 : 1.0;&#10;    float e = min(min(sideDist(p, a, b, s), sideDist(p, b, c, s)), min(sideDist(p, c, d, s), sideDist(p, d, a, s)));&#10;    return clamp(e + 0.5, 0.0, 1.0);&#10;}&#10;&#10;// ---------- v1.9: Edge glow, the picture's own edges light up ----------&#10;// uv: where on the picture (as texture() counts), amp: the light mode, sens 0..1: fainter edges too,&#10;// width 0..1: a wider glow round them, style 0 glow, 1 a wave running over them, 2 sparkles along them.&#10;vec4 fxEdgeGlow(vec2 uv, float t, float amp, vec3 tint, float sens, float width, int style)&#10;{&#10;    vec2 px = 1.0 / iResolution.xy;&#10;    vec2 e = px * 1.5;&#10;    float thr = 0.8 * pow(0.04, sens);&#10;    float core = smoothstep(thr * 0.7, thr * 1.3, length(gradAt(uv, e)));&#10;    float halo = 0.0;   // edges a little way off, for the glow round them&#10;    float r = 3.0 + 18.0 * width;&#10;    for (int j = 0; j &lt; 12 + LZ; j++) {   // at three distances, turned a little each time, so the glow has no rings in it&#10;        float a = float(j) * 2.3998;&#10;        float d = r * (0.3 + 0.35 * float(j % 3));&#10;        halo += smoothstep(thr * 0.5, thr * 1.3, length(gradAt(uv + vec2(cos(a), sin(a)) * d * px, e))) * (1.15 - 0.3 * float(j % 3));&#10;    }&#10;    halo /= 12.0;&#10;    float k = 1.0;&#10;    vec2 fc = uv * iResolution.xy;&#10;    if (style == 1)&#10;        k = 0.15 + 1.6 * pow(0.5 + 0.5 * sin((fc.x * 0.8 + fc.y) * 0.012 - t * 3.0), 6.0);&#10;    else if (style == 2)&#10;        k = 0.1 + 2.0 * step(0.86, h21(floor(fc / 5.0) + floor(t * 6.0))) * core;&#10;    return vec4(tint * (core * 1.5 + halo * (0.3 + 0.9 * width)) * amp * k, 1.0);&#10;}&#10;&#10;// ---------- Cinemnode v1.1: the picture itself moves (m: where in the board, 0..1 from its top left) ----------&#10;float edgeFade(vec2 m, float w) { return smoothstep(0.0, w, min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }&#10;vec3 picAt(vec2 uv) { return tex0(uv).rgb; }&#10;&#10;vec4 fxFlow(vec2 uv, vec2 m, float t, float dir, float len)   // water runs one way: two phases, faded into each other&#10;{&#10;    float a = dir * 6.2831853;&#10;    vec2 d = vec2(sin(a), -cos(a));   // 0: down, 90: right, 180: up, 270: left&#10;    float L = (0.008 + 0.07 * len) * edgeFade(m, 0.1);&#10;    float ph = vnoise(uv * 9.0) * 0.6;&#10;    float p1 = fract(t * 0.3 + ph), p2 = fract(t * 0.3 + ph + 0.5);&#10;    float w = 1.0 - abs(2.0 * p1 - 1.0);&#10;    return vec4(mix(picAt(uv - d * L * p2), picAt(uv - d * L * p1), w), 1.0);&#10;}&#10;&#10;vec4 fxSway(vec2 uv, vec2 m, float t, float wind, float size, int style)   // 0 grass (fixed at the bottom), 1 leaves, 2 flag (fixed on the left)&#10;{&#10;    float k = 2.0 + 10.0 * (1.0 - size);&#10;    float gust = 0.65 + 0.35 * sin(t * 0.37) * sin(t * 0.23 + 1.0);&#10;    float fade = edgeFade(m, 0.15);&#10;    vec2 off;&#10;    float shade = 1.0;&#10;    if (style == 2) {&#10;        float w = sin(m.x * k - t * 4.0 + vnoise(m * 3.0 + t * 0.3) * 2.0);&#10;        off = vec2(0.15 * w, w) * m.x;&#10;        shade = 1.0 + 0.18 * wind * cos(m.x * k - t * 4.0) * m.x;&#10;    } else {&#10;        float w = style == 0 ? 1.0 - m.y : 0.55 + 0.45 * vnoise(m * k + 4.0);&#10;        off = vec2(sin(t * 2.0 + m.x * k * 0.7 + vnoise(m * k) * 3.0) + 0.5 * sin(t * 3.3 + m.y * k), 0.0) * w;&#10;    }&#10;    off *= wind * 0.018 * gust * (style == 2 ? 1.0 : fade);&#10;    return vec4(picAt(uv + vec2(off.x, -off.y)) * shade, 1.0);&#10;}&#10;&#10;vec4 fxHaze(vec2 uv, vec2 m, float t, float amt, float size)   // air that trembles, rising, strongest low down&#10;{&#10;    vec2 p = m * (6.0 + 30.0 * (1.0 - size)) + vec2(0.0, t * 1.5);&#10;    vec2 d = vec2(vnoise(p) - 0.5, vnoise(p + 17.3) - 0.5);&#10;    d *= amt * 0.014 * edgeFade(m, 0.12) * (0.4 + 0.6 * m.y);&#10;    return vec4(picAt(uv + vec2(d.x, -d.y)), 1.0);&#10;}&#10;&#10;vec4 fxReflect(vec2 q, vec2 m, float t, vec2 a, vec2 b, float wave, float clear, vec3 tint, int style)   // the picture above the board's top edge, mirrored and rippling&#10;{&#10;    float top = mix(a.y, b.y, clamp(m.x, 0.0, 1.0));&#10;    float dy = max(q.y - top, 0.0);&#10;    float rx = (sin(dy * 260.0 / (1.0 + dy * 12.0) - t * 3.0) + 0.6 * (vnoise(vec2(q.x * 40.0, dy * 90.0 - t * 1.5)) - 0.5)) * wave * 0.008 * (0.3 + dy * 10.0);&#10;    vec2 r = vec2(q.x + rx, top - dy - 0.002);&#10;    vec3 col = picAt(vec2(r.x, 1.0 - r.y)) * mix(vec3(1.0), tint, 0.35) * 0.8;&#10;    if (style == 1) {   // a wet street: the lights stretched down in streaks, barely rippling&#10;        col = vec3(0.0);&#10;        for (int i = 0; i &lt; 8 + LZ; i++)&#10;            col += picAt(vec2(q.x + rx * 0.3, 1.0 - (top - dy * (0.6 + 0.08 * float(i)) - 0.002)));&#10;        col = col / 8.0 * mix(vec3(1.0), tint, 0.35) * 0.9;&#10;    }&#10;    return vec4(col, clear * smoothstep(0.0, 0.01, dy + 0.004));&#10;}&#10;&#10;vec4 fxBreathe(vec2 uv, vec2 m, float t, vec2 ctr, float amt, float soft)   // a very slow zoom and drift&#10;{&#10;    vec2 c = vec2(ctr.x, 1.0 - ctr.y);&#10;    float z = 1.0 - amt * 0.05 * (0.5 + 0.5 * sin(t * 0.5));&#10;    vec2 drift = amt * 0.004 * vec2(sin(t * 0.31), cos(t * 0.23));&#10;    vec3 moved = picAt(c + (uv - c) * z + drift);&#10;    return vec4(mix(picAt(uv), moved, soft &gt; 0.5 ? edgeFade(m, 0.15) : 1.0), 1.0);&#10;}&#10;&#10;// ---------- Cinemnode v1.1: laid over the picture ----------&#10;vec4 fxParticles(vec2 p, float t, vec3 tint, float amount, float size, int style)&#10;{   // 0 snow, 1 dust, 2 fireflies, 3 leaves, 4 blossom, 5 hail, 6 sand, 7 stars (p: fc / R.y). 1, 2 and 7 add light; the rest cover&#10;    vec3 c = vec3(0.0), col = tint;&#10;    float a = 0.0;&#10;    for (int L = 0; L &lt; 3 + LZ; L++) {&#10;        float fl = float(L);&#10;        float sc = (style == 7 ? 14.0 : style == 5 ? 9.0 : 5.0) + fl * 5.0;&#10;        vec2 off = style == 0 ? vec2(sin(t * 0.4 + fl) * 0.6, t * (1.2 + 0.5 * fl)) :&#10;                   style == 1 ? vec2(t * 0.12, sin(t * 0.2 + fl) * 0.3) :&#10;                   style == 2 ? vec2(sin(t * 0.1 + fl) * 0.3, -t * 0.08) :&#10;                   style == 3 || style == 4 ? vec2(t * 0.35 + sin(t * 0.5 + fl) * 0.8, t * (style == 3 ? 0.7 : 0.45) * (1.0 + 0.3 * fl)) :&#10;                   style == 5 ? vec2(t * 0.3, t * (5.0 + 1.5 * fl)) :&#10;                   style == 6 ? vec2(-t * (4.0 + 1.5 * fl), sin(t * 0.7 + fl) * 0.25) : vec2(fl * 3.1, 0.0);&#10;        vec2 g = p * sc + off;&#10;        vec2 id = floor(g), f = fract(g) - 0.5;&#10;        float h = h21(id + fl * 31.7);&#10;        if (h &gt; 0.15 + 0.85 * amount) continue;&#10;        vec2 o = (vec2(h21(id + 3.1), h21(id + 7.7)) - 0.5) * 0.5;&#10;        if (style == 0 || style == 3 || style == 4) o.x += 0.15 * sin(t * (1.0 + h) + h * 20.0);&#10;        if (style == 2) o += 0.2 * vec2(sin(t * (0.7 + h) + h * 20.0), cos(t * (0.9 + h) + h * 13.0));&#10;        float r = (0.04 + 0.1 * size) * (0.6 + 0.4 * h) * (1.0 - fl * 0.2);&#10;        vec2 d = f - o;&#10;        if (style == 3 || style == 4) {   // a leaf or a petal, turning and tumbling&#10;            float an = t * (1.0 + h) * 2.0 + h * 6.0;&#10;            d = mat2(cos(an), -sin(an), sin(an), cos(an)) * d;&#10;            d.y /= 0.35 + 0.4 * abs(sin(t * 2.0 + h * 10.0));&#10;            r *= style == 3 ? 1.6 : 1.1;&#10;        }&#10;        if (style == 6) { d.x /= 5.0; r *= 0.5; }&#10;        if (style == 5) r *= 0.5;&#10;        if (style == 7) r *= 0.35;&#10;        float dd = length(d);&#10;        float core = smoothstep(r, r * 0.3, dd);&#10;        float halo = style == 2 ? 0.06 * r / (dd * dd + 0.004) * 0.02 : style == 7 ? 0.0004 / (dd * dd + 0.0004) * 0.3 : 0.0;&#10;        float tw = style == 2 ? 0.5 + 0.5 * sin(t * 3.0 * (0.5 + h) + h * 40.0) :&#10;                   style == 1 ? 0.55 + 0.45 * sin(t * 2.0 + h * 30.0) :&#10;                   style == 7 ? 0.35 + 0.65 * pow(vnoise1(t * 3.0 + h * 50.0), 2.0) : 1.0;&#10;        vec3 pc = style == 3 ? mix(tint, tint * vec3(0.7, 0.5, 0.3), h21(id + 9.0)) :&#10;                  style == 4 ? mix(tint, vec3(1.0), 0.4 * h21(id + 9.0)) :&#10;                  style == 6 ? tint * (0.7 + 0.3 * h) : tint;&#10;        c += pc * (core + halo) * tw * (style == 1 ? 0.6 : 1.0);&#10;        if (core * tw &gt; a) { a = core * tw; col = pc; }&#10;    }&#10;    bool covers = style == 0 || style == 3 || style == 4 || style == 5 || style == 6;&#10;    return covers ? vec4(col, clamp(a * (style == 6 ? 0.7 : 1.0), 0.0, 1.0)) : vec4(c, 1.0);&#10;}&#10;&#10;vec4 fxRays(vec2 m, float t, vec3 tint, float from, float many)   // sunbeams fanning down from above the board&#10;{&#10;    vec2 d = m - vec2(0.1 + 0.8 * from, -0.4);&#10;    float a = atan(d.x, d.y);&#10;    float r = vnoise(vec2(a * (8.0 + 24.0 * many), t * 0.15)) * vnoise(vec2(a * 23.0 + 5.0, t * 0.27 + 3.0));&#10;    r = smoothstep(0.08, 0.6, r);&#10;    float fall = smoothstep(1.6, 0.3, length(d));&#10;    float side = smoothstep(0.0, 0.12, m.x) * smoothstep(1.0, 0.88, m.x) * smoothstep(0.0, 0.08, m.y) * smoothstep(1.0, 0.8, m.y);&#10;    return vec4(tint * r * fall * side * 0.8, 1.0);&#10;}&#10;&#10;vec4 fxFire(vec2 m, float t, vec3 tint, float height, float detail, int style)   // flames rising from the bottom of the board (1: a rocket's jet, down from the top)&#10;{&#10;    if (style == 1) {&#10;        float down = m.y, w = abs(m.x - 0.5) * 2.0;&#10;        float len = 0.3 + 0.7 * height;&#10;        float n = fbm(vec2(m.x * 6.0, m.y * 4.0 - t * 9.0));&#10;        float body = smoothstep(0.45 + 0.4 * detail * n, 0.0, w / (0.25 + down * 0.9)) * smoothstep(len, len * 0.3, down + n * 0.15);&#10;        float core = smoothstep(0.35, 0.0, w / (0.12 + down * 0.3)) * smoothstep(len * 0.5, 0.0, down);&#10;        vec3 col = vec3(1.4, 0.55, 0.15) * body + vec3(0.8, 0.9, 1.4) * core * 1.5;&#10;        return vec4(col * mix(vec3(1.0), tint, 0.5) * (0.9 + 0.1 * sin(t * 60.0)), 1.0);&#10;    }&#10;    float up = 1.0 - m.y;&#10;    vec2 p = vec2(m.x * (3.0 + 4.0 * detail), up * (2.0 + 3.0 * detail));&#10;    float n = fbm(p * 1.5 - vec2(0.0, t * 2.2)) * 0.8 + fbm(p * 3.0 - vec2(t * 0.3, t * 3.5)) * 0.4;&#10;    float shape = 1.0 - up / (0.25 + 0.75 * height);&#10;    float side = 1.0 - pow(abs(m.x * 2.0 - 1.0), 2.0);&#10;    float f = clamp(shape * side * 1.6 + n - 0.9, 0.0, 1.0);&#10;    f *= smoothstep(0.0, 0.15, m.x) * smoothstep(1.0, 0.85, m.x) * smoothstep(0.0, 0.2, m.y);&#10;    vec3 col = vec3(1.5, 0.42, 0.08) * f + vec3(1.0, 0.85, 0.45) * pow(f, 3.0) * 1.5;&#10;    return vec4(col * mix(vec3(1.0), tint, 0.5) * 1.3, 1.0);&#10;}&#10;&#10;vec4 fxSteam(vec2 m, float t, vec3 tint, float amount, float width)   // soft wisps going up and fading&#10;{&#10;    vec2 p = vec2((m.x - 0.5) * (2.0 + 3.0 * (1.0 - width)), 1.0 - m.y);&#10;    p.x += 0.3 * sin(p.y * 3.0 - t * 1.3) * p.y;&#10;    float n = fbm(vec2(p.x * 2.5, p.y * 2.0 - t * 0.8));&#10;    float col = smoothstep(0.8, 0.0, abs(p.x) / (0.35 + p.y * 0.8));&#10;    float a = col * smoothstep(0.35, 0.75, n) * smoothstep(1.0, 0.4, p.y) * smoothstep(0.0, 0.1, p.y) * (0.6 + 1.2 * amount);&#10;    return vec4(tint, clamp(a, 0.0, 1.0));&#10;}&#10;&#10;vec4 fxLightning(vec2 m, float t, vec3 tint, float flash, float bolt, vec3 pic, int style)   // now and then a strike: the picture lights up, with a bolt if you like&#10;{&#10;    float k = floor(t * 0.5), f = fract(t * 0.5);&#10;    float h = h11(k * 1.7 + 0.3);&#10;    if (h &lt; 0.4) return vec4(0.0);&#10;    float amp = exp(-f * 45.0) + 0.7 * exp(-max(f - 0.06, 0.0) * 35.0) * step(0.06, f);&#10;    vec3 c = (pic * 1.8 * flash + tint * 0.35 * flash) * amp;&#10;    if (style == 1) {   // in the clouds: parts of them light up from inside, no bolt&#10;        float lit = smoothstep(0.4, 0.8, fbm(m * 3.0 + vec2(k * 3.7, k * 1.3)));&#10;        return vec4((pic * 2.2 * flash + tint * 0.5 * flash) * amp * lit, 1.0);&#10;    }&#10;    if (bolt &gt; 0.01) {&#10;        float x = 0.2 + 0.6 * h11(k + 9.1);&#10;        x += (vnoise1(m.y * 6.0 + k * 13.0) - 0.5) * 0.25 + (vnoise1(m.y * 25.0 + k * 7.0) - 0.5) * 0.06;&#10;        float d = abs(m.x - x);&#10;        float b = (0.0015 / (d + 0.0015) + 0.25 * exp(-d * 30.0)) * smoothstep(1.0, 0.6, m.y / (0.5 + 0.5 * h11(k + 2.2)));&#10;        c += mix(vec3(1.0), tint, 0.4) * b * bolt * amp * 1.5;&#10;    }&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;vec4 fxGlass(vec2 p, vec2 uv, float t, vec3 tint, float drops, float mist)   // drops on a window, running down, the picture bent in them (p: fc / R.y)&#10;{&#10;    vec2 n = vec2(0.0);&#10;    float mask = 0.0;&#10;    for (int L = 0; L &lt; 2 + LZ; L++) {   // drops that sit, grow and go&#10;        float sc = 16.0 + 12.0 * float(L);&#10;        vec2 g = p * sc, id = floor(g), f = fract(g) - 0.5;&#10;        float h = h21(id + float(L) * 7.0);&#10;        if (h &lt; 0.15 + 0.7 * drops) {&#10;            vec2 o = (vec2(h21(id + 1.3), h21(id + 2.7)) - 0.5) * 0.6;&#10;            float life = fract(t * 0.05 + h * 7.0);&#10;            float r = (0.12 + 0.2 * h21(id + 4.1)) * smoothstep(1.0, 0.8, life) * smoothstep(0.0, 0.05, life);&#10;            vec2 d = (f - o) / max(r, 0.001);&#10;            float k = smoothstep(1.0, 0.8, length(d));&#10;            mask = max(mask, k);&#10;            n += d * k;&#10;        }&#10;    }&#10;    {   // drops that run down, leaving a trail&#10;        float sc = 7.0;&#10;        float cx = floor(p.x * sc), fx = fract(p.x * sc) - 0.5;&#10;        float h = h11(cx * 3.7);&#10;        if (h &lt; 0.2 + 0.6 * drops) {&#10;            float wob = 0.15 * sin(p.y * 9.0 + h * 20.0);&#10;            float yy = fract(p.y * 0.5 + t * (0.05 + 0.08 * h) + h);&#10;            vec2 d = vec2((fx - wob) / 0.16, (yy - 0.5) * 9.0);&#10;            float k = smoothstep(1.0, 0.8, length(d));&#10;            float trail = smoothstep(0.06, 0.0, abs(fx - wob)) * step(0.5, yy) * smoothstep(1.0, 0.5, yy) * 0.6;&#10;            mask = max(mask, max(k, trail));&#10;            n += d * k + vec2((fx - wob) * 4.0, 0.0) * trail;&#10;        }&#10;    }&#10;    vec3 blur = vec3(0.0);&#10;    for (int i = 0; i &lt; 8 + LZ; i++) {&#10;        float a = float(i) * 0.785398;&#10;        blur += picAt(uv + vec2(cos(a), sin(a)) * 0.006 * mist);&#10;    }&#10;    blur /= 8.0;&#10;    vec3 drop = picAt(uv - n * 0.035) * 1.1 + tint * pow(max(0.0, dot(normalize(n + 1e-4), vec2(-0.6, 0.8))), 4.0) * 0.35 * mask;&#10;    vec3 col = mix(blur * (1.0 + 0.15 * mist), drop, mask);&#10;    return vec4(col, max(mask, clamp(mist * 1.2, 0.0, 1.0)));&#10;}&#10;&#10;vec4 fxSparkle(vec2 fc, vec2 m, float t, vec3 tint, float amount, float size, float S, float bright, int style)   // glints that come and go where the water is bright (1: a moon's path down the middle)&#10;{&#10;    vec2 g = fc / (S * (8.0 + 14.0 * size));&#10;    vec2 id = floor(g), f = fract(g) - 0.5;&#10;    float h = h21(id);&#10;    if (h &gt; 0.1 + 0.6 * amount * (style == 1 ? 1.4 : 1.0)) return vec4(0.0);&#10;    vec2 d = f - (vec2(h21(id + 1.7), h21(id + 4.3)) - 0.5) * 0.6;&#10;    float tw = pow(max(0.0, sin(t * 3.0 * (0.6 + h) + h * 60.0)), 24.0);&#10;    float star = pow(max(0.0, 1.0 - length(d) * 5.0), 3.0) + 0.004 / (abs(d.x) + 0.01) * smoothstep(0.3, 0.0, abs(d.y)) + 0.004 / (abs(d.y) + 0.01) * smoothstep(0.3, 0.0, abs(d.x));&#10;    float where = style == 1 ? exp(-pow((m.x - 0.5) / (0.06 + 0.25 * m.y), 2.0)) : smoothstep(0.12, 0.7, bright);&#10;    return vec4(tint * min(star, 3.0) * tw * where * 1.5, 1.0);&#10;}&#10;&#10;// ---------- v3.5: the sound on In A, and the DAW's beat (P28 its place in quarter notes, P29 playing, P30 the bar's ramp) ----------&#10;// a band of the spectrum (first row of iChannel0, low notes on the left), 0..1 across it&#10;float auSpec(float a, float b)&#10;{&#10;    float s = 0.0;&#10;    for (int i = 0; i &lt; 8 + LZ; i++)&#10;        s += textureLod(iChannel0, vec2(mix(a, b, (float(i) + 0.5) / 8.0), 0.25), 0.0).x;&#10;    return s / 8.0;&#10;}&#10;// sens 0..1 (P31): how loud it must be before it moves anything, 0 only loud parts, 1 soft ones too&#10;float auLift(float v, float sens)&#10;{&#10;    float lo = 0.7 - 0.6 * sens;&#10;    return clamp((v - lo) / (1.0 - lo), 0.0, 1.0);&#10;}&#10;&#10;&#10;vec4 fxBloom(vec2 uv, float t, vec3 tint, float amt, float size)   // the bright parts glow softly into what is round them&#10;{&#10;    vec3 c = picAt(uv), b = vec3(0.0);&#10;    float r = 0.004 + 0.02 * size;&#10;    for (int i = 0; i &lt; 12 + LZ; i++) {&#10;        float a = float(i) * 0.5236;&#10;        for (int j = 1; j &lt;= 2; j++)&#10;            b += max(picAt(uv + vec2(cos(a) / 1.78, sin(a)) * r * float(j)) - 0.6, 0.0);&#10;    }&#10;    return vec4(c + b / 24.0 * amt * 4.0 * mix(vec3(1.0), tint, 0.5), 1.0);&#10;}&#10;&#10;vec4 fxRainbow(vec2 m, float t, float strength, float width)   // a bow from the board's bottom corners, coming and going&#10;{&#10;    vec2 p = vec2(m.x - 0.5, 1.0 - m.y);&#10;    float band = (length(p) / 0.5 - 0.75) / (0.08 + 0.15 * width);&#10;    if (band &lt; 0.0 || band &gt; 1.0) return vec4(0.0);&#10;    vec3 c = clamp(abs(fract((1.0 - band) * 0.8 + vec3(0.0, 0.667, 0.333)) * 6.0 - 3.0) - 1.0, 0.0, 1.0);&#10;    float fade = sin(band * 3.1416) * (0.55 + 0.45 * sin(t * 0.3)) * smoothstep(0.0, 0.25, p.y);&#10;    return vec4(c * fade * strength * 0.7, 1.0);&#10;}&#10;&#10;vec4 fxCaustics(vec2 m, float t, vec3 tint, float amt, float size)   // the net of light that water throws on a bottom or a wall&#10;{&#10;    vec2 p = m * (3.0 + 8.0 * (1.0 - size));&#10;    float c = 0.0;&#10;    for (int i = 0; i &lt; 2 + LZ; i++) {   // two nets drifting apart, their thin bright lines where the warped noise crosses its middle&#10;        float fi = float(i);&#10;        vec2 w = p * (1.0 + 0.6 * fi) + vec2(t * 0.25, -t * 0.18) * (fi * 2.0 - 1.0);&#10;        w += vec2(vnoise(w * 0.7 + t * 0.2), vnoise(w * 0.7 - t * 0.17 + 5.0)) * 1.6;&#10;        float n = abs(vnoise(w) - 0.5);&#10;        c += pow(1.0 - smoothstep(0.0, 0.07, n), 2.0) * (0.7 - 0.25 * fi);&#10;    }&#10;    return vec4(tint * c * amt * 1.4 * edgeFade(m, 0.1), 1.0);&#10;}&#10;&#10;vec4 fxFirelight(vec2 uv, vec2 m, float t, vec3 tint, float flick, float reach)   // the fire's warm light flickering over what is in the board, strongest at its bottom&#10;{&#10;    float f = 0.55 + 0.45 * (0.6 * vnoise1(t * 3.1) + 0.4 * vnoise1(t * 7.3 + 4.0));   // a fire's light, never quite still&#10;    f = mix(0.8, f, flick);&#10;    float fall = exp(-length((m - vec2(0.5, 1.0)) * vec2(1.2, 1.0)) * (4.0 - 3.4 * reach));&#10;    vec3 pic = picAt(uv);&#10;    float lit = fall * f * edgeFade(m, 0.2);&#10;    return vec4(pic * (1.0 + lit * 1.6 * tint) + tint * lit * 0.06, 1.0);&#10;}&#10;&#10;vec4 fxBirds(vec2 m, float t, vec3 tint, float many, float size)   // small birds crossing the board now and then, flapping&#10;{&#10;    float a = 0.0;&#10;    for (int i = 0; i &lt; 6 + LZ; i++) {&#10;        float fi = float(i);&#10;        if (fi &gt; 1.0 + many * 5.0) break;&#10;        float per = 9.0 + 6.0 * h11(fi * 3.7);   // a pass every so many seconds, each bird its own&#10;        float ph = t / per + h11(fi * 9.1);&#10;        float k = floor(ph), u = fract(ph);&#10;        float dir = h11(k + fi * 5.3) &lt; 0.5 ? 1.0 : -1.0;&#10;        float y = 0.15 + 0.6 * h11(k * 1.7 + fi) + 0.05 * sin(u * 9.0 + fi);&#10;        vec2 p = vec2(dir &gt; 0.0 ? -0.1 + u * 1.2 : 1.1 - u * 1.2, y);&#10;        float s = (0.02 + 0.05 * size) * (0.7 + 0.5 * h11(fi * 2.1));&#10;        vec2 d = (m - p) / s;&#10;        d.x *= dir;&#10;        float flap = sin(t * (9.0 + 3.0 * h11(fi)) + fi * 2.0);&#10;        float wing = abs(d.x) &lt; 1.0 ? abs(d.y + 0.15 - abs(d.x) * 0.55 * flap) : 9.0;   // a V that beats up and down&#10;        a = max(a, smoothstep(0.22, 0.06, wing) * smoothstep(1.0, 0.8, abs(d.x)));&#10;    }&#10;    return vec4(tint * 0.18, a);&#10;}&#10;&#10;vec4 fxDrift(vec2 uv, vec2 m, float t, float dir, float dist)   // clouds drifting slowly sideways, seamlessly&#10;{&#10;    float L = 0.02 + 0.12 * dist;&#10;    float sp = (dir - 0.5) * 2.0;   // left .. right&#10;    float ph = vnoise(uv * 4.0) * 0.3;&#10;    float p1 = fract(t * 0.05 + ph), p2 = fract(t * 0.05 + ph + 0.5);&#10;    float w = 1.0 - abs(2.0 * p1 - 1.0);&#10;    float e = edgeFade(m, 0.12);&#10;    vec2 d = vec2(sp * L * e, 0.0);&#10;    return vec4(mix(picAt(uv - d * p2), picAt(uv - d * p1), w), 1.0);&#10;}&#10;&#10;vec4 fxSunGlow(vec2 m, float t, vec3 tint, float size, float pulse)   // a soft glow round the sun in the middle of the board, slowly breathing&#10;{&#10;    vec2 d = (m - 0.5) * 2.0;&#10;    float r = length(d);&#10;    float b = 1.0 + pulse * (0.25 * sin(t * 0.9) + 0.12 * sin(t * 2.3 + 1.0));&#10;    float glow = exp(-r * r * (6.0 - 4.5 * size)) * 0.55 + exp(-r * (14.0 - 8.0 * size)) * 0.6;&#10;    float sh = 0.85 + 0.15 * vnoise(vec2(atan(d.y, d.x) * 3.0, t * 0.6));   // a faint shimmer in it&#10;    return vec4(tint * glow * b * sh * smoothstep(1.0, 0.6, r), 1.0);&#10;}&#10;&#10;&#10;vec4 fxCustom(vec2 uv, float t, vec3 tint)&#10;{&#10;    float r = length(uv - 0.5);&#10;    float w = 0.5 + 0.5 * sin(r * 40.0 - t * 4.0);&#10;    return vec4(tint * w, 1.0);&#10;}&#10;&#10;float AU1, AU2, AU3, AU4, AU5, AU6;   // the sound and the beat (Audio panel), worked out at the top of sceneImage&#10;float mask10(vec2 p)&#10;{&#10;    vec2 v[4] = vec2[4](vec2(0.50834, 0.28995), vec2(0.52287, 0.39965), vec2(0.49236, 0.39965), vec2(0.49091, 0.27833));&#10;    float d = dot(p - v[0], p - v[0]), s = 1.0;&#10;    for (int i = 0, j = 3; i &lt; 4; j = i, i++) {&#10;        vec2 e = v[j] - v[i], w = p - v[i];&#10;        vec2 b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);&#10;        d = min(d, dot(b, b));&#10;        bvec3 c = bvec3(p.y &gt;= v[i].y, p.y &lt; v[j].y, e.x * w.y &gt; e.y * w.x);&#10;        if (all(c) || all(not(c))) s = -s;&#10;    }&#10;    float in_ = 1.0 - smoothstep(-0.01650, 0.01650, s * sqrt(d));   // 1 inside&#10;    return in_ * (1.0 - 0.00000);&#10;}&#10;float mask37(vec2 p)&#10;{&#10;    vec2 v[6] = vec2[6](vec2(0.63265, 0.27821), vec2(0.66106, 0.34505), vec2(0.66691, 0.39267), vec2(0.64435, 0.43862), vec2(0.58465, 0.43487), vec2(0.58608, 0.31020));&#10;    float d = dot(p - v[0], p - v[0]), s = 1.0;&#10;    for (int i = 0, j = 5; i &lt; 6; j = i, i++) {&#10;        vec2 e = v[j] - v[i], w = p - v[i];&#10;        vec2 b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);&#10;        d = min(d, dot(b, b));&#10;        bvec3 c = bvec3(p.y &gt;= v[i].y, p.y &lt; v[j].y, e.x * w.y &gt; e.y * w.x);&#10;        if (all(c) || all(not(c))) s = -s;&#10;    }&#10;    float in_ = 1.0 - smoothstep(-0.01650, 0.01650, s * sqrt(d));   // 1 inside&#10;    return in_ * (1.0 - 0.00000);&#10;}&#10;float shape16(vec2 p)&#10;{&#10;    vec2 v[8] = vec2[8](vec2(1.61170, 0.43543), vec2(1.68071, 0.42090), vec2(1.75586, 0.47820), vec2(1.77226, 0.66483), vec2(1.77361, 0.89783), vec2(1.56729, 0.84931), vec2(1.56661, 0.54900), vec2(1.57754, 0.47820));&#10;    float d = dot(p - v[0], p - v[0]), s = 1.0;&#10;    for (int i = 0, j = 7; i &lt; 8; j = i, i++) {&#10;        vec2 e = v[j] - v[i], w = p - v[i];&#10;        vec2 b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);&#10;        d = min(d, dot(b, b));&#10;        bvec3 c = bvec3(p.y &gt;= v[i].y, p.y &lt; v[j].y, e.x * w.y &gt; e.y * w.x);&#10;        if (all(c) || all(not(c))) s = -s;&#10;    }&#10;    return s * sqrt(d);   // &lt; 0 inside, in heights&#10;}&#10;float shape22(vec2 p)&#10;{&#10;    vec2 v[5] = vec2[5](vec2(1.67938, 0.48714), vec2(1.70465, 0.49993), vec2(1.71366, 0.55260), vec2(1.61558, 0.55260), vec2(1.63301, 0.50000));&#10;    float d = dot(p - v[0], p - v[0]), s = 1.0;&#10;    for (int i = 0, j = 4; i &lt; 5; j = i, i++) {&#10;        vec2 e = v[j] - v[i], w = p - v[i];&#10;        vec2 b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);&#10;        d = min(d, dot(b, b));&#10;        bvec3 c = bvec3(p.y &gt;= v[i].y, p.y &lt; v[j].y, e.x * w.y &gt; e.y * w.x);&#10;        if (all(c) || all(not(c))) s = -s;&#10;    }&#10;    return s * sqrt(d);   // &lt; 0 inside, in heights&#10;}&#10;void sceneImage(out vec4 o, in vec2 fc)&#10;{&#10;    vec2 R = iResolution.xy;&#10;    vec2 uv = fc / R;&#10;    vec3 PIC = tex0(uv).rgb;   // the background, read once for every effect that looks at it&#10;    vec3 C = PIC;&#10;    float A = 1.0;&#10;    vec2 q = vec2(uv.x, 1.0 - uv.y);   // as the editor counts: from the top left&#10;    float S = R.y / 1080.0, T = iTime;&#10;    vec2 qa = q * vec2(R.x / R.y, 1.0);   // q with square pixels, for the masks&#10;    float mk10 = -1.0;   // mask 10, not worked out yet&#10;    float mk37 = -1.0;   // mask 37, not worked out yet&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Smoke&#10;        vec2 m = quadUV(q, vec2(0.07777, 0.49820), vec2(0.13222, 0.49399), vec2(0.13929, 0.76780), vec2(0.09144, 0.77112));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.07777, 0.49820), vec2(0.13222, 0.49399), vec2(0.13929, 0.76780), vec2(0.09144, 0.77112), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.17156 * 10.0;&#10;            vec4 s = fxSmoke(m, t, vec3(1.00000, 0.60392, 0.23529));&#10;            s.rgb *= 2.0 * 0.70006;&#10;            picReact(s, 1, PIC);&#10;            s.a *= (1.0 - 0.00000);&#10;            { float fd = 0.03573; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.11373, 1.0 - 0.81495) * R, (6.0 + 250.0 * 0.43015 * 0.43015) * S, 3.0 * 0.50000 * (1.0 - 0.00000) * lampAmp(6, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.04752), vec3(1.00000, 0.83529, 0.60392), 0.0));   // Candle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.30773, 1.0 - 0.59682) * R, (6.0 + 250.0 * 0.33015 * 0.33015) * S, 3.0 * 0.50000 * (1.0 - 0.00000) * lampAmp(6, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.79064), vec3(1.00000, 0.83529, 0.60392), 0.0));   // Candle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.71881, 1.0 - 0.46474) * R, (6.0 + 250.0 * 0.13594 * 0.13594) * S, 3.0 * 0.59613 * (1.0 - 0.00000) * lampAmp(6, T * (0.05 + 4.0 * 0.52687 * 0.52687), 0.16676), vec3(1.00000, 0.83529, 0.60392), 0.0));   // Candle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.52937, 1.0 - 0.41453) * R, (6.0 + 250.0 * 0.33015 * 0.33015) * S, 3.0 * 0.50000 * (1.0 - 0.00000) * lampAmp(6, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.82903), vec3(1.00000, 0.83529, 0.60392), 0.0));   // Candle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.83050, 1.0 - 0.48714) * R, (6.0 + 250.0 * 0.23015 * 0.23015) * S, 3.0 * 0.94006 * (1.0 - 0.00000) * lampAmp(6, T * (0.05 + 4.0 * 0.75201 * 0.75201), 0.79177), vec3(1.00000, 0.83529, 0.60392), 0.0));   // Candle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Sun glow&#10;        vec2 m = quadUV(q, vec2(0.19780, 0.36976), vec2(0.22531, 0.37273), vec2(0.22294, 0.41743), vec2(0.19780, 0.41974));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.19780, 0.36976), vec2(0.22531, 0.37273), vec2(0.22294, 0.41743), vec2(0.19780, 0.41974), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.12108 * 0.12108) + 0.67368 * 10.0;&#10;            vec4 s = fxSunGlow(m, t, vec3(1.00000, 1.00000, 1.00000), 0.50000, 1.00000);&#10;            s.rgb *= 2.0 * 0.87077;&#10;            s.a *= (1.0 - 0.00000);&#10;            { float fd = 0.48472; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            glowAdd(C, A, s.rgb * s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Rainbow&#10;        vec2 m = quadUV(q, vec2(0.07960, 0.06982), vec2(0.29412, 0.12867), vec2(0.40607, 0.46474), vec2(0.06734, 0.39965));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.07960, 0.06982), vec2(0.29412, 0.12867), vec2(0.40607, 0.46474), vec2(0.06734, 0.39965), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.43780 * 0.43780) + 0.62502 * 10.0;&#10;            vec4 s = fxRainbow(m, t, 0.60000, 0.40000);&#10;            s.rgb *= 2.0 * 0.71737;&#10;            picReact(s, 1, PIC);&#10;            s.a *= (1.0 - 0.01479);&#10;            { float fd = 0.57150; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            glowAdd(C, A, s.rgb * s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Smoke&#10;        vec2 m = quadUV(q, vec2(0.30773, 0.50000), vec2(0.32190, 0.50000), vec2(0.32067, 0.58418), vec2(0.29412, 0.59954));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.30773, 0.50000), vec2(0.32190, 0.50000), vec2(0.32067, 0.58418), vec2(0.29412, 0.59954), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.23832 * 10.0;&#10;            vec4 s = fxSmoke(m, t, vec3(1.00000, 1.00000, 1.00000));&#10;            s.rgb *= 2.0 * 0.50000;&#10;            s.a *= (1.0 - 0.70921);&#10;            { float fd = 0.48472; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.20799, 1.0 - 0.55260) * R, (6.0 + 250.0 * 0.40068 * 0.40068) * S, 3.0 * 0.50000 * (1.0 - 0.69423) * lampAmp(6, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.27531), vec3(1.00000, 0.23137, 0.23137), 0.0));   // Candle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.43981, 1.0 - 0.53260) * R, (6.0 + 250.0 * 0.40068 * 0.40068) * S, 3.0 * 0.50000 * (1.0 - 0.69423) * lampAmp(6, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.78486), vec3(1.00000, 0.23137, 0.23137), 0.0));   // Candle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.57356, 1.0 - 0.53260) * R, (6.0 + 250.0 * 0.46068 * 0.46068) * S, 3.0 * 0.50000 * (1.0 - 0.69423) * lampAmp(6, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.09550), vec3(1.00000, 0.23137, 0.23137), 0.0));   // Candle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Bloom&#10;        vec2 m = quadUV(q, vec2(0.92325, 0.39182), vec2(1.10741, 0.63360), vec2(0.96974, 0.96503), vec2(0.78558, 0.72325));&#10;        float sd = m.x &gt; -5.0 ? shape16(qa) : 1.0;   // its own shape, worked out once&#10;        float cov = clamp(0.5 - sd * R.y, 0.0, 1.0);&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.89799 * 0.89799) + 0.27918 * 10.0;&#10;            vec4 s = fxBloom(uv, t, vec3(0.23529, 0.94118, 1.00000), 0.18294, 0.29427);&#10;            s.a *= clamp(0.2 + 1.2 * lum(PIC), 0.0, 1.0);&#10;            s.a *= (1.0 - 0.00000);&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.87074, 1.0 - 0.21753) * R, (6.0 + 250.0 * 0.24000 * 0.24000) * S, 3.0 * 0.50000 * (1.0 - 0.59846) * lampAmp(2, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.13563), vec3(1.00000, 0.83529, 0.60392), 1.0));   // Twinkle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.87074, 1.0 - 0.19307) * R, (6.0 + 250.0 * 0.20000 * 0.20000) * S, 3.0 * 0.50000 * (1.0 - 0.59846) * lampAmp(2, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.75550), vec3(1.00000, 0.83529, 0.60392), 1.0));   // Twinkle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.84889, 1.0 - 0.32099) * R, (6.0 + 250.0 * 0.20000 * 0.20000) * S, 3.0 * 0.50000 * (1.0 - 0.59846) * lampAmp(2, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.94425), vec3(1.00000, 0.83529, 0.60392), 1.0));   // Twinkle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.84889, 1.0 - 0.33542) * R, (6.0 + 250.0 * 0.24000 * 0.24000) * S, 3.0 * 0.50000 * (1.0 - 0.59846) * lampAmp(2, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.61869), vec3(1.00000, 0.83529, 0.60392), 1.0));   // Twinkle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.75799, 1.0 - 0.39965) * R, (6.0 + 250.0 * 0.24000 * 0.24000) * S, 3.0 * 0.50000 * (1.0 - 0.59846) * lampAmp(2, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.39659), vec3(1.00000, 0.83529, 0.60392), 1.0));   // Twinkle&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Heat haze&#10;        vec2 m = quadUV(q, vec2(0.93089, 0.46696), vec2(0.97603, 0.52016), vec2(0.94709, 0.59777), vec2(0.90195, 0.54456));&#10;        float sd = m.x &gt; -5.0 ? shape22(qa) : 1.0;   // its own shape, worked out once&#10;        float cov = clamp(0.5 - sd * R.y, 0.0, 1.0);&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.03653 * 10.0;&#10;            vec4 s = fxHaze(uv, m, t, 0.50000, 0.50000);&#10;            s.a *= (1.0 - 0.00000);&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Caustics&#10;        vec2 m = quadUV(q, vec2(0.62969, 0.61754), vec2(0.65224, 0.66350), vec2(0.66070, 0.85983), vec2(0.48824, 0.77551));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.62969, 0.61754), vec2(0.65224, 0.66350), vec2(0.66070, 0.85983), vec2(0.48824, 0.77551), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.03614 * 10.0;&#10;            vec4 s = fxCaustics(m, t, vec3(1.00000, 0.83529, 0.60392), 0.60000, 0.50000);&#10;            s.rgb *= 2.0 * 0.50000;&#10;            s.a *= (1.0 - 0.83790);&#10;            { float fd = 0.64333; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            glowAdd(C, A, s.rgb * s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Birds&#10;        vec2 m = quadUV(q, vec2(0.38296, 0.21061), vec2(0.46113, 0.21753), vec2(0.45975, 0.30600), vec2(0.38296, 0.31291));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.38296, 0.21061), vec2(0.46113, 0.21753), vec2(0.45975, 0.30600), vec2(0.38296, 0.31291), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.69278 * 10.0;&#10;            vec4 s = fxBirds(m, t, vec3(0.23529, 0.94118, 1.00000), 0.40000, 0.40000);&#10;            s.rgb *= 2.0 * 0.50000;&#10;            s.a *= (1.0 - 0.00000);&#10;            { float fd = 0.35300; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Sway&#10;        vec2 m = quadUV(q, vec2(0.15643, 0.44978), vec2(0.26144, 0.46474), vec2(0.24101, 0.50000), vec2(0.13682, 0.50000));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.15643, 0.44978), vec2(0.26144, 0.46474), vec2(0.24101, 0.50000), vec2(0.13682, 0.50000), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.38334 * 0.38334) + 0.45500 * 10.0;&#10;            vec4 s = fxSway(uv, m, t, 0.09635, 0.12108, 1);&#10;            s.a *= clamp(0.2 + 1.2 * lum(PIC), 0.0, 1.0);&#10;            s.a *= (1.0 - 0.00000);&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Cloud drift&#10;        vec2 m = quadUV(q, vec2(0.42547, 0.33542), vec2(0.45975, 0.32099), vec2(0.46113, 0.37273), vec2(0.42547, 0.36976));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.42547, 0.33542), vec2(0.45975, 0.32099), vec2(0.46113, 0.37273), vec2(0.42547, 0.36976), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.05286 * 10.0;&#10;            vec4 s = fxDrift(uv, m, t, 0.75000, 0.40000);&#10;            s.a *= clamp(0.2 + 1.2 * lum(PIC), 0.0, 1.0);&#10;            s.a *= (1.0 - 0.00000);&#10;            { float fd = 0.64037; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Reflection&#10;        vec2 m = quadUV(q, vec2(0.37172, 0.24322), vec2(0.44935, 0.27546), vec2(0.44772, 0.52973), vec2(0.37894, 0.54973));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.37172, 0.24322), vec2(0.44935, 0.27546), vec2(0.44772, 0.52973), vec2(0.37894, 0.54973), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.10625 * 0.10625) + 0.67965 * 10.0;&#10;            vec4 s = fxReflect(q, m, t, vec2(0.37172, 0.24322), vec2(0.44935, 0.27546), 0.16563, 0.07656, vec3(0.23529, 0.94118, 1.00000), 0);&#10;            s.a *= clamp(0.2 + 1.2 * lum(PIC), 0.0, 1.0);&#10;            s.a *= (1.0 - 0.00000);&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Light rays&#10;        vec2 m = quadUV(q, vec2(0.18951, 0.44760), vec2(0.24835, 0.44978), vec2(0.27614, 0.52751), vec2(0.12872, 0.53260));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.18951, 0.44760), vec2(0.24835, 0.44978), vec2(0.27614, 0.52751), vec2(0.12872, 0.53260), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.64316 * 0.64316) + 0.82494 * 10.0;&#10;            vec4 s = fxRays(m, t, vec3(1.00000, 0.83529, 0.60392), 0.30000, 0.50000);&#10;            s.rgb *= 2.0 * 0.50000;&#10;            s.a *= (1.0 - 0.00000);&#10;            glowAdd(C, A, s.rgb * s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Birds&#10;        vec2 m = quadUV(q, vec2(0.13682, 0.26747), vec2(0.21499, 0.27438), vec2(0.21361, 0.36286), vec2(0.13682, 0.36976));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.13682, 0.26747), vec2(0.21499, 0.27438), vec2(0.21361, 0.36286), vec2(0.13682, 0.36976), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.64548 * 10.0;&#10;            vec4 s = fxBirds(m, t, vec3(0.23529, 0.94118, 1.00000), 0.40000, 0.40000);&#10;            s.rgb *= 2.0 * 0.50000;&#10;            s.a *= (1.0 - 0.00000);&#10;            { float fd = 0.35300; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Smoke&#10;        vec2 m = quadUV(q, vec2(0.60736, 0.45513), vec2(0.61751, 0.45674), vec2(0.62768, 0.54459), vec2(0.59039, 0.55343));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.60736, 0.45513), vec2(0.61751, 0.45674), vec2(0.62768, 0.54459), vec2(0.59039, 0.55343), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.36806 * 10.0;&#10;            vec4 s = fxSmoke(m, t, vec3(1.00000, 0.60392, 0.23529));&#10;            s.rgb *= 2.0 * 0.99201;&#10;            s.a *= (1.0 - 0.33206);&#10;            { float fd = 0.49966; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Sun glow&#10;        vec2 m = quadUV(q, vec2(0.32925, 0.61625), vec2(0.47151, 0.61625), vec2(0.49234, 0.78649), vec2(0.31941, 0.75683));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.32925, 0.61625), vec2(0.47151, 0.61625), vec2(0.49234, 0.78649), vec2(0.31941, 0.75683), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.46997 * 0.46997) + 0.95461 * 10.0;&#10;            vec4 s = fxSunGlow(m, t, vec3(1.00000, 0.83529, 0.60392), 1.00000, 0.50000);&#10;            s.rgb *= 2.0 * 0.80149;&#10;            s.a *= (1.0 - 0.00000);&#10;            { float fd = 1.00000; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            glowAdd(C, A, s.rgb * s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Sun glow&#10;        vec2 m = quadUV(q, vec2(0.65693, 0.76132), vec2(0.83693, 0.76132), vec2(0.83693, 0.90132), vec2(0.65693, 0.90132));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.65693, 0.76132), vec2(0.83693, 0.76132), vec2(0.83693, 0.90132), vec2(0.65693, 0.90132), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.47738 * 10.0;&#10;            vec4 s = fxSunGlow(m, t, vec3(1.00000, 0.83529, 0.60392), 0.50000, 0.50000);&#10;            s.rgb *= 2.0 * 0.50000;&#10;            s.a *= (1.0 - 0.00000);&#10;            glowAdd(C, A, s.rgb * s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Colour glow&#10;        vec2 m = quadUV(q, vec2(0.91767, 0.63632), vec2(0.96145, 0.65605), vec2(0.96098, 0.81427), vec2(0.91767, 0.79715));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.91767, 0.63632), vec2(0.96145, 0.65605), vec2(0.96098, 0.81427), vec2(0.91767, 0.79715), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.76619 * 10.0;&#10;            vec4 s = fxKeyGlow(PIC, keyColour(vec2(0.50000, 0.50000)), 0.60000, 0.60000, lampAmp(3, t, 0.76619), vec3(1.00000, 0.23137, 0.23137));&#10;            s.rgb *= 2.0 * 0.50000;&#10;            s.a *= (1.0 - 0.15547);&#10;            { float fd = 0.84390; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            glowAdd(C, A, s.rgb * s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    glowAdd(C, A, lamp(fc, vec2(0.98327, 1.0 - 0.34949) * R, (6.0 + 250.0 * 0.30000 * 0.30000) * S, 3.0 * 0.50000 * (1.0 - 0.57150) * lampAmp(3, T * (0.05 + 4.0 * 0.40000 * 0.40000), 0.53218), vec3(1.00000, 0.83529, 0.60392), 0.0));   // Broken tube&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Fire&#10;        vec2 m = quadUV(q, vec2(0.52644, 0.18883), vec2(0.66403, 0.17322), vec2(0.70293, 0.28496), vec2(0.49910, 0.34573));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.52644, 0.18883), vec2(0.66403, 0.17322), vec2(0.70293, 0.28496), vec2(0.49910, 0.34573), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.01438 * 10.0;&#10;            vec4 s = fxFire(m, t, vec3(0.23529, 0.94118, 1.00000), 0.60000, 0.50000, 0);&#10;            s.rgb *= 2.0 * 0.50000;&#10;            s.a *= (1.0 - 0.81697);&#10;            { float fd = 0.85588; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            glowAdd(C, A, s.rgb * s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Birds&#10;        vec2 m = quadUV(q, vec2(0.29437, 0.36533), vec2(0.32607, 0.36151), vec2(0.32607, 0.45609), vec2(0.29034, 0.44893));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.29437, 0.36533), vec2(0.32607, 0.36151), vec2(0.32607, 0.45609), vec2(0.29034, 0.44893), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.33010 * 10.0;&#10;            vec4 s = fxBirds(m, t, vec3(0.23529, 0.94118, 1.00000), 0.40000, 0.40000);&#10;            s.rgb *= 2.0 * 0.50000;&#10;            s.a *= (1.0 - 0.00000);&#10;            { float fd = 0.35300; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Birds&#10;        vec2 m = quadUV(q, vec2(0.40170, 0.34302), vec2(0.46627, 0.30292), vec2(0.46689, 0.49024), vec2(0.40386, 0.52156));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.40170, 0.34302), vec2(0.46627, 0.30292), vec2(0.46689, 0.49024), vec2(0.40386, 0.52156), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.01681 * 10.0;&#10;            vec4 s = fxBirds(m, t, vec3(0.23529, 0.94118, 1.00000), 0.40000, 0.40000);&#10;            s.rgb *= 2.0 * 0.50000;&#10;            s.a *= (1.0 - 0.00000);&#10;            { float fd = 0.35300; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, 2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }   // Edge fade&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Firelight&#10;        vec2 m = quadUV(q, vec2(0.41282, -0.00027), vec2(0.72226, -0.00321), vec2(0.81247, 0.12796), vec2(0.41282, 0.13973));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.41282, -0.00027), vec2(0.72226, -0.00321), vec2(0.81247, 0.12796), vec2(0.41282, 0.13973), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 1.00000 * 1.00000) + 0.14680 * 10.0;&#10;            vec4 s = fxFirelight(uv, m, t, vec3(0.23529, 0.94118, 1.00000), 1.00000, 0.89303);&#10;            s.a *= clamp(0.2 + 1.2 * lum(PIC), 0.0, 1.0);&#10;            s.a *= (1.0 - 0.00000);&#10;            C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    {&#10;    vec3 C0 = C; float A0 = A;&#10;    {   // Particles&#10;        vec2 m = quadUV(q, vec2(0.28760, 0.00431), vec2(0.81764, -0.00571), vec2(0.82469, 0.31928), vec2(0.35903, 0.33599));&#10;        float cov = m.x &gt; -5.0 ? quadCov(q, vec2(0.28760, 0.00431), vec2(0.81764, -0.00571), vec2(0.82469, 0.31928), vec2(0.35903, 0.33599), R) : 0.0;&#10;        if (cov &gt; 0.0) {&#10;            float t = T * (0.05 + 4.0 * 0.35000 * 0.35000) + 0.66201 * 10.0;&#10;            vec4 s = fxParticles(fc / R.y, t, vec3(0.23529, 0.94118, 1.00000), 0.50000, 0.00000, 2);&#10;            s.rgb *= 2.0 * 0.10130;&#10;            s.a *= (1.0 - 0.00000);&#10;            glowAdd(C, A, s.rgb * s.a * cov);&#10;        }&#10;    }&#10;    if (C != C0 || A != A0) {&#10;        if (mk10 &lt; 0.0) mk10 = mask10(qa);&#10;        if (mk37 &lt; 0.0) mk37 = mask37(qa);&#10;        float mk = max(mk10, mk37);&#10;        C = mix(C, C0, mk); A = mix(A, A0, mk);&#10;    }&#10;    }&#10;    if (P14 &gt; 0.5) edgeView(C, uv, int(P14 + 0.5) - 1, P21, P22);&#10;    if (P17 &gt; 0.5) magnifier(C, fc, vec2(P15, 1.0 - P16) * R);&#10;    o = A &gt; 0.0001 ? vec4(min(C / A, vec3(1.0)), A) : vec4(0.0);&#10;}&#10;&#10;void mainImage(out vec4 o, in vec2 fc)&#10;{&#10;    if (P27 &lt; 0.0001) { sceneImage(o, fc); return; }&#10;    vec2 R = iResolution.xy;&#10;    vec2 p = (vec2(fc.x / R.x, 1.0 - fc.y / R.y) - (vec2(P25, P26) - 0.5) * 20.0) / (P27 * 10.0);   // where in the picture, from its top left&#10;    if (p.x &lt; 0.0 || p.y &lt; 0.0 || p.x &gt; 1.0 || p.y &gt; 1.0) {&#10;        vec2 k = floor(fc / (12.0 * R.y / 1080.0));&#10;        o = vec4(vec3(0.05, 0.045, 0.075) + 0.012 * mod(k.x + k.y, 2.0), 1.0);   // the ground round it&#10;        return;&#10;    }&#10;    sceneImage(o, vec2(p.x, 1.0 - p.y) * R);&#10;    if (o.a &lt; 1.0) {   // see-through parts show a chequer, as in Photoshop&#10;        vec2 k = floor(p * vec2(1920.0, 1080.0) / 16.0);&#10;        vec3 g = vec3(0.15, 0.14, 0.19) + 0.05 * mod(k.x + k.y, 2.0);&#10;        o = vec4(mix(g, o.rgb, o.a), 1.0);&#10;    }&#10;}&#10;"
                 zones="[&#10;]" zonevalues="" labels="DARC SECTOR&#10;OPEN 24/7&#10;HOTEL&#10;BAR&#10;TECHNO TONIGHT&#10;NO PARKING"
                 image1="C:\Users\Danny\Downloads\scene_mario.png" image2="" fontFile=""
                 preserveBuffers="0" resolution="0" framerate="0" transparent="1"
                 background="00000000" keyboard="0" zoneinputs="0" showOrientation="0"
                 showObjectAxes="0" visible="1" ignoreClicks="0" panelX="0.0"
                 panelY="0.0" panelW="1920.0" panelH="1080.0" tooltipStyle=""
                 exposeToDAW="0" fontFamily="" panel_visible="1"/>
        </node>
        <node id="2" type="flow.script" title="Cinemnode Editor" expanded="0"
              x="-1100.0" y="0.0" w="900.0" h="1000.0">
          <state in1="0.0" in2="0.0" in3="0.0" file="" out1="0.0" out2="0.0" out3="0.0"
                 out4="0.0" out5="0.0" out6="0.0" out7="0.0" inputs="3" cvInputs="0"
                 outputs="7" cvOutputs="0" midiOutputs="0" tick="2" code="// Cinemnode v3.0 (was Scene Kit), in Darc Sector colours: signs, screens and lights to lay over a picture of your own. The Scene has no picture and is&#10;// see-through (Transparent on) where nothing is: put a Widget Image under it on the front panel, both 1920 x 1080.&#10;// Edit mode: drag a sign's corners to fit it into the picture, drag it to move, mouse wheel to make it&#10;// bigger or smaller (Shift + wheel turns it); double-click an empty spot for a new light; right-click an element for&#10;// its menu (make square, copy and paste its size, duplicate, front and back, hide, lock, delete). Undo and Redo&#10;// (toolbar) go back and forth through the last 80 changes.&#10;// Pictures as layers (Image in the toolbar): any file, PNG with see-through parts too, always over the effects. The&#10;// Script draws them, so they need no shader; their timeline plays on the Script's tick (Tick: 30 a second).&#10;// Masks (Mask in the toolbar): a shape of as many points as you like (double-click its edge for one more, right-click a&#10;// point to take it away; boards too: with 4 points a board is a picture in perspective, with more or fewer&#10;// it is a shape cut out of a straight box round it, turned as the board was) where the effects do not show: all of them, or only the ones you pick. Soft edge, inside or outside.&#10;// Out of Edit mode only the effects are left. Back to Edit mode: double-click anywhere on the Scene, or a&#10;// message on In 1 (a Widget Toggle, for instance).&#10;// Laid out as in Photoshop: the tools down the left (add a board or a light, copy, delete, picture, edges, snap,&#10;// clear, panels, done), and a dock on the right with Properties and Layers, each folding in by its header; the tab&#10;// on the dock's edge (or Panels) folds the whole dock away. The wheel scrolls the dock when it is too long.&#10;// Layers lists every element: click a name to select it, the eye hides it, the lock keeps it in place&#10;// (no handles, no Delete), the arrows move it to the front or the back.&#10;// Edge glow (with a background): the picture's own edges inside the board light up: Glow, Running or Sparkle.&#10;// In Edit mode the picture fits between the toolbar and the dock, so nothing hides under them: the wheel on an&#10;// empty spot zooms in where the mouse is, dragging an empty spot moves the picture, Fit puts it back.&#10;// Picture (or Choose... in Properties with nothing selected): Out 2 opens the File node's dialog, the path comes back on In 2 and becomes the Scene's Image 1,&#10;// drawn under everything (stretched to 1920 x 1080). With a background, Edges outlines what is in the picture and&#10;// a magnifier shows the picture under a corner or a light while you drag it, and a Ripple bends the picture.&#10;// Picture (with a background): an effect can follow the picture under it: Surface (the picture's light and shade&#10;// show through it), Bright parts or Dark parts only; a Ripple goes On top or In the picture (bends it).&#10;// Colours: the swatches, your own palette (+ keeps the current colour, right-click forgets one), Red/Green/Blue (0-255)&#10;// or Hue/Saturation/Value, and the colour as a code: click it to type #RGB, #RGBA, #RRGGBB or #RRGGBBAA on the keys&#10;// that open under it (the last two digits, alpha, set its Transparency). A Text Input on In 3 takes a code too, or 255, 128, 0.&#10;// Edges can show only Straight (rectangles) or Round (circles) edges. Snap pulls what you drag onto the corners of&#10;// the other boards, the lights and the sides of the Scene (Alt while dragging: no snap). A board's corners either&#10;// shape it, or with Corners: Scale (or Ctrl while dragging) scale the whole board from the opposite corner.&#10;// Everything is kept with the project.&#10;// Out 1 -&gt; Scene Objects. The effects are GLSL, made here and sent to the Scene as its code.&#10;&#10;// The lines for the Text effect (at most 16). Change them here.&#10;const TEXTS = ['DARC SECTOR', 'OPEN 24/7', 'HOTEL', 'BAR', 'TECHNO TONIGHT', 'NO PARKING'];&#10;&#10;// Your own effect, for the effect &quot;Custom&quot;: uv goes 0..1 across and down the sign, t is the time&#10;// (times its Speed), tint its Colour. Return the colour and its cover (1 = solid).&#10;const CUSTOM = &#96;&#10;vec4 fxCustom(vec2 uv, float t, vec3 tint)&#10;{&#10;    float r = length(uv - 0.5);&#10;    float w = 0.5 + 0.5 * sin(r * 40.0 - t * 4.0);&#10;    return vec4(tint * w, 1.0);&#10;}&#10;&#96;;&#10;&#10;const SHARED = &#96;// LZ is 0, but the compiler cannot know it: loops stay loops instead of being unrolled, so the shader compiles faster&#10;#define LZ min(iFrame, 0)&#10;// the picture, read with no mipmap guess: works the same inside those loops on every graphics driver&#10;vec4 tex0(vec2 uv) { return textureLod(iImage0, uv, 0.0); }&#10;// Cinemnode (was Scene Kit): shared helpers and effects. The Script adds mainImage with every element.&#10;float h11(float n) { return fract(sin(n * 12.9898) * 43758.5453); }&#10;float h21(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }&#10;float vnoise(vec2 p)&#10;{&#10;    vec2 i = floor(p), f = fract(p);&#10;    f = f * f * (3.0 - 2.0 * f);&#10;    return mix(mix(h21(i), h21(i + vec2(1.0, 0.0)), f.x), mix(h21(i + vec2(0.0, 1.0)), h21(i + vec2(1.0, 1.0)), f.x), f.y);&#10;}&#10;float vnoise1(float x)&#10;{&#10;    float i = floor(x), f = fract(x);&#10;    f = f * f * (3.0 - 2.0 * f);&#10;    return mix(h11(i), h11(i + 1.0), f);&#10;}&#10;&#10;// Where p lies in the quad a (top left), b (top right), c (bottom right), d (bottom left): 0..1 each way, v down.&#10;// A perspective (projective) map, so a flat sign photographed at an angle is filled the way it really is.&#10;vec2 quadUV(vec2 p, vec2 a, vec2 b, vec2 c, vec2 d)&#10;{&#10;    float sx = a.x - b.x + c.x - d.x, sy = a.y - b.y + c.y - d.y;&#10;    float dx1 = b.x - c.x, dx2 = d.x - c.x, dy1 = b.y - c.y, dy2 = d.y - c.y;&#10;    float den = dx1 * dy2 - dx2 * dy1;&#10;    if (abs(den) &lt; 1e-9) return vec2(-10.0);&#10;    float g = (sx * dy2 - dx2 * sy) / den;&#10;    float h = (dx1 * sy - sx * dy1) / den;&#10;    float A = b.x - a.x + g * b.x, B = d.x - a.x + h * d.x, C = a.x;&#10;    float D = b.y - a.y + g * b.y, E = d.y - a.y + h * d.y, F = a.y;&#10;    // the inverse, by the adjugate (the determinant cancels in the division)&#10;    float i00 = E - F * h, i01 = C * h - B, i02 = B * F - C * E;&#10;    float i10 = F * g - D, i11 = A - C * g, i12 = C * D - A * F;&#10;    float i20 = D * h - E * g, i21 = B * g - A * h, i22 = A * E - B * D;&#10;    vec3 r = vec3(i00 * p.x + i01 * p.y + i02, i10 * p.x + i11 * p.y + i12, i20 * p.x + i21 * p.y + i22);&#10;    vec2 m = (a + b + c + d) * 0.25;&#10;    float wm = i20 * m.x + i21 * m.y + i22;&#10;    if (r.z * wm &lt;= 0.0) return vec2(-10.0);   // beyond the vanishing line&#10;    return r.xy / r.z;&#10;}&#10;&#10;// ---------- effects for a sign: each gives a colour and how much of it covers ----------&#10;vec4 fxPlasma(vec2 uv, float t, vec3 tint)&#10;{&#10;    vec2 p = uv * 6.0;&#10;    float v = sin(p.x + t) + sin(p.y * 1.3 - t * 1.1) + sin((p.x + p.y) * 0.7 + t * 0.8) + sin(length(p - 3.0) * 1.5 - t * 1.6);&#10;    vec3 c = 0.5 + 0.5 * cos(6.2832 * (v * 0.15 + vec3(0.0, 0.33, 0.67)) + t * 0.3);&#10;    return vec4(mix(c, c * tint, 0.35), 1.0);&#10;}&#10;&#10;vec4 fxText(vec2 uv, float t, vec3 tint, float cov)&#10;{&#10;    vec3 bg = vec3(0.015, 0.015, 0.03) + tint * 0.05 * (0.5 + 0.5 * sin(uv.y * 300.0));&#10;    vec3 c = mix(bg, tint * 1.5 + 0.15, cov);&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;vec4 fxGlitch(vec2 uv, float t, vec3 tint)&#10;{&#10;    float band = floor(uv.y * 24.0);&#10;    float g = step(0.82, h21(vec2(band, floor(t * 8.0))));&#10;    vec2 u = uv;&#10;    u.x += g * (h21(vec2(band, floor(t * 16.0))) - 0.5) * 0.3;&#10;    vec3 c = vec3(h21(floor(u * vec2(160.0, 90.0)) + floor(t * 24.0))) * 0.3;&#10;    vec2 cell = floor(u * vec2(8.0, 4.0) + vec2(t * 0.5, 0.0));&#10;    c += tint * step(0.6, h21(cell + floor(t * 2.0))) * 0.75;&#10;    c.r += 0.35 * g;&#10;    c.b += 0.3 * step(0.9, h21(vec2(band * 3.1, floor(t * 12.0))));&#10;    c *= 0.8 + 0.2 * sin(uv.y * 420.0);&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;vec4 fxBars(vec2 uv, float t, vec3 tint)&#10;{&#10;    float x = fract(uv.x + t * 0.04);&#10;    float i = floor(x * 7.0);&#10;    vec3 c = vec3((i &lt; 1.5 || (i &gt; 3.5 &amp;&amp; i &lt; 5.5)) ? 1.0 : 0.0, i &lt; 3.5 ? 1.0 : 0.0, mod(i, 2.0) &lt; 0.5 ? 1.0 : 0.0) * 0.8;&#10;    if (uv.y &gt; 0.78) c = vec3(fract(uv.x * 4.0 - t * 0.2)) * 0.9;&#10;    float roll = fract(uv.y - t * 0.15);&#10;    c *= 1.0 - 0.35 * smoothstep(0.9, 1.0, roll);&#10;    c += (h21(floor(uv * vec2(200.0, 120.0)) + floor(t * 30.0)) - 0.5) * 0.08;&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;vec4 fxRetro(vec2 uv, float t, vec3 tint)&#10;{&#10;    vec2 p = vec2(uv.x - 0.5, 1.0 - uv.y);&#10;    float hz = 0.42;&#10;    vec3 c;&#10;    if (p.y &gt; hz) {&#10;        c = mix(vec3(0.35, 0.05, 0.4), vec3(0.03, 0.0, 0.12), (p.y - hz) / (1.0 - hz));&#10;        vec2 s = vec2(p.x * 1.6, p.y - 0.62);&#10;        float r = length(s);&#10;        float gaps = step(0.5, fract((p.y - hz) * 22.0 + t * 0.6)) + step(0.7, p.y);&#10;        c = mix(c, mix(vec3(1.0, 0.25, 0.5), vec3(1.0, 0.85, 0.2), (p.y - 0.42) / 0.38), (1.0 - smoothstep(0.24, 0.25, r)) * min(gaps, 1.0));&#10;    } else {&#10;        float z = 0.08 / max(hz - p.y, 0.001);&#10;        vec2 g = vec2(p.x * z * 6.0, z + t);&#10;        vec2 f = abs(fract(g) - 0.5);&#10;        float w = 0.04 * z;&#10;        float line = max(1.0 - smoothstep(0.0, w + 0.02, 0.5 - f.x), 1.0 - smoothstep(0.0, w + 0.02, 0.5 - f.y));&#10;        c = mix(vec3(0.03, 0.0, 0.08), tint * 0.6 + vec3(0.6, 0.1, 0.8) * 0.6, line * exp(-z * 0.05));&#10;    }&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;&#10;vec4 fxWindow(vec2 uv, float t, vec3 tint)   // added to the photo: a lit window&#10;{&#10;    float e = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));&#10;    float f = 0.85 + 0.15 * vnoise1(t * 5.0);&#10;    float lit = (0.6 + 0.4 * smoothstep(0.0, 0.12, e)) * (1.0 - 0.3 * uv.y);   // lighter towards the ceiling lamp&#10;    return vec4(tint * f * lit * 0.8, 1.0);&#10;}&#10;&#10;vec4 fxNeon(vec2 uv, float t, vec3 tint)     // added to the photo: a neon tube along the edge&#10;{&#10;    float e = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));&#10;    float tube = 1.0 - smoothstep(0.006, 0.016, abs(e - 0.035));&#10;    float glow = exp(-abs(e - 0.035) * 30.0) * 0.5;&#10;    float on = 0.85 + 0.15 * sin(t * 40.0) * step(0.93, h11(floor(t * 3.0)));&#10;    return vec4(tint * (tube * 1.6 + glow) * on, 1.0);&#10;}&#10;&#10;// ---------- lights ----------&#10;// mode: 0 on, 1 slow blink, 2 twinkle, 3 broken tube, 4 pulse, 5 strobe, 6 candle, 7 traffic light (its colour changes, see trafficCol),&#10;// 8 aircraft (a double flash now and then), 9 lens flare (on, with a flare drawn by fxFlare)&#10;float lampAmp(int mode, float t, float seed)&#10;{&#10;    if (mode == 1) { float s = fract(t * 0.5 + seed); return smoothstep(0.0, 0.08, s) * (1.0 - smoothstep(0.5, 0.58, s)); }&#10;    if (mode == 2) { float n = vnoise1(t * 4.0 + seed * 37.0); return 0.12 + 1.2 * n * n * n; }&#10;    if (mode == 3) {&#10;        float bad = h11(floor(t * 0.7) + seed * 91.0);&#10;        float fast = step(0.4, h11(floor(t * 17.0) + seed * 13.0));&#10;        return bad &gt; 0.55 ? fast * 0.95 : 0.9 + 0.1 * vnoise1(t * 30.0);&#10;    }&#10;    if (mode == 4) return 0.55 + 0.45 * sin(6.2832 * (t * 0.5 + seed));&#10;    if (mode == 5) { float s = fract(t * 2.0 + seed); return 1.0 - smoothstep(0.0, 0.07, s); }&#10;    if (mode == 6) return 0.7 + 0.3 * vnoise1(t * 7.0 + seed * 20.0) * (0.6 + 0.4 * vnoise1(t * 2.3 + seed * 5.0));&#10;    if (mode == 8) { float s = fract(t * 0.6 + seed); return 1.0 - smoothstep(0.0, 0.04, s) + (1.0 - smoothstep(0.12, 0.16, s)) * step(0.1, s); }&#10;    return 1.0;&#10;}&#10;&#10;vec3 trafficCol(float t)   // red, then green, then amber, round again&#10;{&#10;    float s = mod(t, 8.0);&#10;    return s &lt; 3.5 ? vec3(1.0, 0.08, 0.05) : s &lt; 7.0 ? vec3(0.1, 1.0, 0.35) : vec3(1.0, 0.6, 0.05);&#10;}&#10;&#10;vec3 lamp(vec2 fc, vec2 pos, float r, float amp, vec3 lc, float rays)&#10;{&#10;    vec2 d = fc - pos;&#10;    float l = length(d) / r;&#10;    if (rays &lt; 0.5 &amp;&amp; l &gt; 1.45) return vec3(0.0);   // past its reach it adds nothing: skip the rest&#10;    float g = exp(-l * l * 18.0) * 1.6 + 0.5 / (1.0 + l * l * 10.0) * (1.0 - smoothstep(0.4, 1.4, l));&#10;    vec2 a = abs(d) / r;&#10;    g += rays * (exp(-a.x * 40.0 - a.y * 2.2) + exp(-a.y * 40.0 - a.x * 2.2)) * 0.8;&#10;    return lc * amp * g;&#10;}&#10;&#10;// light added to what is drawn so far: C is the colour times its cover, A the cover&#10;void glowAdd(inout vec3 C, inout float A, vec3 add)&#10;{&#10;    C += add;&#10;    A = max(A, clamp(max(add.r, max(add.g, add.b)), 0.0, 1.0));&#10;}&#10;&#10;// rain: thin streaks falling a little slanted, in three layers (far ones smaller, slower and fainter).&#10;// p is the place on the screen in screen heights (y up), so the drops keep their size on any sign&#10;vec4 fxRain(vec2 p, float t, vec3 tint)&#10;{&#10;    float a = 0.0;&#10;    for (int i = 0; i &lt; 3 + LZ; i++) {&#10;        float fi = float(i);&#10;        float sc = 1.0 + fi * 0.8;                    // far layers: more, smaller drops&#10;        float cols = 70.0 * sc;&#10;        float x = (p.x + p.y * 0.12) * cols;          // slanted by the wind&#10;        float cx = floor(x);&#10;        float r1 = h21(vec2(cx, fi * 17.0)), r2 = h21(vec2(cx, fi * 31.0 + 5.0));&#10;        float len = 0.10 / sc;                         // a drop's streak, in screen heights&#10;        float y = p.y * (1.0 / len) * 0.25 + t * (9.0 - fi * 2.0) * (0.8 + 0.4 * r1) + r2 * 10.0;&#10;        float drop = fract(y);&#10;        float streak = smoothstep(0.0, 0.05, drop) * (1.0 - smoothstep(0.08, 0.25, drop));&#10;        float thin = 1.0 - smoothstep(0.06, 0.16, abs(fract(x) - 0.5));&#10;        float here = step(0.55, h21(vec2(cx, floor(y) + fi * 7.0)));   // not every column has a drop each time&#10;        a += streak * thin * here * (0.6 - fi * 0.17);&#10;    }&#10;    return vec4(tint, clamp(a, 0.0, 1.0));   // only the streaks cover: the picture shows between them&#10;}&#10;&#10;// ripples in water: rings that start in the middle of the sign and spread out, three at a time, fading as they go.&#10;// The crests are drawn light (tint), the troughs dark, each only as much as strength says; between the rings it is clear.&#10;// size: how far a ring gets (0.5 = to the edge of the sign)&#10;float rippleV(vec2 uv, float t, float size)   // the water's height: + crests, - troughs&#10;{&#10;    float r = length(uv - 0.5) * 2.0;             // 0 in the middle, 1 at the sides&#10;    float rmax = 0.15 + 1.25 * size;&#10;    float v = 0.0;&#10;    for (int k = 0; k &lt; 3 + LZ; k++) {&#10;        float age = fract(t * 0.25 + float(k) / 3.0);&#10;        float d = r - age * rmax;                  // how far behind the front of this ring&#10;        float w = 0.05 + 0.08 * age;               // the rings widen as they spread&#10;        v += sin(d / w * 3.1416 * 1.5) * exp(-d * d / (w * w * 2.0)) * (1.0 - age) * (1.0 - age);&#10;    }&#10;    return v * (1.0 - smoothstep(0.85, 1.0, r));  // dies out before the edge of the sign&#10;}&#10;&#10;vec4 fxRipple(vec2 uv, float t, vec3 tint, float size, float strength)&#10;{&#10;    float v = rippleV(uv, t, size);&#10;    float a = clamp(abs(v) * strength * 1.6, 0.0, 1.0);&#10;    return vec4(v &gt; 0.0 ? tint : vec3(0.0), a);&#10;}&#10;&#10;// ---------- edit aids (only with a background in Image 1) ----------&#10;float lumaAt(vec2 uv) { return dot(tex0(uv).rgb, vec3(0.299, 0.587, 0.114)); }&#10;&#10;// how much of an edge the picture has here (Sobel), so windows, signs and lamps stand out to place things on&#10;float edgeAt(vec2 uv)&#10;{&#10;    vec2 e = 1.5 / iResolution.xy;&#10;    float tl = lumaAt(uv + vec2(-e.x, e.y)), t = lumaAt(uv + vec2(0.0, e.y)), tr = lumaAt(uv + e);&#10;    float l = lumaAt(uv - vec2(e.x, 0.0)), r = lumaAt(uv + vec2(e.x, 0.0));&#10;    float bl = lumaAt(uv - e), b = lumaAt(uv - vec2(0.0, e.y)), br = lumaAt(uv + vec2(e.x, -e.y));&#10;    float gx = tr + 2.0 * r + br - tl - 2.0 * l - bl;&#10;    float gy = tl + 2.0 * t + tr - bl - 2.0 * b - br;&#10;    return smoothstep(0.08, 0.3, length(vec2(gx, gy)));&#10;}&#10;&#10;// a round magnifier beside the point p (pixels): the background 4 times bigger, with a cross on p&#10;void magnifier(inout vec3 C, vec2 fc, vec2 p)&#10;{&#10;    vec2 R = iResolution.xy;&#10;    float S = R.y / 1080.0, rad = 110.0 * S;&#10;    vec2 off = vec2(p.x &gt; R.x - 300.0 * S ? -150.0 : 150.0, p.y &gt; R.y - 300.0 * S ? -150.0 : 150.0) * S;&#10;    vec2 m = p + off;&#10;    float d = length(fc - m);&#10;    if (d &gt; rad + 3.0 * S) return;&#10;    vec2 src = p + (fc - m) / 4.0;&#10;    vec3 col = tex0(src / R).rgb;&#10;    vec2 a = abs(fc - m);&#10;    float cross = (1.0 - smoothstep(0.5, 1.5, min(a.x, a.y) / S)) * step(max(a.x, a.y), 18.0 * S);&#10;    col = mix(col, vec3(0.54, 0.25, 1.0), cross);&#10;    C = mix(col, vec3(0.54, 0.25, 1.0), smoothstep(rad - 1.0, rad, d));&#10;}&#10;&#10;// ---------- v1.6 ----------&#10;float lum(vec3 c) { return dot(c, vec3(0.299, 0.587, 0.114)); }&#10;float fbm(vec2 p)&#10;{&#10;    float v = 0.0, a = 0.5;&#10;    for (int i = 0; i &lt; 5 + LZ; i++) { v += a * vnoise(p); p = p * 2.03 + vec2(1.7, 9.2); a *= 0.5; }&#10;    return v;&#10;}&#10;&#10;// how an effect follows the picture under it: 1 its light and shade show through, 2 only on bright parts, 3 only on dark parts&#10;void picReact(inout vec4 s, int mode, vec3 pic)&#10;{&#10;    float l = lum(pic);&#10;    if (mode == 1) s.rgb *= 0.25 + 1.5 * l;&#10;    if (mode == 2) s.a *= smoothstep(0.3, 0.6, l);&#10;    if (mode == 3) s.a *= 1.0 - smoothstep(0.3, 0.6, l);&#10;}&#10;&#10;// clouds drifting across the board, see-through between them, fading at its edges&#10;vec4 fxClouds(vec2 uv, float t, vec3 tint)&#10;{&#10;    vec2 p = uv * vec2(3.0, 2.0) + vec2(t * 0.15, 0.0);&#10;    float n = fbm(p + 0.5 * fbm(p * 0.7 - vec2(t * 0.05, 0.0)));&#10;    float a = smoothstep(0.42, 0.75, n);&#10;    vec3 col = mix(tint * 0.55, tint, smoothstep(0.45, 0.9, n));   // lit tops, darker bellies&#10;    float e = smoothstep(0.0, 0.15, uv.x) * smoothstep(0.0, 0.15, 1.0 - uv.x) * smoothstep(0.0, 0.15, uv.y) * smoothstep(0.0, 0.15, 1.0 - uv.y);&#10;    return vec4(col, a * e);&#10;}&#10;&#10;// smoke rising from the middle of the board's bottom edge, swaying and widening as it goes up, gone at the top&#10;vec4 fxSmoke(vec2 uv, float t, vec3 tint)&#10;{&#10;    float h = 1.0 - uv.y;                          // 0 at the bottom, 1 at the top&#10;    float x = uv.x - 0.5;&#10;    float sway = (fbm(vec2(h * 1.5 - t * 0.25, 3.0)) - 0.5) * 0.5 * h;&#10;    float wdt = 0.05 + 0.32 * h;&#10;    float plume = exp(-pow((x - sway) / wdt, 2.0));&#10;    float n = fbm(vec2(x * 4.0 / (0.3 + h), h * 3.0 - t * 0.8));&#10;    float a = plume * (0.35 + 0.65 * smoothstep(0.2, 0.65, n)) * (1.0 - smoothstep(0.5, 1.0, h)) * smoothstep(0.0, 0.06, h);&#10;    return vec4(tint * (0.6 + 0.4 * n), clamp(a * 0.9, 0.0, 1.0));&#10;}&#10;&#10;// a lit rectangle (cov: how much of the pixel is inside) with a glow round it, glow 0..1 its reach&#10;vec4 fxLightBox(vec2 uv, float cov, float amp, vec3 tint, float glow)&#10;{&#10;    vec2 d = max(abs(uv - 0.5) - 0.5, 0.0);&#10;    float g = exp(-length(d) * (3.0 + 30.0 * (1.0 - glow)));&#10;    return vec4(tint * amp * (cov * 0.95 + (1.0 - cov) * g * 0.7), 1.0);&#10;}&#10;&#10;// the picture's colour round a spot (5 samples, so one odd pixel does not decide it)&#10;vec3 keyColour(vec2 k)&#10;{&#10;    vec2 e = 2.0 / iResolution.xy;&#10;    return (tex0(k).rgb + tex0(k + vec2(e.x, 0.0)).rgb + tex0(k - vec2(e.x, 0.0)).rgb +&#10;            tex0(k + vec2(0.0, e.y)).rgb + tex0(k - vec2(0.0, e.y)).rgb) / 5.0;&#10;}&#10;&#10;// light added where the picture has (nearly) the key colour: tol how near, soft how gently it fades&#10;vec4 fxKeyGlow(vec3 pic, vec3 key, float tol, float soft, float amp, vec3 tint)&#10;{&#10;    float t0 = 0.02 + 0.45 * tol;&#10;    float mk = 1.0 - smoothstep(t0, t0 + 0.02 + 0.3 * soft, length(pic - key));&#10;    return vec4(tint * mk * amp * (0.6 + 0.8 * lum(pic)), 1.0);&#10;}&#10;&#10;// ---------- v1.7: edges that tell straight from round ----------&#10;// the picture's brightness gradient (Sobel), measured e pixels apart&#10;vec2 gradAt(vec2 uv, vec2 e)&#10;{&#10;    float tl = lumaAt(uv + vec2(-e.x, e.y)), t = lumaAt(uv + vec2(0.0, e.y)), tr = lumaAt(uv + e);&#10;    float l = lumaAt(uv - vec2(e.x, 0.0)), r = lumaAt(uv + vec2(e.x, 0.0));&#10;    float bl = lumaAt(uv - e), b = lumaAt(uv - vec2(0.0, e.y)), br = lumaAt(uv + vec2(e.x, -e.y));&#10;    return vec2(tr + 2.0 * r + br - tl - 2.0 * l - bl, tl + 2.0 * t + tr - bl - 2.0 * b - br);&#10;}&#10;&#10;// Edges with a filter: 0 all (green straight, pink round, white the rest), 1 straight only, 2 round only.&#10;// An edge is straight when it runs the same way a little further along it on both sides, round when it turns&#10;// gently (a corner turns sharply and counts as neither). sens 0..1 finds fainter edges, width 0..1 draws them wider.&#10;void edgeView(inout vec3 C, vec2 uv, int filt, float sens, float width)&#10;{&#10;    vec2 px = 1.0 / iResolution.xy;&#10;    vec2 e = px * (1.0 + 3.0 * width);&#10;    vec2 g = gradAt(uv, e);&#10;    float mag = length(g);&#10;    float thr = 0.8 * pow(0.04, sens);            // sens 0: only hard edges, 1: faint ones too&#10;    float on = smoothstep(thr * 0.7, thr * 1.3, mag);&#10;    if (on &lt;= 0.0) return;&#10;    vec2 n = g / max(mag, 1e-5);&#10;    // look about 24 pixels along the edge each way; a curve has bent away from the straight line by then,&#10;    // so search a little across it for where the edge is strongest&#10;    vec2 e2 = px * 2.5 * (1.0 + width);&#10;    vec2 n0 = gradAt(uv, e2);&#10;    n0 /= max(length(n0), 1e-5);&#10;    vec2 tg = vec2(-n0.y, n0.x) * 24.0 * px * (1.0 + width);&#10;    vec2 ga = vec2(0.0), gb = vec2(0.0);&#10;    for (int k = -3; k &lt;= 3; k++) {&#10;        vec2 o = n0 * float(k) * 3.0 * px;&#10;        vec2 a = gradAt(uv + tg + o, e2), b = gradAt(uv - tg + o, e2);&#10;        if (length(a) &gt; length(ga)) ga = a;&#10;        if (length(b) &gt; length(gb)) gb = b;&#10;    }&#10;    float ma = length(ga), mb = length(gb);&#10;    // how far the edge turns on each side, in radians; a side with no edge counts as a sharp turn&#10;    float ta = ma &gt; thr * 0.5 ? acos(clamp(abs(dot(n0, ga / ma)), 0.0, 1.0)) : 2.0;&#10;    float tb = mb &gt; thr * 0.5 ? acos(clamp(abs(dot(n0, gb / mb)), 0.0, 1.0)) : 2.0;&#10;    float turn = max(ta, tb);&#10;    float straight = 1.0 - smoothstep(0.05, 0.09, turn);&#10;    // round: both sides turn, gently (a corner turns about 1.57 and is neither)&#10;    float round_ = smoothstep(0.08, 0.14, min(ta, tb)) * (1.0 - smoothstep(0.7, 1.0, turn));&#10;    vec3 green = vec3(0.25, 1.0, 0.45), pink = vec3(1.0, 0.35, 0.85);&#10;    if (filt == 1) { C = mix(C, green, on * straight * 0.9); return; }&#10;    if (filt == 2) { C = mix(C, pink, on * round_ * 0.9); return; }&#10;    vec3 col = straight &gt; 0.5 ? green : round_ &gt; 0.5 ? pink : vec3(0.85);&#10;    C = mix(C, col, on * (straight &gt; 0.5 || round_ &gt; 0.5 ? 0.9 : 0.45));&#10;}&#10;&#10;// ---------- v1.8: how much of this pixel the quad covers, measured on screen ----------&#10;// The smallest distance in pixels to the four sides (plus half a pixel), so the edge is smooth however steep the&#10;// perspective. Measuring on the board's own 0..1 (as before) broke down near its vanishing line: thin stray lines.&#10;float sideDist(vec2 p, vec2 u, vec2 v, float s)&#10;{&#10;    vec2 t = v - u;&#10;    return s * (t.x * (p.y - u.y) - t.y * (p.x - u.x)) / max(length(t), 1e-4);&#10;}&#10;float quadCov(vec2 q, vec2 a, vec2 b, vec2 c, vec2 d, vec2 R)&#10;{&#10;    vec2 p = q * R; a *= R; b *= R; c *= R; d *= R;&#10;    float area = (a.x * b.y - b.x * a.y) + (b.x * c.y - c.x * b.y) + (c.x * d.y - d.x * c.y) + (d.x * a.y - a.x * d.y);&#10;    float s = area &lt; 0.0 ? -1.0 : 1.0;&#10;    float e = min(min(sideDist(p, a, b, s), sideDist(p, b, c, s)), min(sideDist(p, c, d, s), sideDist(p, d, a, s)));&#10;    return clamp(e + 0.5, 0.0, 1.0);&#10;}&#10;&#10;// ---------- v1.9: Edge glow, the picture's own edges light up ----------&#10;// uv: where on the picture (as texture() counts), amp: the light mode, sens 0..1: fainter edges too,&#10;// width 0..1: a wider glow round them, style 0 glow, 1 a wave running over them, 2 sparkles along them.&#10;vec4 fxEdgeGlow(vec2 uv, float t, float amp, vec3 tint, float sens, float width, int style)&#10;{&#10;    vec2 px = 1.0 / iResolution.xy;&#10;    vec2 e = px * 1.5;&#10;    float thr = 0.8 * pow(0.04, sens);&#10;    float core = smoothstep(thr * 0.7, thr * 1.3, length(gradAt(uv, e)));&#10;    float halo = 0.0;   // edges a little way off, for the glow round them&#10;    float r = 3.0 + 18.0 * width;&#10;    for (int j = 0; j &lt; 12 + LZ; j++) {   // at three distances, turned a little each time, so the glow has no rings in it&#10;        float a = float(j) * 2.3998;&#10;        float d = r * (0.3 + 0.35 * float(j % 3));&#10;        halo += smoothstep(thr * 0.5, thr * 1.3, length(gradAt(uv + vec2(cos(a), sin(a)) * d * px, e))) * (1.15 - 0.3 * float(j % 3));&#10;    }&#10;    halo /= 12.0;&#10;    float k = 1.0;&#10;    vec2 fc = uv * iResolution.xy;&#10;    if (style == 1)&#10;        k = 0.15 + 1.6 * pow(0.5 + 0.5 * sin((fc.x * 0.8 + fc.y) * 0.012 - t * 3.0), 6.0);&#10;    else if (style == 2)&#10;        k = 0.1 + 2.0 * step(0.86, h21(floor(fc / 5.0) + floor(t * 6.0))) * core;&#10;    return vec4(tint * (core * 1.5 + halo * (0.3 + 0.9 * width)) * amp * k, 1.0);&#10;}&#10;&#10;// ---------- Cinemnode v1.1: the picture itself moves (m: where in the board, 0..1 from its top left) ----------&#10;float edgeFade(vec2 m, float w) { return smoothstep(0.0, w, min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))); }&#10;vec3 picAt(vec2 uv) { return tex0(uv).rgb; }&#10;&#10;vec4 fxFlow(vec2 uv, vec2 m, float t, float dir, float len)   // water runs one way: two phases, faded into each other&#10;{&#10;    float a = dir * 6.2831853;&#10;    vec2 d = vec2(sin(a), -cos(a));   // 0: down, 90: right, 180: up, 270: left&#10;    float L = (0.008 + 0.07 * len) * edgeFade(m, 0.1);&#10;    float ph = vnoise(uv * 9.0) * 0.6;&#10;    float p1 = fract(t * 0.3 + ph), p2 = fract(t * 0.3 + ph + 0.5);&#10;    float w = 1.0 - abs(2.0 * p1 - 1.0);&#10;    return vec4(mix(picAt(uv - d * L * p2), picAt(uv - d * L * p1), w), 1.0);&#10;}&#10;&#10;vec4 fxSway(vec2 uv, vec2 m, float t, float wind, float size, int style)   // 0 grass (fixed at the bottom), 1 leaves, 2 flag (fixed on the left)&#10;{&#10;    float k = 2.0 + 10.0 * (1.0 - size);&#10;    float gust = 0.65 + 0.35 * sin(t * 0.37) * sin(t * 0.23 + 1.0);&#10;    float fade = edgeFade(m, 0.15);&#10;    vec2 off;&#10;    float shade = 1.0;&#10;    if (style == 2) {&#10;        float w = sin(m.x * k - t * 4.0 + vnoise(m * 3.0 + t * 0.3) * 2.0);&#10;        off = vec2(0.15 * w, w) * m.x;&#10;        shade = 1.0 + 0.18 * wind * cos(m.x * k - t * 4.0) * m.x;&#10;    } else {&#10;        float w = style == 0 ? 1.0 - m.y : 0.55 + 0.45 * vnoise(m * k + 4.0);&#10;        off = vec2(sin(t * 2.0 + m.x * k * 0.7 + vnoise(m * k) * 3.0) + 0.5 * sin(t * 3.3 + m.y * k), 0.0) * w;&#10;    }&#10;    off *= wind * 0.018 * gust * (style == 2 ? 1.0 : fade);&#10;    return vec4(picAt(uv + vec2(off.x, -off.y)) * shade, 1.0);&#10;}&#10;&#10;vec4 fxHaze(vec2 uv, vec2 m, float t, float amt, float size)   // air that trembles, rising, strongest low down&#10;{&#10;    vec2 p = m * (6.0 + 30.0 * (1.0 - size)) + vec2(0.0, t * 1.5);&#10;    vec2 d = vec2(vnoise(p) - 0.5, vnoise(p + 17.3) - 0.5);&#10;    d *= amt * 0.014 * edgeFade(m, 0.12) * (0.4 + 0.6 * m.y);&#10;    return vec4(picAt(uv + vec2(d.x, -d.y)), 1.0);&#10;}&#10;&#10;vec4 fxReflect(vec2 q, vec2 m, float t, vec2 a, vec2 b, float wave, float clear, vec3 tint, int style)   // the picture above the board's top edge, mirrored and rippling&#10;{&#10;    float top = mix(a.y, b.y, clamp(m.x, 0.0, 1.0));&#10;    float dy = max(q.y - top, 0.0);&#10;    float rx = (sin(dy * 260.0 / (1.0 + dy * 12.0) - t * 3.0) + 0.6 * (vnoise(vec2(q.x * 40.0, dy * 90.0 - t * 1.5)) - 0.5)) * wave * 0.008 * (0.3 + dy * 10.0);&#10;    vec2 r = vec2(q.x + rx, top - dy - 0.002);&#10;    vec3 col = picAt(vec2(r.x, 1.0 - r.y)) * mix(vec3(1.0), tint, 0.35) * 0.8;&#10;    if (style == 1) {   // a wet street: the lights stretched down in streaks, barely rippling&#10;        col = vec3(0.0);&#10;        for (int i = 0; i &lt; 8 + LZ; i++)&#10;            col += picAt(vec2(q.x + rx * 0.3, 1.0 - (top - dy * (0.6 + 0.08 * float(i)) - 0.002)));&#10;        col = col / 8.0 * mix(vec3(1.0), tint, 0.35) * 0.9;&#10;    }&#10;    return vec4(col, clear * smoothstep(0.0, 0.01, dy + 0.004));&#10;}&#10;&#10;vec4 fxBreathe(vec2 uv, vec2 m, float t, vec2 ctr, float amt, float soft)   // a very slow zoom and drift&#10;{&#10;    vec2 c = vec2(ctr.x, 1.0 - ctr.y);&#10;    float z = 1.0 - amt * 0.05 * (0.5 + 0.5 * sin(t * 0.5));&#10;    vec2 drift = amt * 0.004 * vec2(sin(t * 0.31), cos(t * 0.23));&#10;    vec3 moved = picAt(c + (uv - c) * z + drift);&#10;    return vec4(mix(picAt(uv), moved, soft &gt; 0.5 ? edgeFade(m, 0.15) : 1.0), 1.0);&#10;}&#10;&#10;// ---------- Cinemnode v1.1: laid over the picture ----------&#10;vec4 fxParticles(vec2 p, float t, vec3 tint, float amount, float size, int style)&#10;{   // 0 snow, 1 dust, 2 fireflies, 3 leaves, 4 blossom, 5 hail, 6 sand, 7 stars (p: fc / R.y). 1, 2 and 7 add light; the rest cover&#10;    vec3 c = vec3(0.0), col = tint;&#10;    float a = 0.0;&#10;    for (int L = 0; L &lt; 3 + LZ; L++) {&#10;        float fl = float(L);&#10;        float sc = (style == 7 ? 14.0 : style == 5 ? 9.0 : 5.0) + fl * 5.0;&#10;        vec2 off = style == 0 ? vec2(sin(t * 0.4 + fl) * 0.6, t * (1.2 + 0.5 * fl)) :&#10;                   style == 1 ? vec2(t * 0.12, sin(t * 0.2 + fl) * 0.3) :&#10;                   style == 2 ? vec2(sin(t * 0.1 + fl) * 0.3, -t * 0.08) :&#10;                   style == 3 || style == 4 ? vec2(t * 0.35 + sin(t * 0.5 + fl) * 0.8, t * (style == 3 ? 0.7 : 0.45) * (1.0 + 0.3 * fl)) :&#10;                   style == 5 ? vec2(t * 0.3, t * (5.0 + 1.5 * fl)) :&#10;                   style == 6 ? vec2(-t * (4.0 + 1.5 * fl), sin(t * 0.7 + fl) * 0.25) : vec2(fl * 3.1, 0.0);&#10;        vec2 g = p * sc + off;&#10;        vec2 id = floor(g), f = fract(g) - 0.5;&#10;        float h = h21(id + fl * 31.7);&#10;        if (h &gt; 0.15 + 0.85 * amount) continue;&#10;        vec2 o = (vec2(h21(id + 3.1), h21(id + 7.7)) - 0.5) * 0.5;&#10;        if (style == 0 || style == 3 || style == 4) o.x += 0.15 * sin(t * (1.0 + h) + h * 20.0);&#10;        if (style == 2) o += 0.2 * vec2(sin(t * (0.7 + h) + h * 20.0), cos(t * (0.9 + h) + h * 13.0));&#10;        float r = (0.04 + 0.1 * size) * (0.6 + 0.4 * h) * (1.0 - fl * 0.2);&#10;        vec2 d = f - o;&#10;        if (style == 3 || style == 4) {   // a leaf or a petal, turning and tumbling&#10;            float an = t * (1.0 + h) * 2.0 + h * 6.0;&#10;            d = mat2(cos(an), -sin(an), sin(an), cos(an)) * d;&#10;            d.y /= 0.35 + 0.4 * abs(sin(t * 2.0 + h * 10.0));&#10;            r *= style == 3 ? 1.6 : 1.1;&#10;        }&#10;        if (style == 6) { d.x /= 5.0; r *= 0.5; }&#10;        if (style == 5) r *= 0.5;&#10;        if (style == 7) r *= 0.35;&#10;        float dd = length(d);&#10;        float core = smoothstep(r, r * 0.3, dd);&#10;        float halo = style == 2 ? 0.06 * r / (dd * dd + 0.004) * 0.02 : style == 7 ? 0.0004 / (dd * dd + 0.0004) * 0.3 : 0.0;&#10;        float tw = style == 2 ? 0.5 + 0.5 * sin(t * 3.0 * (0.5 + h) + h * 40.0) :&#10;                   style == 1 ? 0.55 + 0.45 * sin(t * 2.0 + h * 30.0) :&#10;                   style == 7 ? 0.35 + 0.65 * pow(vnoise1(t * 3.0 + h * 50.0), 2.0) : 1.0;&#10;        vec3 pc = style == 3 ? mix(tint, tint * vec3(0.7, 0.5, 0.3), h21(id + 9.0)) :&#10;                  style == 4 ? mix(tint, vec3(1.0), 0.4 * h21(id + 9.0)) :&#10;                  style == 6 ? tint * (0.7 + 0.3 * h) : tint;&#10;        c += pc * (core + halo) * tw * (style == 1 ? 0.6 : 1.0);&#10;        if (core * tw &gt; a) { a = core * tw; col = pc; }&#10;    }&#10;    bool covers = style == 0 || style == 3 || style == 4 || style == 5 || style == 6;&#10;    return covers ? vec4(col, clamp(a * (style == 6 ? 0.7 : 1.0), 0.0, 1.0)) : vec4(c, 1.0);&#10;}&#10;&#10;vec4 fxRays(vec2 m, float t, vec3 tint, float from, float many)   // sunbeams fanning down from above the board&#10;{&#10;    vec2 d = m - vec2(0.1 + 0.8 * from, -0.4);&#10;    float a = atan(d.x, d.y);&#10;    float r = vnoise(vec2(a * (8.0 + 24.0 * many), t * 0.15)) * vnoise(vec2(a * 23.0 + 5.0, t * 0.27 + 3.0));&#10;    r = smoothstep(0.08, 0.6, r);&#10;    float fall = smoothstep(1.6, 0.3, length(d));&#10;    float side = smoothstep(0.0, 0.12, m.x) * smoothstep(1.0, 0.88, m.x) * smoothstep(0.0, 0.08, m.y) * smoothstep(1.0, 0.8, m.y);&#10;    return vec4(tint * r * fall * side * 0.8, 1.0);&#10;}&#10;&#10;vec4 fxFire(vec2 m, float t, vec3 tint, float height, float detail, int style)   // flames rising from the bottom of the board (1: a rocket's jet, down from the top)&#10;{&#10;    if (style == 1) {&#10;        float down = m.y, w = abs(m.x - 0.5) * 2.0;&#10;        float len = 0.3 + 0.7 * height;&#10;        float n = fbm(vec2(m.x * 6.0, m.y * 4.0 - t * 9.0));&#10;        float body = smoothstep(0.45 + 0.4 * detail * n, 0.0, w / (0.25 + down * 0.9)) * smoothstep(len, len * 0.3, down + n * 0.15);&#10;        float core = smoothstep(0.35, 0.0, w / (0.12 + down * 0.3)) * smoothstep(len * 0.5, 0.0, down);&#10;        vec3 col = vec3(1.4, 0.55, 0.15) * body + vec3(0.8, 0.9, 1.4) * core * 1.5;&#10;        return vec4(col * mix(vec3(1.0), tint, 0.5) * (0.9 + 0.1 * sin(t * 60.0)), 1.0);&#10;    }&#10;    float up = 1.0 - m.y;&#10;    vec2 p = vec2(m.x * (3.0 + 4.0 * detail), up * (2.0 + 3.0 * detail));&#10;    float n = fbm(p * 1.5 - vec2(0.0, t * 2.2)) * 0.8 + fbm(p * 3.0 - vec2(t * 0.3, t * 3.5)) * 0.4;&#10;    float shape = 1.0 - up / (0.25 + 0.75 * height);&#10;    float side = 1.0 - pow(abs(m.x * 2.0 - 1.0), 2.0);&#10;    float f = clamp(shape * side * 1.6 + n - 0.9, 0.0, 1.0);&#10;    f *= smoothstep(0.0, 0.15, m.x) * smoothstep(1.0, 0.85, m.x) * smoothstep(0.0, 0.2, m.y);&#10;    vec3 col = vec3(1.5, 0.42, 0.08) * f + vec3(1.0, 0.85, 0.45) * pow(f, 3.0) * 1.5;&#10;    return vec4(col * mix(vec3(1.0), tint, 0.5) * 1.3, 1.0);&#10;}&#10;&#10;vec4 fxSteam(vec2 m, float t, vec3 tint, float amount, float width)   // soft wisps going up and fading&#10;{&#10;    vec2 p = vec2((m.x - 0.5) * (2.0 + 3.0 * (1.0 - width)), 1.0 - m.y);&#10;    p.x += 0.3 * sin(p.y * 3.0 - t * 1.3) * p.y;&#10;    float n = fbm(vec2(p.x * 2.5, p.y * 2.0 - t * 0.8));&#10;    float col = smoothstep(0.8, 0.0, abs(p.x) / (0.35 + p.y * 0.8));&#10;    float a = col * smoothstep(0.35, 0.75, n) * smoothstep(1.0, 0.4, p.y) * smoothstep(0.0, 0.1, p.y) * (0.6 + 1.2 * amount);&#10;    return vec4(tint, clamp(a, 0.0, 1.0));&#10;}&#10;&#10;vec4 fxLightning(vec2 m, float t, vec3 tint, float flash, float bolt, vec3 pic, int style)   // now and then a strike: the picture lights up, with a bolt if you like&#10;{&#10;    float k = floor(t * 0.5), f = fract(t * 0.5);&#10;    float h = h11(k * 1.7 + 0.3);&#10;    if (h &lt; 0.4) return vec4(0.0);&#10;    float amp = exp(-f * 45.0) + 0.7 * exp(-max(f - 0.06, 0.0) * 35.0) * step(0.06, f);&#10;    vec3 c = (pic * 1.8 * flash + tint * 0.35 * flash) * amp;&#10;    if (style == 1) {   // in the clouds: parts of them light up from inside, no bolt&#10;        float lit = smoothstep(0.4, 0.8, fbm(m * 3.0 + vec2(k * 3.7, k * 1.3)));&#10;        return vec4((pic * 2.2 * flash + tint * 0.5 * flash) * amp * lit, 1.0);&#10;    }&#10;    if (bolt &gt; 0.01) {&#10;        float x = 0.2 + 0.6 * h11(k + 9.1);&#10;        x += (vnoise1(m.y * 6.0 + k * 13.0) - 0.5) * 0.25 + (vnoise1(m.y * 25.0 + k * 7.0) - 0.5) * 0.06;&#10;        float d = abs(m.x - x);&#10;        float b = (0.0015 / (d + 0.0015) + 0.25 * exp(-d * 30.0)) * smoothstep(1.0, 0.6, m.y / (0.5 + 0.5 * h11(k + 2.2)));&#10;        c += mix(vec3(1.0), tint, 0.4) * b * bolt * amp * 1.5;&#10;    }&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;vec4 fxGlass(vec2 p, vec2 uv, float t, vec3 tint, float drops, float mist)   // drops on a window, running down, the picture bent in them (p: fc / R.y)&#10;{&#10;    vec2 n = vec2(0.0);&#10;    float mask = 0.0;&#10;    for (int L = 0; L &lt; 2 + LZ; L++) {   // drops that sit, grow and go&#10;        float sc = 16.0 + 12.0 * float(L);&#10;        vec2 g = p * sc, id = floor(g), f = fract(g) - 0.5;&#10;        float h = h21(id + float(L) * 7.0);&#10;        if (h &lt; 0.15 + 0.7 * drops) {&#10;            vec2 o = (vec2(h21(id + 1.3), h21(id + 2.7)) - 0.5) * 0.6;&#10;            float life = fract(t * 0.05 + h * 7.0);&#10;            float r = (0.12 + 0.2 * h21(id + 4.1)) * smoothstep(1.0, 0.8, life) * smoothstep(0.0, 0.05, life);&#10;            vec2 d = (f - o) / max(r, 0.001);&#10;            float k = smoothstep(1.0, 0.8, length(d));&#10;            mask = max(mask, k);&#10;            n += d * k;&#10;        }&#10;    }&#10;    {   // drops that run down, leaving a trail&#10;        float sc = 7.0;&#10;        float cx = floor(p.x * sc), fx = fract(p.x * sc) - 0.5;&#10;        float h = h11(cx * 3.7);&#10;        if (h &lt; 0.2 + 0.6 * drops) {&#10;            float wob = 0.15 * sin(p.y * 9.0 + h * 20.0);&#10;            float yy = fract(p.y * 0.5 + t * (0.05 + 0.08 * h) + h);&#10;            vec2 d = vec2((fx - wob) / 0.16, (yy - 0.5) * 9.0);&#10;            float k = smoothstep(1.0, 0.8, length(d));&#10;            float trail = smoothstep(0.06, 0.0, abs(fx - wob)) * step(0.5, yy) * smoothstep(1.0, 0.5, yy) * 0.6;&#10;            mask = max(mask, max(k, trail));&#10;            n += d * k + vec2((fx - wob) * 4.0, 0.0) * trail;&#10;        }&#10;    }&#10;    vec3 blur = vec3(0.0);&#10;    for (int i = 0; i &lt; 8 + LZ; i++) {&#10;        float a = float(i) * 0.785398;&#10;        blur += picAt(uv + vec2(cos(a), sin(a)) * 0.006 * mist);&#10;    }&#10;    blur /= 8.0;&#10;    vec3 drop = picAt(uv - n * 0.035) * 1.1 + tint * pow(max(0.0, dot(normalize(n + 1e-4), vec2(-0.6, 0.8))), 4.0) * 0.35 * mask;&#10;    vec3 col = mix(blur * (1.0 + 0.15 * mist), drop, mask);&#10;    return vec4(col, max(mask, clamp(mist * 1.2, 0.0, 1.0)));&#10;}&#10;&#10;vec4 fxSparkle(vec2 fc, vec2 m, float t, vec3 tint, float amount, float size, float S, float bright, int style)   // glints that come and go where the water is bright (1: a moon's path down the middle)&#10;{&#10;    vec2 g = fc / (S * (8.0 + 14.0 * size));&#10;    vec2 id = floor(g), f = fract(g) - 0.5;&#10;    float h = h21(id);&#10;    if (h &gt; 0.1 + 0.6 * amount * (style == 1 ? 1.4 : 1.0)) return vec4(0.0);&#10;    vec2 d = f - (vec2(h21(id + 1.7), h21(id + 4.3)) - 0.5) * 0.6;&#10;    float tw = pow(max(0.0, sin(t * 3.0 * (0.6 + h) + h * 60.0)), 24.0);&#10;    float star = pow(max(0.0, 1.0 - length(d) * 5.0), 3.0) + 0.004 / (abs(d.x) + 0.01) * smoothstep(0.3, 0.0, abs(d.y)) + 0.004 / (abs(d.y) + 0.01) * smoothstep(0.3, 0.0, abs(d.x));&#10;    float where = style == 1 ? exp(-pow((m.x - 0.5) / (0.06 + 0.25 * m.y), 2.0)) : smoothstep(0.12, 0.7, bright);&#10;    return vec4(tint * min(star, 3.0) * tw * where * 1.5, 1.0);&#10;}&#10;&#10;// ---------- v3.5: the sound on In A, and the DAW's beat (P28 its place in quarter notes, P29 playing, P30 the bar's ramp) ----------&#10;// a band of the spectrum (first row of iChannel0, low notes on the left), 0..1 across it&#10;float auSpec(float a, float b)&#10;{&#10;    float s = 0.0;&#10;    for (int i = 0; i &lt; 8 + LZ; i++)&#10;        s += textureLod(iChannel0, vec2(mix(a, b, (float(i) + 0.5) / 8.0), 0.25), 0.0).x;&#10;    return s / 8.0;&#10;}&#10;// sens 0..1 (P31): how loud it must be before it moves anything, 0 only loud parts, 1 soft ones too&#10;float auLift(float v, float sens)&#10;{&#10;    float lo = 0.7 - 0.6 * sens;&#10;    return clamp((v - lo) / (1.0 - lo), 0.0, 1.0);&#10;}&#10;&#10;// ==== on demand: each block below goes into the shader only when an element uses it (the Script picks them by name) ====&#10;&#10;// @@ fxCloudShadow&#10;vec4 fxCloudShadow(vec2 uv, vec2 m, float t, float dark, float size)   // shadows of clouds drifting over the land&#10;{&#10;    vec2 p = uv * vec2(1.78, 1.0) * (1.5 + 4.0 * (1.0 - size)) + vec2(t * 0.08, t * 0.02);&#10;    float n = smoothstep(0.35, 0.7, fbm(p));&#10;    return vec4(picAt(uv) * (1.0 - dark * 0.6 * n * edgeFade(m, 0.12)), 1.0);&#10;}&#10;&#10;// @@ fxDappled&#10;vec4 fxDappled(vec2 uv, vec2 m, float t, vec3 tint, float amt, float size)   // sun through leaves: bright patches that shift&#10;{&#10;    vec2 p = uv * vec2(1.78, 1.0) * (6.0 + 20.0 * (1.0 - size));&#10;    float n = vnoise(p + vec2(sin(t * 0.7), cos(t * 0.5)) * 0.6 + t * 0.1) * vnoise(p * 1.7 - t * 0.13 + 3.0);&#10;    float spot = smoothstep(0.2, 0.5, n);&#10;    vec3 c = picAt(uv) * (1.0 + amt * (spot * 1.4 - 0.3) * edgeFade(m, 0.12) * mix(vec3(1.0), tint, 0.5));&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;// @@ fxDayNight&#10;vec4 fxDayNight(vec2 uv, float night, float blue, vec3 tint)   // 0 day, 0.5 golden hour, 1 night (bright windows stay lit): animate it&#10;{&#10;    vec3 c = picAt(uv);&#10;    float l = lum(c);&#10;    vec3 golden = c * vec3(1.15, 0.95, 0.72);&#10;    vec3 dark = mix(vec3(l) * vec3(0.22, 0.3, 0.5 + 0.3 * blue), c, smoothstep(0.7, 0.95, l));&#10;    vec3 r = night &lt; 0.5 ? mix(c, golden, night * 2.0) : mix(golden, dark, night * 2.0 - 1.0);&#10;    return vec4(r * mix(vec3(1.0), tint, 0.25 * night), 1.0);&#10;}&#10;&#10;// @@ fxSwell&#10;vec4 fxSwell(vec2 uv, vec2 m, float t, float amt, float tilt)   // the sea's horizon rising, falling and tilting&#10;{&#10;    float y = (sin(t * 0.8) * 0.006 + sin(t * 1.3 + 1.0) * 0.003) * amt;&#10;    float r = sin(t * 0.6) * 0.006 * tilt;&#10;    return vec4(picAt(uv + vec2(0.0, y + r * (uv.x - 0.5)) * edgeFade(m, 0.08)), 1.0);&#10;}&#10;&#10;// @@ fxHandheld&#10;vec4 fxHandheld(vec2 uv, float t, float amt, float zoom)   // a camera held by hand: a little zoomed in so its edges never show&#10;{&#10;    vec2 sh = vec2(vnoise1(t * 0.7) - 0.5, vnoise1(t * 0.6 + 7.0) - 0.5) * 0.012 * amt;&#10;    float z = 1.0 - (0.015 + 0.03 * zoom) * max(amt, 0.3);&#10;    return vec4(picAt(vec2(0.5) + (uv - 0.5) * z + sh), 1.0);&#10;}&#10;&#10;// @@ fxFringe&#10;vec4 fxFringe(vec2 uv, float t, float amt, float wob)   // colour fringes towards the edges, as a cheap lens has&#10;{&#10;    vec2 d = (uv - 0.5) * 0.012 * amt * (1.0 + wob * 0.5 * sin(t * 1.5));&#10;    return vec4(picAt(uv + d).r, picAt(uv).g, picAt(uv - d).b, 1.0);&#10;}&#10;&#10;// @@ fxBloom&#10;vec4 fxBloom(vec2 uv, float t, vec3 tint, float amt, float size)   // the bright parts glow softly into what is round them&#10;{&#10;    vec3 c = picAt(uv), b = vec3(0.0);&#10;    float r = 0.004 + 0.02 * size;&#10;    for (int i = 0; i &lt; 12 + LZ; i++) {&#10;        float a = float(i) * 0.5236;&#10;        for (int j = 1; j &lt;= 2; j++)&#10;            b += max(picAt(uv + vec2(cos(a) / 1.78, sin(a)) * r * float(j)) - 0.6, 0.0);&#10;    }&#10;    return vec4(c + b / 24.0 * amt * 4.0 * mix(vec3(1.0), tint, 0.5), 1.0);&#10;}&#10;&#10;// @@ fxLightTrails&#10;vec4 fxLightTrails(vec2 m, float t, vec3 tint, float amount, float len, int style)   // cars' lights drawn out in streaks along the board&#10;{&#10;    vec3 c = vec3(0.0);&#10;    for (int L = 0; L &lt; 4 + LZ; L++) {&#10;        float fl = float(L), dir = L &lt; 2 ? 1.0 : -1.0;&#10;        float lane = exp(-pow((m.y - (0.2 + fl * 0.2)) / 0.025, 2.0));&#10;        float x = m.x * dir * 2.5 - t * (0.5 + 0.15 * fl);&#10;        float id = floor(x), f = fract(x);&#10;        if (h11(id + fl * 13.0) &gt; 0.2 + 0.8 * amount) continue;&#10;        float streak = smoothstep(0.0, 0.03, f) * smoothstep(0.1 + 0.8 * len, 0.0, f);&#10;        vec3 col = style == 0 ? (dir &gt; 0.0 ? vec3(1.0, 0.9, 0.75) : vec3(1.0, 0.12, 0.06)) : tint;&#10;        c += col * lane * streak * 1.6;&#10;    }&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;// @@ fxTV&#10;vec4 fxTV(vec2 m, float t, vec3 tint, float flick, float colour)   // a television's light on the walls of a room&#10;{&#10;    float k = floor(t * 3.0), h = h11(k), h2 = h11(k + 0.5);&#10;    float b = 0.5 + 0.5 * h + flick * 0.4 * (h11(floor(t * 20.0)) - 0.5);&#10;    vec3 c = mix(vec3(0.75, 0.85, 1.0), vec3(h, h2, 1.0 - h * 0.5), colour);&#10;    float soft = smoothstep(0.0, 0.3, min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))) * 0.6 + 0.4;&#10;    return vec4(c * mix(vec3(1.0), tint, 0.5) * b * soft * 0.8, 1.0);&#10;}&#10;&#10;// @@ fxFog&#10;vec4 fxFog(vec2 m, float t, vec3 tint, float thick, float height, int style)   // 0 fog creeping along the ground, 1 a bank of mist&#10;{&#10;    float n = fbm(vec2(m.x * 3.0 - t * 0.15, m.y * 2.0)) * 0.6 + fbm(vec2(m.x * 7.0 + t * 0.1, m.y * 5.0)) * 0.4;&#10;    float lay = style == 0 ? smoothstep(1.0 - 0.9 * height, 1.0, m.y) : 1.0 - abs(m.y - 0.5) * 2.0 * (1.0 - 0.6 * height);&#10;    float sides = smoothstep(0.0, 0.15, m.x) * smoothstep(1.0, 0.85, m.x);&#10;    return vec4(tint, clamp(lay * (n * 1.4 - 0.2) * (0.4 + 0.9 * thick) * sides, 0.0, 1.0));&#10;}&#10;&#10;// @@ fxRainbow&#10;vec4 fxRainbow(vec2 m, float t, float strength, float width)   // a bow from the board's bottom corners, coming and going&#10;{&#10;    vec2 p = vec2(m.x - 0.5, 1.0 - m.y);&#10;    float band = (length(p) / 0.5 - 0.75) / (0.08 + 0.15 * width);&#10;    if (band &lt; 0.0 || band &gt; 1.0) return vec4(0.0);&#10;    vec3 c = clamp(abs(fract((1.0 - band) * 0.8 + vec3(0.0, 0.667, 0.333)) * 6.0 - 3.0) - 1.0, 0.0, 1.0);&#10;    float fade = sin(band * 3.1416) * (0.55 + 0.45 * sin(t * 0.3)) * smoothstep(0.0, 0.25, p.y);&#10;    return vec4(c * fade * strength * 0.7, 1.0);&#10;}&#10;&#10;// @@ fxShore&#10;vec4 fxShore(vec2 uv, vec2 m, float t, vec3 tint, float reach, float foam)   // waves running up the beach: the sea at the board's top, the sand at its bottom&#10;{&#10;    float cyc = t * 0.1, k = floor(cyc), ph = fract(cyc);&#10;    float run = ph &lt; 0.35 ? 1.0 - pow(1.0 - ph / 0.35, 2.0) : 1.0 - smoothstep(0.35, 1.0, ph);   // up quickly, back slowly&#10;    float most = 0.12 + reach * (0.55 + 0.25 * h11(k));&#10;    float wig = (fbm(vec2(m.x * 3.0 + k * 7.1, k)) - 0.5) * 0.12;   // the front is never straight&#10;    float front = 0.08 + (most - 0.08) * run + wig;&#10;    float d = front - m.y;   // above 0: under the water&#10;    float under = smoothstep(-0.004, 0.006, d), deep = smoothstep(0.0, 0.3, d);&#10;    vec2 bend = vec2(vnoise(m * vec2(20.0, 12.0) + t * 0.6), vnoise(m * vec2(20.0, 12.0) - t * 0.5 + 4.0)) - 0.5;&#10;    vec3 water = picAt(uv + bend * 0.006 * under) * mix(vec3(1.0), tint, 0.35 + 0.4 * deep) * (0.9 + 0.1 * deep);&#10;    float lace = smoothstep(0.5, 0.62, fbm(m * vec2(28.0, 16.0) + vec2(k * 3.0, t * 0.15))) * smoothstep(0.3, 0.6, fbm(m * vec2(9.0, 5.0) + k));&#10;    float foamAmt = clamp(smoothstep(0.014, 0.0, abs(d)) * 0.9 + lace * exp(-max(d, 0.0) / (0.03 + 0.1 * (1.0 - run))) * under * (0.4 + 0.8 * foam), 0.0, 1.0);&#10;    float wet = (1.0 - under) * smoothstep(most + wig + 0.01, most + wig - 0.05, m.y) * 0.22 * (0.3 + 0.7 * run) * (0.5 + 0.5 * fbm(m * vec2(14.0, 7.0)));   // sand the water just left&#10;    vec3 col = mix(water, vec3(0.96, 0.97, 1.0), foamAmt);&#10;    float a = max(under * (0.3 + 0.45 * deep), foamAmt);&#10;    float soft = smoothstep(0.0, 0.12, m.x) * smoothstep(1.0, 0.88, m.x) * smoothstep(0.0, 0.15, m.y);   // no hard board edges&#10;    if (a &lt; wet) return vec4(vec3(0.05, 0.04, 0.02), wet * soft);&#10;    return vec4(col, a * soft);&#10;}&#10;&#10;// @@ fxCaustics&#10;vec4 fxCaustics(vec2 m, float t, vec3 tint, float amt, float size)   // the net of light that water throws on a bottom or a wall&#10;{&#10;    vec2 p = m * (3.0 + 8.0 * (1.0 - size));&#10;    float c = 0.0;&#10;    for (int i = 0; i &lt; 2 + LZ; i++) {   // two nets drifting apart, their thin bright lines where the warped noise crosses its middle&#10;        float fi = float(i);&#10;        vec2 w = p * (1.0 + 0.6 * fi) + vec2(t * 0.25, -t * 0.18) * (fi * 2.0 - 1.0);&#10;        w += vec2(vnoise(w * 0.7 + t * 0.2), vnoise(w * 0.7 - t * 0.17 + 5.0)) * 1.6;&#10;        float n = abs(vnoise(w) - 0.5);&#10;        c += pow(1.0 - smoothstep(0.0, 0.07, n), 2.0) * (0.7 - 0.25 * fi);&#10;    }&#10;    return vec4(tint * c * amt * 1.4 * edgeFade(m, 0.1), 1.0);&#10;}&#10;&#10;// @@ fxBeacon&#10;vec4 fxBeacon(vec2 m, float t, vec3 tint, float width, float reach, int style)   // 0 a lighthouse's beam going round its middle, 1 a searchlight sweeping up from its bottom&#10;{&#10;    vec2 o = style == 0 ? vec2(0.5) : vec2(0.5, 1.0);&#10;    vec2 d = (m - o) * vec2(1.6, 1.0);&#10;    float ang = style == 0 ? t * 0.8 : -1.5708 + 0.7 * sin(t * 0.5);&#10;    float da = abs(mod(atan(d.y, d.x) - ang + 3.1416, 6.2832) - 3.1416);&#10;    float beam = smoothstep(0.04 + 0.2 * width, 0.0, da) * exp(-length(d) * (3.0 - 2.5 * reach));&#10;    return vec4(tint * (beam * 0.9 + exp(-length(d) * 40.0)), 1.0);&#10;}&#10;&#10;// @@ fxFrost&#10;vec4 fxFrost(vec2 uv, vec2 m, float t, vec3 tint, float grow, float blur)   // ice growing in from the window's edges: animate Grow&#10;{&#10;    float e = min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y));&#10;    float n = fbm(m * 12.0) * 0.5 + fbm(m * 40.0) * 0.3;&#10;    float L = grow * 0.55;&#10;    float ice = smoothstep(L + 0.02, L - 0.04, e + (n - 0.4) * 0.2);&#10;    float lines = pow(1.0 - abs(fract(n * 8.0) - 0.5) * 2.0, 6.0);&#10;    vec3 bl = vec3(0.0);&#10;    for (int i = 0; i &lt; 6 + LZ; i++) {&#10;        float a = float(i) * 1.0472;&#10;        bl += picAt(uv + vec2(cos(a) / 1.78, sin(a)) * 0.008 * blur);&#10;    }&#10;    vec3 c = mix(bl / 6.0, vec3(0.85, 0.92, 1.0) * mix(vec3(1.0), tint, 0.5), 0.35 + 0.4 * lines);&#10;    return vec4(c, ice);&#10;}&#10;&#10;// @@ fxDrips&#10;vec4 fxDrips(vec2 p, vec2 uv, float t, vec3 tint, float amount, float size)   // drops hitting a window, then running down a wandering way, smaller and smaller till gone (p: fc / R.y)&#10;{&#10;    float mask = 0.0;&#10;    vec2 n = vec2(0.0);&#10;    for (int i = 0; i &lt; 24 + LZ; i++) {&#10;        float fi = float(i);&#10;        if (fi &gt; 4.0 + 19.0 * amount) break;&#10;        float per = 4.0 + 4.0 * h11(fi * 3.7), cyc = t / per + h11(fi * 1.3), k = floor(cyc), ph = fract(cyc);&#10;        float h = h11(k * 7.9 + fi * 13.1);&#10;        vec2 s = vec2(0.02 + 1.74 * h, 0.35 + 0.65 * h11(k * 3.3 + fi));   // where it lands&#10;        float r0 = (0.012 + 0.03 * size) * (0.6 + 0.7 * h11(k + fi * 5.0));&#10;        float hit = smoothstep(0.0, 0.03, ph), slide = max(ph - 0.06, 0.0) / 0.94;&#10;        float fall = pow(slide, 1.3) * (0.3 + 0.4 * h11(fi + k * 2.1));   // how far down it has run&#10;        float wobble = (vnoise1(fall * 14.0 + h * 40.0) - 0.5) * 0.05 + (vnoise1(fall * 40.0 + h * 9.0) - 0.5) * 0.012;&#10;        vec2 head = vec2(s.x + wobble, s.y - fall);&#10;        float r = r0 * hit * (1.0 - 0.7 * slide) * smoothstep(1.0, 0.85, ph);&#10;        vec2 d = (p - head) / vec2(r, r * 1.2);&#10;        d.y -= 0.25 * smoothstep(0.0, 1.0, slide) * max(d.y, 0.0);   // a little tail upward while it runs&#10;        float drop = smoothstep(1.0, 0.75, length(d));&#10;        // the thin wet trail it leaves, along the way it went, drying behind it&#10;        float back = s.y - p.y;&#10;        if (back &gt; 0.0 &amp;&amp; back &lt; fall) {&#10;            float wx = s.x + (vnoise1(back * 14.0 + h * 40.0) - 0.5) * 0.05 + (vnoise1(back * 40.0 + h * 9.0) - 0.5) * 0.012;&#10;            float w = r0 * 0.4 * (1.0 - 0.5 * back / max(fall, 1e-3));&#10;            float tr = smoothstep(w, w * 0.3, abs(p.x - wx)) * 0.6 * (1.0 - 0.7 * slide) * smoothstep(0.0, 0.02, fall - back);&#10;            if (tr &gt; mask) { mask = tr; n = vec2((p.x - wx) / max(w, 1e-4) * 0.3, 0.0); }&#10;        }&#10;        if (drop &gt; mask) { mask = drop; n = d; }&#10;    }&#10;    vec3 c = picAt(uv - n * 0.03) * 1.05 + tint * pow(max(0.0, dot(normalize(n + 1e-4), vec2(-0.5, 0.85))), 6.0) * 0.6 * step(0.3, mask);&#10;    return vec4(c * (1.0 - 0.25 * smoothstep(0.6, 1.0, length(n)) * step(0.3, mask)), mask);&#10;}&#10;&#10;// @@ fxSweep&#10;vec4 fxSweep(vec2 m, float t, vec3 tint, float width, float often)   // headlights of a car going by, sweeping over a wall&#10;{&#10;    float per = 6.0 - 4.0 * often, ph = fract(t / per), h = h11(floor(t / per));&#10;    float pos = h &gt; 0.5 ? -0.4 + ph * 1.8 : 1.4 - ph * 1.8;&#10;    float d = (m.x - pos) / (0.08 + 0.3 * width);&#10;    return vec4(tint * exp(-d * d) * (0.7 + 0.3 * m.y), 1.0);&#10;}&#10;&#10;// @@ fxFlare&#10;vec3 fxFlare(vec2 q, vec2 src, float t, vec3 tint, float amt)   // a lens flare from a light: a glow, a streak and ghosts towards the middle&#10;{&#10;    vec2 asp = vec2(1.78, 1.0), d = (q - src) * asp;&#10;    float core = pow(0.02 / (length(d) + 0.02), 1.5);&#10;    float streak = 0.004 / (abs(d.y) + 0.004) * exp(-abs(d.x) * 3.0);&#10;    vec3 c = tint * (core + streak * 0.6);&#10;    vec2 axis = vec2(0.5) - src;&#10;    for (int i = 1; i &lt;= 4; i++) {&#10;        float fi = float(i);&#10;        vec2 gp = src + axis * (0.4 + fi * 0.45);&#10;        float r = 0.02 + 0.03 * mod(fi, 2.0);&#10;        c += mix(tint, vec3(0.4, 0.7, 1.0) * fi / 4.0, 0.5) * smoothstep(r, r * 0.6, length((q - gp) * asp)) * 0.15;&#10;    }&#10;    return c * amt * (0.9 + 0.1 * sin(t * 2.0));&#10;}&#10;&#10;// @@ fxShooting&#10;vec4 fxShooting(vec2 m, float t, vec3 tint, float often, float len)   // now and then a meteor streaks across&#10;{&#10;    vec3 c = vec3(0.0);&#10;    for (int i = 0; i &lt; 3 + LZ; i++) {&#10;        float fi = float(i), per = 3.0 + 6.0 * (1.0 - often) + fi;&#10;        float k = floor((t + fi * 1.7) / per), ph = fract((t + fi * 1.7) / per) * per;&#10;        if (ph &gt; 1.2) continue;&#10;        float h = h11(k * 3.1 + fi);&#10;        vec2 s = vec2(0.1 + 0.8 * h, 0.05 + 0.4 * h11(k + fi + 5.0));&#10;        vec2 dir = normalize(vec2(h11(k + 2.0) &gt; 0.5 ? 1.0 : -1.0, 0.45));&#10;        vec2 d = m - (s + dir * ph * 0.6);&#10;        float along = dot(d, -dir), across = abs(d.x * dir.y - d.y * dir.x);&#10;        float tr = step(0.0, along) * smoothstep(0.05 + 0.25 * len, 0.0, along) * smoothstep(0.004, 0.0, across) * smoothstep(1.2, 0.6, ph);&#10;        c += tint * (tr + exp(-length(d) * 120.0) * smoothstep(1.2, 0.8, ph)) * 1.5;&#10;    }&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;// @@ fxStarTrails&#10;vec4 fxStarTrails(vec2 q, vec2 ctr, float t, vec3 tint, float amount, float len)   // stars drawn out in arcs round the board's middle, turning&#10;{&#10;    vec2 d = (q - ctr) * vec2(1.78, 1.0);&#10;    float r = length(d), a = atan(d.y, d.x);&#10;    float ring = floor(r * 300.0), fr = fract(r * 300.0);&#10;    float h = h11(ring);&#10;    if (h &gt; 0.15 + 0.5 * amount) return vec4(0.0);&#10;    float arc = 0.2 + 2.5 * len, da = mod(a - h11(ring + 3.0) * 6.2832 - t * 0.05, 6.2832);&#10;    float on = step(da, arc) * (da / arc);&#10;    return vec4(tint * on * smoothstep(0.5, 0.1, abs(fr - 0.5)) * (0.5 + 0.5 * h11(ring + 7.0)), 1.0);&#10;}&#10;&#10;// @@ fxNebula&#10;vec4 fxNebula(vec2 m, float t, vec3 tint, float amt, float detail)   // coloured gas clouds, slowly turning and pulsing&#10;{&#10;    vec2 p = m * (2.0 + 3.0 * detail);&#10;    float n = fbm(p + vec2(fbm(p + t * 0.03), fbm(p + 3.0 - t * 0.02)) * 1.5);&#10;    vec3 c = mix(tint, tint.brg, smoothstep(0.3, 0.8, fbm(p * 1.7 + 5.0)));&#10;    float a = smoothstep(0.35, 0.85, n) * edgeFade(m, 0.2) * (0.85 + 0.15 * sin(t * 0.6));&#10;    return vec4(c * a * amt * 1.2, 1.0);&#10;}&#10;&#10;// @@ fxAurora&#10;vec4 fxAurora(vec2 m, float t, vec3 tint, float amt, float height)   // northern lights: curtains that wave, green below and purple above&#10;{&#10;    vec3 c = vec3(0.0);&#10;    for (int i = 0; i &lt; 3 + LZ; i++) {&#10;        float fi = float(i);&#10;        float y = 0.45 + 0.08 * fi + 0.12 * sin(m.x * 3.0 + t * 0.3 + fi * 2.0) + 0.05 * sin(m.x * 7.0 - t * 0.5 + fi);&#10;        float d = y - m.y;&#10;        float rays = 0.6 + 0.4 * vnoise(vec2(m.x * 60.0 + fi * 10.0, t * 0.5));&#10;        vec3 col = mix(mix(vec3(0.2, 1.0, 0.5), tint, 0.5), vec3(0.7, 0.2, 0.9), clamp(d * 3.0, 0.0, 1.0));&#10;        c += col * exp(-max(d, 0.0) / (0.08 + 0.3 * height)) * smoothstep(-0.005, 0.01, d) * rays * 0.6;&#10;    }&#10;    return vec4(c * amt * edgeFade(m, 0.15), 1.0);&#10;}&#10;&#10;// @@ fxPlanetBands&#10;vec4 fxPlanetBands(vec2 m, float t, vec3 tint, float strength, float bands)   // a planet in the board's circle, its cloud bands going round&#10;{&#10;    vec2 p = m * 2.0 - 1.0;&#10;    float r2 = dot(p, p);&#10;    if (r2 &gt; 1.0) return vec4(0.0);&#10;    float z = sqrt(1.0 - r2);&#10;    float lon = atan(p.x, z) / 3.1416 + t * 0.03;&#10;    float n = fbm(vec2(lon * 4.0 + t * 0.02, p.y * (4.0 + 10.0 * bands)));&#10;    float b = sin(p.y * (6.0 + 20.0 * bands) + n * 3.0) * 0.5 + 0.5;&#10;    vec3 c = mix(tint * 0.6, tint * 1.1, b) * (0.35 + 0.65 * z);&#10;    return vec4(c, strength * smoothstep(1.0, 0.97, r2));&#10;}&#10;&#10;// @@ fxGrain&#10;vec4 fxGrain(vec2 fc, float t, float amt, float size)   // film grain, new every frame&#10;{&#10;    float n = h21(floor(fc / (1.0 + 2.0 * size)) + floor(t * 24.0) * vec2(17.0, 31.0)) - 0.5;&#10;    return vec4(vec3(n &gt; 0.0 ? 1.0 : 0.0), abs(n) * amt * 0.5);&#10;}&#10;&#10;// @@ fxVignette&#10;vec4 fxVignette(vec2 m, float t, vec3 tint, float amt, float breathe)   // darker towards the edges, gently breathing&#10;{&#10;    float v = smoothstep(0.35, 0.75 - 0.05 * breathe * sin(t * 0.8), length(m - 0.5));&#10;    return vec4(tint * 0.1, v * amt);&#10;}&#10;&#10;// @@ fxOldFilm&#10;vec4 fxOldFilm(vec2 uv, vec2 m, float t, float amt, float scratches)   // old film: sepia, flicker, a jumping frame, scratches and dust&#10;{&#10;    float k = floor(t * 18.0);&#10;    vec3 c = picAt(uv + vec2(0.0, (h11(k) - 0.5) * 0.004 * amt));&#10;    c = mix(c, vec3(lum(c)) * vec3(1.07, 0.95, 0.78), amt) * (1.0 - amt * 0.12 * h11(k + 3.0));&#10;    for (int i = 0; i &lt; 3 + LZ; i++)&#10;        if (h11(k + float(i)) &lt; scratches)&#10;            c = mix(c, vec3(0.9), smoothstep(0.002, 0.0, abs(m.x - h11(k * 0.3 + float(i) * 7.0))) * 0.6);&#10;    c = mix(c, vec3(0.05), step(0.998, h21(floor(uv * vec2(400.0, 225.0)) + k)) * scratches);&#10;    return vec4(c * (1.0 - 0.4 * amt * smoothstep(0.4, 0.75, length(m - 0.5))), 1.0);&#10;}&#10;&#10;// ---------- v3.5: for a room with a fire, a candle and a view ----------&#10;// @@ fxFirelight&#10;vec4 fxFirelight(vec2 uv, vec2 m, float t, vec3 tint, float flick, float reach)   // the fire's warm light flickering over what is in the board, strongest at its bottom&#10;{&#10;    float f = 0.55 + 0.45 * (0.6 * vnoise1(t * 3.1) + 0.4 * vnoise1(t * 7.3 + 4.0));   // a fire's light, never quite still&#10;    f = mix(0.8, f, flick);&#10;    float fall = exp(-length((m - vec2(0.5, 1.0)) * vec2(1.2, 1.0)) * (4.0 - 3.4 * reach));&#10;    vec3 pic = picAt(uv);&#10;    float lit = fall * f * edgeFade(m, 0.2);&#10;    return vec4(pic * (1.0 + lit * 1.6 * tint) + tint * lit * 0.06, 1.0);&#10;}&#10;&#10;// @@ fxFlame&#10;vec4 fxFlame(vec2 uv, vec2 m, float t, float amt, float size)   // the flame in the picture itself licks and wavers: still at its foot, freest at its tip&#10;{&#10;    float k = 3.0 + 9.0 * (1.0 - size);&#10;    float up = 1.0 - m.y;   // 0 at the bottom of the board, 1 at its top&#10;    vec2 n = vec2(vnoise(vec2(m.x * k, m.y * k * 1.5 + t * 3.0)), vnoise(vec2(m.x * k + 7.0, m.y * k * 1.5 + t * 2.4))) - 0.5;&#10;    vec2 off = vec2(n.x * 1.4, -abs(n.y) * 1.2 - 0.25 * (0.5 + 0.5 * sin(t * 5.0 + m.x * 6.0))) * up * up * amt * 0.02;&#10;    float e = edgeFade(m, 0.12);&#10;    float bright = 1.0 + 0.12 * amt * (vnoise1(t * 6.0) - 0.5) * e;&#10;    return vec4(picAt(uv + vec2(off.x, -off.y) * e) * bright, 1.0);&#10;}&#10;&#10;// @@ fxEmbers&#10;vec4 fxEmbers(vec2 m, float t, vec3 tint, float amount, float height)   // glowing sparks rising from the bottom of the board, wavering, dying out&#10;{&#10;    vec3 c = vec3(0.0);&#10;    for (int L = 0; L &lt; 3 + LZ; L++) {&#10;        float fl = float(L);&#10;        float sc = 7.0 + fl * 5.0;&#10;        vec2 g = vec2(m.x * sc, (1.0 - m.y) * sc * 0.6 - t * (0.9 + 0.4 * fl));&#10;        vec2 id = floor(g), f = fract(g) - 0.5;&#10;        float h = h21(id + fl * 17.3);&#10;        if (h &gt; 0.1 + 0.6 * amount) continue;&#10;        vec2 o = (vec2(h21(id + 2.3), h21(id + 5.9)) - 0.5) * 0.6;&#10;        o.x += 0.25 * sin(t * (2.0 + 3.0 * h) + h * 30.0);&#10;        float life = 1.0 - smoothstep(0.1 + 0.85 * height, 0.15 + 0.9 * height, 1.0 - m.y + h * 0.15);   // they die out on the way up&#10;        float tw = 0.6 + 0.4 * sin(t * (8.0 + 6.0 * h) + h * 50.0);&#10;        float r = (0.07 + 0.05 * h) * (1.0 - fl * 0.2), dd = length(f - o);&#10;        c += tint * (smoothstep(r, r * 0.3, dd) * 1.6 + exp(-dd * dd * 40.0) * 0.5) * life * tw * (1.0 - fl * 0.25);&#10;    }&#10;    return vec4(c, 1.0);&#10;}&#10;&#10;// @@ fxBirds&#10;vec4 fxBirds(vec2 m, float t, vec3 tint, float many, float size)   // small birds crossing the board now and then, flapping&#10;{&#10;    float a = 0.0;&#10;    for (int i = 0; i &lt; 6 + LZ; i++) {&#10;        float fi = float(i);&#10;        if (fi &gt; 1.0 + many * 5.0) break;&#10;        float per = 9.0 + 6.0 * h11(fi * 3.7);   // a pass every so many seconds, each bird its own&#10;        float ph = t / per + h11(fi * 9.1);&#10;        float k = floor(ph), u = fract(ph);&#10;        float dir = h11(k + fi * 5.3) &lt; 0.5 ? 1.0 : -1.0;&#10;        float y = 0.15 + 0.6 * h11(k * 1.7 + fi) + 0.05 * sin(u * 9.0 + fi);&#10;        vec2 p = vec2(dir &gt; 0.0 ? -0.1 + u * 1.2 : 1.1 - u * 1.2, y);&#10;        float s = (0.02 + 0.05 * size) * (0.7 + 0.5 * h11(fi * 2.1));&#10;        vec2 d = (m - p) / s;&#10;        d.x *= dir;&#10;        float flap = sin(t * (9.0 + 3.0 * h11(fi)) + fi * 2.0);&#10;        float wing = abs(d.x) &lt; 1.0 ? abs(d.y + 0.15 - abs(d.x) * 0.55 * flap) : 9.0;   // a V that beats up and down&#10;        a = max(a, smoothstep(0.22, 0.06, wing) * smoothstep(1.0, 0.8, abs(d.x)));&#10;    }&#10;    return vec4(tint * 0.18, a);&#10;}&#10;&#10;// @@ fxDrift&#10;vec4 fxDrift(vec2 uv, vec2 m, float t, float dir, float dist)   // clouds drifting slowly sideways, seamlessly&#10;{&#10;    float L = 0.02 + 0.12 * dist;&#10;    float sp = (dir - 0.5) * 2.0;   // left .. right&#10;    float ph = vnoise(uv * 4.0) * 0.3;&#10;    float p1 = fract(t * 0.05 + ph), p2 = fract(t * 0.05 + ph + 0.5);&#10;    float w = 1.0 - abs(2.0 * p1 - 1.0);&#10;    float e = edgeFade(m, 0.12);&#10;    vec2 d = vec2(sp * L * e, 0.0);&#10;    return vec4(mix(picAt(uv - d * p2), picAt(uv - d * p1), w), 1.0);&#10;}&#10;&#10;// @@ fxSunGlow&#10;vec4 fxSunGlow(vec2 m, float t, vec3 tint, float size, float pulse)   // a soft glow round the sun in the middle of the board, slowly breathing&#10;{&#10;    vec2 d = (m - 0.5) * 2.0;&#10;    float r = length(d);&#10;    float b = 1.0 + pulse * (0.25 * sin(t * 0.9) + 0.12 * sin(t * 2.3 + 1.0));&#10;    float glow = exp(-r * r * (6.0 - 4.5 * size)) * 0.55 + exp(-r * (14.0 - 8.0 * size)) * 0.6;&#10;    float sh = 0.85 + 0.15 * vnoise(vec2(atan(d.y, d.x) * 3.0, t * 0.6));   // a faint shimmer in it&#10;    return vec4(tint * glow * b * sh * smoothstep(1.0, 0.6, r), 1.0);&#10;}&#10;&#96;;&#10;// the shared code, and the on-demand effects after it, each going into the shader only when an element uses it&#10;const BASE = SHARED.split('// ==== on demand')[0];&#10;const ONDEMAND = SHARED.split('// ==== on demand')[1].split('\n// @@ ').slice(1).map(b =&gt; ({ name: b.split('\n')[0].trim(), code: '\n' + b.slice(b.indexOf('\n') + 1) }));&#10;&#10;const W = 1920, H = 1080;          // the units the editor works in (stretched over the Scene)&#10;const ACC = '#8a3fff';&#10;const NAMESEL = '#c9a6ff';   // a selected name: the purple, lighter so it reads on any picture   // Darc Sector purple (a touch lighter than #741bff, to read on the dark panels)&#10;const COLORS = [['Warm white', '#ffd59a'], ['White', '#ffffff'], ['Orange', '#ff9a3c'], ['Red', '#ff3b3b'], ['Pink', '#ff4fd8'],&#10;                ['Purple', '#a46bff'], ['Blue', '#3b7bff'], ['Cyan', '#3cf0ff'], ['Green', '#4dff7a'], ['Yellow', '#ffe14d']];&#10;// Effects by number (kept with the project, so a number never changes meaning; 5 was Image 2, now gone and shown as Plasma)&#10;const FX = ['Plasma', 'Text', 'Glitch', 'Colour bars', 'Retro', 'Plasma', 'Window light', 'Neon edge', 'Custom', 'Rain', 'Ripple',&#10;            'Clouds', 'Smoke', 'Light box', 'Colour glow', 'Edge glow',&#10;            'Flow', 'Sway', 'Heat haze', 'Reflection', 'Breathe',   // v1.1: the picture itself moves&#10;            'Particles', 'Light rays', 'Fire', 'Steam', 'Lightning', 'Rain on glass', 'Water sparkle',   // v1.1: laid over it&#10;            'Cloud shadows', 'Dappled light', 'Day / night', 'Swell', 'Handheld', 'Colour fringe', 'Bloom',   // v1.5: the picture changes&#10;            'Light trails', 'TV glow', 'Fog', 'Rainbow', 'Shore waves', 'Caustics', 'Beacon', 'Frost', 'Window drops', 'Headlight sweep',&#10;            'Shooting stars', 'Star trails', 'Nebula', 'Northern lights', 'Planet bands', 'Film grain', 'Vignette', 'Old film',   // v1.5&#10;            'Firelight', 'Flame flicker', 'Embers', 'Birds', 'Cloud drift', 'Sun glow'];   // v3.5&#10;const FXFN = ['fxPlasma', null, 'fxGlitch', 'fxBars', 'fxRetro', 'fxPlasma', 'fxWindow', 'fxNeon', 'fxCustom', null, null,&#10;              'fxClouds', 'fxSmoke'].concat(Array(41).fill(null));&#10;const FXADD = [false, false, false, false, false, false, true, true, false, false, false, false, false, true, true, true,&#10;               false, false, false, false, false, true, true, true, false, true, false, true,&#10;               false, false, false, false, false, false, false, true, true, false, true, false, true, true, false, false, true,&#10;               true, true, true, true, false, false, false, false,&#10;               false, false, true, false, false, true];   // added light&#10;// the effects in groups, as the panel offers them&#10;const CATS = [['Signs', [0, 1, 2, 3, 4, 6, 7, 13, 36, 8]], ['Light', [14, 15, 22, 41, 44, 35, 53, 58]],&#10;              ['Weather', [9, 11, 12, 24, 37, 25, 26, 42, 43, 38]], ['Water', [10, 27, 39, 40]], ['Nature', [21, 23, 55, 54]],&#10;              ['Sky &amp; space', [45, 46, 47, 48, 49, 56, 57]], ['Moving picture', [16, 17, 18, 19, 20, 28, 29, 31, 54, 57]],&#10;              ['Film look', [30, 32, 33, 34, 50, 51, 52]]];&#10;const MOVES = fx =&gt; (fx &gt;= 16 &amp;&amp; fx &lt;= 20) || (fx &gt;= 28 &amp;&amp; fx &lt;= 34) || fx === 52 || fx === 53 || fx === 54 || fx === 57;   // the picture itself, changed: needs a background&#10;const NOBRIGHT = fx =&gt; MOVES(fx) || fx === 26 || fx === 42 || fx === 50 || fx === 51;   // these show the picture as it is: no Brightness&#10;const NOCOLOUR = fx =&gt; (MOVES(fx) &amp;&amp; ![19, 29, 30, 34, 53].includes(fx)) || fx === 50;   // and these have no colour of their own&#10;// what the two sliders of each v1.1 effect are called, with where they start&#10;const FXK = { 16: ['Direction', 'Length', 0, 0.5], 17: ['Wind', 'Wave size', 0.5, 0.5], 18: ['Strength', 'Size', 0.5, 0.5],&#10;              19: ['Ripples', 'Clearness', 0.4, 0.7], 20: ['Amount', null, 0.5, 0.5], 21: ['Amount', 'Size', 0.5, 0.4],&#10;              22: ['Light from', 'Rays', 0.3, 0.5], 23: ['Height', 'Detail', 0.6, 0.5], 24: ['Amount', 'Width', 0.6, 0.5],&#10;              25: ['Flash', 'Bolt', 0.7, 0.6], 26: ['Drops', 'Mist', 0.5, 0.3], 27: ['Amount', 'Size', 0.5, 0.4],&#10;              28: ['Darkness', 'Cloud size', 0.5, 0.5], 29: ['Strength', 'Patch size', 0.5, 0.5], 30: ['Night', 'Blue', 0.6, 0.5],&#10;              31: ['Rise', 'Tilt', 0.5, 0.3], 32: ['Shake', 'Zoom', 0.4, 0.3], 33: ['Strength', 'Wobble', 0.4, 0.3], 34: ['Glow', 'Size', 0.5, 0.5],&#10;              35: ['Traffic', 'Trail length', 0.6, 0.5], 36: ['Flicker', 'Colours', 0.5, 0.5], 37: ['Thickness', 'Height', 0.6, 0.5],&#10;              38: ['Strength', 'Width', 0.6, 0.4], 39: ['Reach', 'Foam', 0.6, 0.5], 40: ['Strength', 'Size', 0.6, 0.5],&#10;              41: ['Beam width', 'Reach', 0.3, 0.6], 42: ['Grow', 'Blur', 0.5, 0.5], 43: ['Drops', 'Size', 0.4, 0.4],&#10;              44: ['Width', 'How often', 0.5, 0.5], 45: ['How often', 'Trail length', 0.5, 0.5], 46: ['Stars', 'Arc length', 0.5, 0.4],&#10;              47: ['Strength', 'Detail', 0.6, 0.5], 48: ['Strength', 'Height', 0.7, 0.5], 49: ['Opacity', 'Bands', 0.6, 0.5],&#10;              50: ['Amount', 'Grain size', 0.4, 0.3], 51: ['Amount', 'Breathe', 0.6, 0.3], 52: ['Amount', 'Scratches', 0.7, 0.4],&#10;              53: ['Flicker', 'Reach', 0.6, 0.5], 54: ['Strength', 'Size', 0.6, 0.5], 55: ['Amount', 'Height', 0.5, 0.6],&#10;              56: ['How many', 'Size', 0.4, 0.4], 57: ['Direction', 'Distance', 0.75, 0.4], 58: ['Size', 'Pulse', 0.5, 0.5] };&#10;const FXSTYLES = { 17: ['Grass', 'Leaves', 'Flag'], 19: ['Water', 'Wet street'], 21: ['Snow', 'Dust', 'Fireflies', 'Leaves', 'Blossom', 'Hail', 'Sand', 'Stars'],&#10;                   23: ['Flames', 'Rocket'], 25: ['Strike', 'In the clouds'], 27: ['Glints', 'Moon path'], 35: ['Cars', 'One colour'],&#10;                   37: ['Ground fog', 'Mist bank'], 41: ['Lighthouse', 'Searchlight'] };&#10;const ADDSTYLES = { 21: [1, 2, 7] };   // the kinds of these that add light (the rest cover)&#10;const ESTYLES = ['Glow', 'Running', 'Sparkle'];   // how Edge glow lights the picture's edges   // as the panel shows them&#10;const PICS = ['Off', 'Surface', 'Bright parts', 'Dark parts'];&#10;const PICS_RIPPLE = ['On top', 'In the picture'];&#10;const MODES = ['On', 'Blink', 'Twinkle', 'Broken tube', 'Pulse', 'Strobe', 'Candle', 'Traffic light', 'Aircraft', 'Lens flare'];   // a board's light: the first 7&#10;&#10;const c = canvas(1);&#10;c.size(W, H, 'stretch');&#10;&#10;// The first time: nothing yet. &quot;+ Board&quot; and &quot;+ Light&quot; (or a double-click) add the first ones.&#10;if (!state.items) {&#10;    state.items = [];&#10;    state.next = 1;&#10;    state.edit = true;&#10;    state.sel = 0;&#10;    state.px = W - 656; state.py = 16;&#10;}&#10;if (state.lx === undefined) { state.lx = 16; state.ly = 16; state.lscroll = 0; }&#10;if (state.bg === undefined) { state.bg = ''; state.edges = false; }&#10;if (state.efilter === undefined) { state.efilter = 0; state.esens = 0.35; state.ewidth = 0.3; }&#10;const EFILTERS = ['All', 'Straight', 'Round'];&#10;if (state.snap === undefined) state.snap = true;&#10;if (state.dock === undefined) { state.dock = true; state.openP = true; state.openL = true; state.dscroll = 0; }&#10;if (state.zoom === undefined) { state.zoom = 1; state.panX = 0; state.panY = 0; }&#10;if (state.tlOpen === undefined) state.tlOpen = false;&#10;const TLH = 280;   // the timeline's height, under the picture&#10;&#10;// ---------- the timeline: what an element has, animated in a loop ----------&#10;// it.tl = { len (seconds of one loop), tracks: { key: { on, keys: [[time 0..1, value 0..1], ...] } } }, each track with keys at 0 and 1&#10;// holding the same value, so the loop has no jump. The Scene works it out on its own (straight lines between the keys), so it&#10;// plays in Perform too. key: transp, bright, k1, k2 (the effect's own sliders), size, power, x, y (a light), r, g, b.&#10;function tlOf(it) {&#10;    if (!it.tl) it.tl = { len: 4, tracks: {} };&#10;    if (it.tl.keys) it.tl = { len: it.tl.len, tracks: { transp: { on: it.tl.on, keys: it.tl.keys } } };   // from v1.2&#10;    return it.tl;&#10;}&#10;function tlTrack(it, key, now) {&#10;    const tl = tlOf(it);&#10;    if (!tl.tracks[key]) tl.tracks[key] = { on: false, keys: [[0, now], [0.5, now &gt; 0.5 ? 0 : 1], [1, now]] };&#10;    return tl.tracks[key];&#10;}&#10;const tlOn = (it, key) =&gt; !!(it.tl &amp;&amp; it.tl.tracks &amp;&amp; it.tl.tracks[key] &amp;&amp; it.tl.tracks[key].on);&#10;const tlLen = v =&gt; 0.5 + 29.5 * v * v;   // the slider (0..1) as seconds, finer at the short end&#10;const tlLenV = s =&gt; Math.sqrt((s - 0.5) / 29.5);&#10;function tlExpr(it, key) {   // the value now, in GLSL: the first key's value, plus each line's rise as time passes it&#10;    const k = it.tl.tracks[key].keys, u = 'fract(T / ' + f(it.tl.len) + ')';&#10;    let e = f(k[0][1]);&#10;    for (let i = 1; i &lt; k.length; i++) {&#10;        const dv = k[i][1] - k[i - 1][1], dt = Math.max(1e-4, k[i][0] - k[i - 1][0]);&#10;        if (Math.abs(dv) &gt; 1e-5)&#10;            e += ' + ' + f(dv) + ' * clamp((' + u + ' - ' + f(k[i - 1][0]) + ') / ' + f(dt) + ', 0.0, 1.0)';&#10;    }&#10;    return '(' + e + ')';&#10;}&#10;// ---------- the sound: a setting can follow the sound on the Scene's In A, or the DAW's beat ----------&#10;// it.au = { key: { src (0 off, 1.. AUSRC), amt (-1..1: how far it moves the setting, up or down) } }&#10;const AUSRC = ['Off', 'Level', 'Bass', 'Mid', 'High', 'Beat', 'Bar'];&#10;const AUGLSL = [null, 'auLift(auSpec(0.0, 0.5), P31)', 'auLift(auSpec(0.0, 0.03), P31)', 'auLift(auSpec(0.03, 0.25) * 1.15, P31)',&#10;                'auLift(auSpec(0.25, 0.8) * 1.5, P31)', '(P29 &gt; 0.5 ? exp(-fract(P28) * 6.0) : 0.0)', '(P29 &gt; 0.5 ? P30 : 0.0)'];&#10;const auOn = (it, key) =&gt; !!(it.au &amp;&amp; it.au[key] &amp;&amp; it.au[key].src &gt; 0);&#10;const anOn = (it, key) =&gt; tlOn(it, key) || auOn(it, key);   // moved by the timeline or the sound&#10;const AN = (it, key, still) =&gt; {   // animated, following the sound, or as it is&#10;    const e = tlOn(it, key) ? tlExpr(it, key) : still;&#10;    return auOn(it, key) ? 'clamp(' + e + ' + ' + f(it.au[key].amt) + ' * AU' + it.au[key].src + ', 0.0, 1.0)' : e;&#10;};&#10;if (state.auOpen === undefined) state.auOpen = false;&#10;if (state.ausens === undefined) state.ausens = 0.5;&#10;const AUH = 330;   // the Audio panel's height, under the picture&#10;function tlAt(it, key, still, t) {   // the same in the Script, at t seconds: for the pictures, which the Script draws&#10;    if (!tlOn(it, key))&#10;        return still;&#10;    const k = it.tl.tracks[key].keys, u = ((t / it.tl.len) % 1 + 1) % 1;&#10;    for (let i = 1; i &lt; k.length; i++)&#10;        if (u &lt;= k[i][0])&#10;            return k[i - 1][1] + (k[i][1] - k[i - 1][1]) * Math.max(0, Math.min(1, (u - k[i - 1][0]) / Math.max(1e-4, k[i][0] - k[i - 1][0])));&#10;    return k[k.length - 1][1];&#10;}&#10;function boardK(it) {   // what the effect's own two sliders are called, with where they start&#10;    if (FXK[it.fx]) return FXK[it.fx];&#10;    return { 10: ['Circle size', 'Strength', 0.6, 0.6], 13: ['Glow size', null, 0.6, 0.6], 14: ['Tolerance', 'Softness', 0.6, 0.6],&#10;             15: ['Sensitivity', 'Glow width', 0.6, 0.6] }[it.fx] || [null, null, 0.6, 0.6];&#10;}&#10;function tlProps(it) {   // what of this element the timeline can animate: [key, name, value now 0..1, how to show a value]&#10;    const pc = v =&gt; Math.round(v * 100) + '%', c255 = v =&gt; String(Math.round(v * 255));&#10;    const [r, g, b] = hexRGB(hexOf(it));&#10;    const L = [['transp', 'Transparency', it.transp || 0, pc]];&#10;    if (it.type === 'mask')&#10;        return L;&#10;    if (it.type === 'board') {&#10;        if (!NOBRIGHT(it.fx)) L.push(['bright', it.fx === 9 ? 'Amount' : 'Brightness', it.bright, pc]);&#10;        const [n1, n2, d1, d2] = boardK(it);&#10;        if (n1) L.push(['k1', n1, it.rsize === undefined ? d1 : it.rsize, it.fx === 16 ? v =&gt; Math.round(v * 360) + ' deg' : pc]);&#10;        if (n2) L.push(['k2', n2, it.rstr === undefined ? d2 : it.rstr, pc]);&#10;        if (it.fx !== 13) L.push(['fade', 'Edge fade', it.fade || 0, pc]);&#10;    } else if (it.type === 'image') {&#10;        L.push(['x', 'Across', it.x, pc], ['y', 'Down', it.y, pc], ['scale', 'Size', it.scale, v =&gt; Math.round(v * 200) + '%'],&#10;               ['rot', 'Turn', it.rot, v =&gt; Math.round((v - 0.5) * 360) + ' deg']);&#10;        return L;&#10;    } else&#10;        L.push(['size', 'Size', it.size, pc], ['power', 'Strength', it.power, pc], ['x', 'Across', it.x, pc], ['y', 'Down', it.y, pc]);&#10;    if (it.type !== 'board' || !NOCOLOUR(it.fx))&#10;        L.push(['r', 'Red', r, c255], ['g', 'Green', g, c255], ['b', 'Blue', b, c255]);&#10;    return L;&#10;}&#10;&#10;// ---------- the view ----------&#10;// In Edit mode the picture is drawn smaller, in the free part of the canvas between the toolbar and the dock (zoomed and&#10;// moved as you like); the Scene does the same with P25, P26 (its top left, 0..1 of the canvas) and P27 (its scale).&#10;const view = { x: 0, y: 0, s: 1 };&#10;function fitView() {&#10;    if (!state.edit) { view.x = 0; view.y = 0; view.s = 1; return; }&#10;    const left = TW + 20, right = state.dock ? DW + 30 : 34, top = 20, bottom = state.tlOpen ? TLH + 16 : state.auOpen ? AUH + 16 : 20;&#10;    const aw = W - left - right, ah = H - top - bottom;&#10;    view.s = Math.min(aw / W, ah / H) * state.zoom;&#10;    view.x = left + aw / 2 - W * view.s / 2 + state.panX;&#10;    view.y = top + ah / 2 - H * view.s / 2 + state.panY;&#10;}&#10;const X = u =&gt; view.x + u * W * view.s, Y = v =&gt; view.y + v * H * view.s;   // picture (0..1) -&gt; canvas&#10;const U = x =&gt; (x - view.x) / (W * view.s), V = y =&gt; (y - view.y) / (H * view.s);   // canvas -&gt; picture&#10;const DU = d =&gt; d / (W * view.s), DV = d =&gt; d / (H * view.s);   // a drag on the canvas, in the picture&#10;// A P only takes 0 to 1, so the view is packed into that: P25 = 0.5 + x / 20, P26 = 0.5 + y / 20, P27 = scale / 10&#10;// (P27 at 0: no view, the whole Scene, as in Perform).&#10;function sendView() {&#10;    out(1, { p: state.edit ? { P25: 0.5 + view.x / W / 20, P26: 0.5 + view.y / H / 20, P27: view.s / 10 } : { P25: 0.5, P26: 0.5, P27: 0 } });&#10;}&#10;function zoomAt(x, y, k) {   // zoom by k, keeping the spot under the mouse where it is&#10;    const u = U(x), v = V(y);&#10;    state.zoom = Math.max(1, Math.min(8, state.zoom * k));&#10;    if (state.zoom === 1) { state.panX = 0; state.panY = 0; }&#10;    fitView();&#10;    if (state.zoom &gt; 1) { state.panX += x - X(u); state.panY += y - Y(v); fitView(); }&#10;    sendView(); placeAll();&#10;}&#10;&#10;// ---------- snapping ----------&#10;// the x and y lines a dragged point can snap to (in 0..1): the other elements' corners and middles, the Scene's sides and middle&#10;function snapLines(skipId) {&#10;    const xs = [0, 0.5, 1], ys = [0, 0.5, 1];&#10;    for (const t of state.items) {&#10;        if (t.id === skipId || t.hidden)&#10;            continue;&#10;        if (t.pts)&#10;            for (const p of t.pts) { xs.push(p[0]); ys.push(p[1]); }&#10;        else { xs.push(t.x); ys.push(t.y); }&#10;    }&#10;    return [xs, ys];&#10;}&#10;// how far to move so the nearest point of pts lands on a line, per axis (0 when nothing is within 12 pixels)&#10;function snapDelta(pts, skipId, alt) {&#10;    if (!state.snap || alt)&#10;        return [0, 0];&#10;    const [xs, ys] = snapLines(skipId);&#10;    let bx = DU(12), by = DV(12), dx = 0, dy = 0;&#10;    for (const p of pts) {&#10;        for (const x of xs) if (Math.abs(x - p[0]) &lt; bx) { bx = Math.abs(x - p[0]); dx = x - p[0]; }&#10;        for (const y of ys) if (Math.abs(y - p[1]) &lt; by) { by = Math.abs(y - p[1]); dy = y - p[1]; }&#10;    }&#10;    return [dx, dy];&#10;}&#10;let dragFrom = null;   // the element as it was when the press began, so a drag is worked out from there (and snaps cleanly)&#10;const keep = it =&gt; JSON.parse(JSON.stringify({ pts: it.pts, x: it.x, y: it.y }));&#10;if (!state.palette) state.palette = [];&#10;if (state.cmode === undefined) state.cmode = 0;   // 0 RGB, 1 HSV&#10;let hexTyping = null;   // the code being typed on the keys, or null&#10;for (const it of state.items) if (it.fx === 5) it.fx = 0;   // Image 2 is gone&#10;state.items = state.items.filter(it =&gt; !it.strip);   // so are the filmstrips of v2.0 to v2.5&#10;delete state.strips; delete state.strip2;&#10;const hexOf = it =&gt; it.hex || COLORS[it.color || 0][1];&#10;&#10;// ---------- the shader ----------&#10;// mainImage: in Edit mode the picture goes where the editor shows it (P25, P26 its top left, P27 its scale, packed as&#10;// sendView says) on a grey ground; with P27 at 0 it is the whole Scene, as in Perform.&#10;const VIEW_MAIN = 'void mainImage(out vec4 o, in vec2 fc)\n{\n' +&#10;    '    if (P27 &lt; 0.0001) { sceneImage(o, fc); return; }\n' +&#10;    '    vec2 R = iResolution.xy;\n' +&#10;    '    vec2 p = (vec2(fc.x / R.x, 1.0 - fc.y / R.y) - (vec2(P25, P26) - 0.5) * 20.0) / (P27 * 10.0);   // where in the picture, from its top left\n' +&#10;    '    if (p.x &lt; 0.0 || p.y &lt; 0.0 || p.x &gt; 1.0 || p.y &gt; 1.0) {\n' +&#10;    '        vec2 k = floor(fc / (12.0 * R.y / 1080.0));\n' +&#10;    '        o = vec4(vec3(0.05, 0.045, 0.075) + 0.012 * mod(k.x + k.y, 2.0), 1.0);   // the ground round it\n' +&#10;    '        return;\n    }\n' +&#10;    '    sceneImage(o, vec2(p.x, 1.0 - p.y) * R);\n' +&#10;    '    if (o.a &lt; 1.0) {   // see-through parts show a chequer, as in Photoshop\n' +&#10;    '        vec2 k = floor(p * vec2(1920.0, 1080.0) / 16.0);\n' +&#10;    '        vec3 g = vec3(0.15, 0.14, 0.19) + 0.05 * mod(k.x + k.y, 2.0);\n' +&#10;    '        o = vec4(mix(g, o.rgb, o.a), 1.0);\n    }\n}\n';&#10;const f = v =&gt; (Math.round(v * 100000) / 100000).toFixed(5);&#10;const v2 = (x, y) =&gt; 'vec2(' + f(x) + ', ' + f(y) + ')';&#10;function rgb(hex) {&#10;    const n = parseInt(hex.slice(1), 16);&#10;    return 'vec3(' + f((n &gt;&gt; 16 &amp; 255) / 255) + ', ' + f((n &gt;&gt; 8 &amp; 255) / 255) + ', ' + f((n &amp; 255) / 255) + ')';&#10;}&#10;const spd = s =&gt; '(0.05 + 4.0 * ' + s + ' * ' + s + ')';&#10;&#10;const SYMP = { 9: 'eA.z', 10: 'eA.w', 11: 'eA.y', 12: 'eB.x', 13: 'eB.y', 23: 'eB.z' };   // P numbers -&gt; the loop's arrays&#10;const SYML = { 1: 'eQ0.x', 2: 'eQ0.y', 3: 'eB.x', 4: 'eA.z', 5: 'eA.w', 6: 'eA.y' };   // the same for a light&#10;// a board or a light that can go in a shared loop: 4 points, nothing on the timeline, not selected, no mask over it&#10;const loopable = (it, masks) =&gt; (it.type === 'light' || it.type === 'board' &amp;&amp; it.pts.length === 4 &amp;&amp; it.fx !== 1) &amp;&amp; it.id !== state.sel &amp;&amp;&#10;    !(it.tl &amp;&amp; it.tl.tracks &amp;&amp; Object.keys(it.tl.tracks).some(k =&gt; tlOn(it, k))) &amp;&amp; !(it.au &amp;&amp; Object.keys(it.au).some(k =&gt; auOn(it, k))) &amp;&amp; !masks.some(m =&gt; m.all !== false || (m.only || []).includes(it.id));&#10;// several boards in a row as one loop: each kind of effect is in the shader once, however many boards use it, so a&#10;// scene with many boards compiles much faster. Their numbers are in arrays; the kind (the code it needs) picks the branch.&#10;function loopCode(run) {&#10;    const n = run.length, kinds = [], ek = [];&#10;    for (const it of run) {&#10;        const code = itemCode(it, false, true);&#10;        let k = kinds.indexOf(code);&#10;        if (k &lt; 0) { k = kinds.length; kinds.push(code); }&#10;        ek.push(k);&#10;    }&#10;    const arr = (type, list) =&gt; 'const ' + type + ' E' + '_' + '[' + list.length + '] = ' + type + '[' + list.length + '](' + list.join(', ') + ');';&#10;    const nm = (decl, name) =&gt; decl.replace(' E_[', ' ' + name + '[');&#10;    const q = run.flatMap(it =&gt; it.type === 'light' ? [v2(it.x, it.y), 'vec2(0.0)', 'vec2(0.0)', 'vec2(0.0)'] : boardQuad(it).map(p =&gt; v2(p[0], p[1])));&#10;    const k1 = it =&gt; it.rsize === undefined ? 0.6 : it.rsize, k2 = it =&gt; it.rstr === undefined ? 0.6 : it.rstr;&#10;    return '    {   // ' + n + ' elements in one loop\n' +&#10;        '        ' + nm(arr('vec2', q), 'EQ') + '\n' +&#10;        '        ' + nm(arr('vec3', run.map(it =&gt; rgb(hexOf(it)))), 'ET') + '\n' +&#10;        '        ' + nm(arr('vec4', run.map(it =&gt; 'vec4(' + [it.seed, it.transp || 0, it.speed, it.type === 'light' ? it.power : it.bright].map(f).join(', ') + ')')), 'EA') + '\n' +&#10;        '        ' + nm(arr('vec4', run.map(it =&gt; 'vec4(' + (it.type === 'light' ? [it.size, 0, 0, 0] : [k1(it), k2(it), it.fade || 0, 0]).map(f).join(', ') + ')')), 'EB') + '\n' +&#10;        '        ' + nm(arr('int', ek.map(String)), 'EK') + '\n' +&#10;        '        for (int ei = 0; ei &lt; ' + n + ' + LZ; ei++) {\n' +&#10;        '            vec2 eQ0 = EQ[ei * 4], eQ1 = EQ[ei * 4 + 1], eQ2 = EQ[ei * 4 + 2], eQ3 = EQ[ei * 4 + 3];\n' +&#10;        '            vec3 eT = ET[ei];\n            vec4 eA = EA[ei], eB = EB[ei];\n' +&#10;        '            int ek = EK[ei];\n' +&#10;        kinds.map((c, k) =&gt; '            ' + (k ? 'else ' : '') + (k &lt; kinds.length - 1 ? 'if (ek == ' + k + ') ' : '') + '{\n' + c + '            }\n').join('') +&#10;        '        }\n    }\n';&#10;}&#10;&#10;function itemCode(it, live, sym) {   // sym: a board in a shared loop, its numbers read from the loop's arrays (eQ0..3, eT, eA, eB)&#10;    if (it.type === 'image' || it.type === 'mask')   // the Script draws it / a mask is worked in by buildCode&#10;        return '';&#10;    // live: the selected element reads P1.. so dragging it needs no new shader&#10;    const SY = it.type === 'light' ? SYML : SYMP, P = (k, v) =&gt; sym &amp;&amp; SY[k] ? SY[k] : live ? 'P' + k : f(v);&#10;    const c3 = hexRGB(hexOf(it));&#10;    const tint = anOn(it, 'r') || anOn(it, 'g') || anOn(it, 'b') ?&#10;        'vec3(' + ['r', 'g', 'b'].map((k, i) =&gt; AN(it, k, live ? 'P' + (18 + i) : f(c3[i]))).join(', ') + ')' :&#10;        sym ? 'eT' : live ? 'vec3(P18, P19, P20)' : rgb(hexOf(it));&#10;    const seed = sym ? 'eA.x' : f(it.seed);&#10;    const vis = '(1.0 - ' + AN(it, 'transp', P(it.type === 'board' ? 11 : 6, it.transp || 0)) + ')';   // Transparency: 0 solid, 1 gone&#10;    if (it.type === 'board') {&#10;        const quad = boardQuad(it);&#10;        const pt = (i) =&gt; sym ? 'eQ' + i : live ? 'vec2(P' + (2 * i + 1) + ', P' + (2 * i + 2) + ')' : v2(quad[i][0], quad[i][1]);&#10;        const k1 = AN(it, 'k1', P(12, it.rsize === undefined ? 0.6 : it.rsize)), k2 = AN(it, 'k2', P(13, it.rstr === undefined ? 0.6 : it.rstr));&#10;        const amp = 'lampAmp(' + (it.mode || 0) + ', t, ' + seed + ')';&#10;        const pic = state.bg ? (it.pic || 0) : 0;   // how it follows the picture (only with a background)&#10;        let fx;&#10;        if (it.fx === 1) {&#10;            const line = Math.min(it.text, TEXTS.length - 1);&#10;            const len = TEXTS[line].length * 0.62 * 150.0 + 60.0;&#10;            fx = 'fxText(m, t, ' + tint + ', labelText(vec2(m.x * 1000.0, (1.0 - m.y) * 250.0), ' + line + ', vec2(1000.0 - mod(t * 220.0, ' + f(1000 + len) + '), 70.0), 150.0, 0.0))';&#10;        } else if (it.fx === 9)   // rain falls straight down the screen, whatever the board's shape&#10;            fx = 'fxRain(fc / R.y, t, ' + tint + ')';&#10;        else if (it.fx === 10)    // ripples in water: rings round the middle of the board, seen in its perspective&#10;            fx = 'fxRipple(m, t, ' + tint + ', ' + k1 + ', ' + k2 + (pic === 1 ? ' * 0.35' : '') + ')';&#10;        else if (it.fx === 13)    // a lit rectangle with a glow round it, blinking as a light does&#10;            fx = 'fxLightBox(m, cov, ' + amp + ', ' + tint + ', ' + k1 + ')';&#10;        else if (it.fx === 14)    // one colour of the picture (as it is at the picked spot) lights up&#10;            fx = state.bg ? 'fxKeyGlow(tex0(uv).rgb, keyColour(' + v2(it.kx === undefined ? 0.5 : it.kx, 1 - (it.ky === undefined ? 0.5 : it.ky)) + '), ' + k1 + ', ' + k2 + ', ' + amp + ', ' + tint + ')' : 'vec4(0.0)';&#10;        else if (it.fx === 15)    // the picture's own edges inside the board light up&#10;            fx = state.bg ? 'fxEdgeGlow(uv, t, ' + amp + ', ' + tint + ', ' + k1 + ', ' + k2 + ', ' + (it.estyle || 0) + ')' : 'vec4(0.0)';&#10;        else if (it.fx &gt;= 16) {&#10;            const st = it.style || 0, bg = c =&gt; state.bg ? c : 'vec4(0.0)';&#10;            const full = it.pts.every((p, i) =&gt; Math.abs(p[0] - [0, 1, 1, 0][i]) &lt; 0.002 &amp;&amp; Math.abs(p[1] - [0, 0, 1, 1][i]) &lt; 0.002);&#10;            fx = { 16: bg('fxFlow(uv, m, t, ' + k1 + ', ' + k2 + ')'),&#10;                   17: bg('fxSway(uv, m, t, ' + k1 + ', ' + k2 + ', ' + st + ')'),&#10;                   18: bg('fxHaze(uv, m, t, ' + k1 + ', ' + k2 + ')'),&#10;                   19: bg('fxReflect(q, m, t, ' + pt(0) + ', ' + pt(1) + ', ' + k1 + ', ' + k2 + ', ' + tint + ', ' + st + ')'),&#10;                   20: bg('fxBreathe(uv, m, t, (' + pt(0) + ' + ' + pt(1) + ' + ' + pt(2) + ' + ' + pt(3) + ') * 0.25, ' + k1 + ', ' + (full ? '0.0' : '1.0') + ')'),&#10;                   21: 'fxParticles(fc / R.y, t, ' + tint + ', ' + k1 + ', ' + k2 + ', ' + st + ')',&#10;                   22: 'fxRays(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   23: 'fxFire(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ', ' + st + ')',&#10;                   24: 'fxSteam(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   25: 'fxLightning(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ', ' + (state.bg ? 'tex0(uv).rgb' : 'vec3(0.0)') + ', ' + st + ')',&#10;                   26: 'fxGlass(fc / R.y, uv, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   27: 'fxSparkle(fc, m, t, ' + tint + ', ' + k1 + ', ' + k2 + ', S, ' + (state.bg ? 'lum(tex0(uv).rgb)' : '1.0') + ', ' + st + ')',&#10;                   28: bg('fxCloudShadow(uv, m, t, ' + k1 + ', ' + k2 + ')'),&#10;                   29: bg('fxDappled(uv, m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')'),&#10;                   30: bg('fxDayNight(uv, ' + k1 + ', ' + k2 + ', ' + tint + ')'),&#10;                   31: bg('fxSwell(uv, m, t, ' + k1 + ', ' + k2 + ')'),&#10;                   32: bg('fxHandheld(uv, t, ' + k1 + ', ' + k2 + ')'),&#10;                   33: bg('fxFringe(uv, t, ' + k1 + ', ' + k2 + ')'),&#10;                   34: bg('fxBloom(uv, t, ' + tint + ', ' + k1 + ', ' + k2 + ')'),&#10;                   35: 'fxLightTrails(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ', ' + st + ')',&#10;                   36: 'fxTV(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   37: 'fxFog(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ', ' + st + ')',&#10;                   38: 'fxRainbow(m, t, ' + k1 + ', ' + k2 + ')',&#10;                   39: 'fxShore(uv, m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   40: 'fxCaustics(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   41: 'fxBeacon(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ', ' + st + ')',&#10;                   42: 'fxFrost(uv, m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   43: 'fxDrips(fc / R.y, uv, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   44: 'fxSweep(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   45: 'fxShooting(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   46: 'fxStarTrails(q, (' + pt(0) + ' + ' + pt(1) + ' + ' + pt(2) + ' + ' + pt(3) + ') * 0.25, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   47: 'fxNebula(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   48: 'fxAurora(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   49: 'fxPlanetBands(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   50: 'fxGrain(fc, t, ' + k1 + ', ' + k2 + ')',&#10;                   51: 'fxVignette(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   52: bg('fxOldFilm(uv, m, t, ' + k1 + ', ' + k2 + ')'),&#10;                   53: bg('fxFirelight(uv, m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')'),&#10;                   54: bg('fxFlame(uv, m, t, ' + k1 + ', ' + k2 + ')'),&#10;                   55: 'fxEmbers(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   56: 'fxBirds(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')',&#10;                   57: bg('fxDrift(uv, m, t, ' + k1 + ', ' + k2 + ')'),&#10;                   58: 'fxSunGlow(m, t, ' + tint + ', ' + k1 + ', ' + k2 + ')' }[it.fx];&#10;        } else&#10;            fx = FXFN[it.fx] + '(m, t, ' + tint + ')';&#10;        // a ripple In the picture bends the picture under it, out from the middle of the board&#10;        const refr = it.fx === 10 &amp;&amp; pic === 1 ?&#10;            '            {   vec2 ctr = (' + pt(0) + ' + ' + pt(1) + ' + ' + pt(2) + ' + ' + pt(3) + ') * 0.25;\n' +&#10;            '                vec2 dir = normalize(q - ctr + vec2(1e-5));\n' +&#10;            '                vec2 d = dir * rippleV(m, t, ' + k1 + ') * 0.012 * ' + k2 + ';\n' +&#10;            '                C = mix(C, tex0(vec2(uv.x + d.x, uv.y - d.y)).rgb, cov * ' + vis + ');\n' +&#10;            '            }\n' : '';&#10;        // how it follows the picture: Surface (with the moving picture: stronger where it is bright), Bright parts, Dark parts&#10;        const react = !pic || [10, 14, 15].includes(it.fx) ? '' :&#10;            MOVES(it.fx) &amp;&amp; pic === 1 ? '            s.a *= clamp(0.2 + 1.2 * lum(tex0(uv).rgb), 0.0, 1.0);\n' :&#10;            '            picReact(s, ' + pic + ', tex0(uv).rgb);\n';&#10;        const glowOut = it.fx === 13;   // a light box shines past its edges&#10;        // Edge fade (P23 while selected): softly gone towards the edges, over so much of the way to the middle&#10;        let fadeCode = '';&#10;        if (!glowOut &amp;&amp; (live || anOn(it, 'fade') || (it.fade || 0) &gt; 0.001)) {&#10;            const q4 = boardQuad(it), hs = Math.min(...[0, 1, 2, 3].map(i =&gt; Math.hypot((q4[(i + 1) % 4][0] - q4[i][0]) * W, (q4[(i + 1) % 4][1] - q4[i][1]) * H))) / H / 2;&#10;            const e = it.pts.length === 4 ? '2.0 * min(min(m.x, 1.0 - m.x), min(m.y, 1.0 - m.y))' : '-sd / ' + f(Math.max(1e-4, hs));&#10;            const fd = AN(it, 'fade', P(23, it.fade || 0));&#10;            fadeCode = '            { float fd = ' + fd + '; if (fd &gt; 0.001) s.a *= smoothstep(0.0, fd, ' + e + '); }   // Edge fade\n';&#10;        }&#10;        const mixl = glowOut ? 'glowAdd(C, A, s.rgb * s.a);' :&#10;                     FXADD[it.fx] &amp;&amp; (!ADDSTYLES[it.fx] || ADDSTYLES[it.fx].includes(it.style || 0)) ? 'glowAdd(C, A, s.rgb * s.a * cov);' : 'C = mix(C, s.rgb, s.a * cov); A = mix(A, 1.0, s.a * cov);';&#10;        return '    {   // ' + FX[it.fx] + '\n' +&#10;               '        vec2 m = quadUV(q, ' + pt(0) + ', ' + pt(1) + ', ' + pt(2) + ', ' + pt(3) + ');\n' +&#10;               (it.pts.length === 4 ? '        float cov = m.x &gt; -5.0 ? quadCov(q, ' + pt(0) + ', ' + pt(1) + ', ' + pt(2) + ', ' + pt(3) + ', R) : 0.0;\n' :&#10;                '        float sd = m.x &gt; -5.0 ? shape' + it.id + '(qa) : 1.0;   // its own shape, worked out once\n' +&#10;                '        float cov = clamp(0.5 - sd * R.y, 0.0, 1.0);\n') +&#10;               '        if (' + (glowOut ? 'm.x &gt; -5.0' : 'cov &gt; 0.0') + ') {\n' +&#10;               '            float t = T * ' + spd(P(9, it.speed)) + ' + ' + seed + ' * 10.0;\n' +&#10;               '            vec4 s = ' + fx + ';\n' +&#10;               (NOBRIGHT(it.fx) ? '' : '            ' + (it.fx === 9 ? 's.a' : 's.rgb') + ' *= 2.0 * ' + AN(it, 'bright', P(10, it.bright)) + ';\n') +   // rain: Amount sets how much&#10;               react + refr +&#10;               '            s.a *= ' + vis + ';\n' + fadeCode +&#10;               '            ' + mixl + '\n' +&#10;               '        }\n' +&#10;               '    }\n';&#10;    }&#10;    const sz = AN(it, 'size', P(3, it.size)), lx = AN(it, 'x', P(1, it.x)), ly = AN(it, 'y', P(2, it.y)), pw = AN(it, 'power', P(5, it.power));&#10;    const lt = 'T * ' + spd(P(4, it.speed));&#10;    const lc = it.mode === 7 ? 'trafficCol(' + lt + ' + ' + seed + ' * 8.0)' : tint;   // a traffic light picks its own colour&#10;    return '    glowAdd(C, A, lamp(fc, vec2(' + lx + ', 1.0 - ' + ly + ') * R, (6.0 + 250.0 * ' + sz + ' * ' + sz + ') * S, ' +&#10;           '3.0 * ' + pw + ' * ' + vis + ' * lampAmp(' + it.mode + ', ' + lt + ', ' + seed + '), ' + lc + ', ' + (it.mode === 2 ? '1.0' : '0.0') + '));   // ' + MODES[it.mode] + '\n' +&#10;           (it.mode === 9 ? '    glowAdd(C, A, fxFlare(q, vec2(' + lx + ', ' + ly + '), T, ' + tint + ', ' + pw + ' * ' + vis + '));\n' : '');&#10;}&#10;&#10;function buildCode() {&#10;    let s = '// Made by the Cinemnode Script: change the Script, not this.\n' + BASE + '@NEEDED@\n' + CUSTOM + '\n' +&#10;            'float AU1, AU2, AU3, AU4, AU5, AU6;   // the sound and the beat (Audio panel), worked out at the top of sceneImage\n' +&#10;            'void sceneImage(out vec4 o, in vec2 fc)\n{\n' +&#10;            '    vec2 R = iResolution.xy;\n    vec2 uv = fc / R;\n' +&#10;            (state.bg ? '    vec3 PIC = tex0(uv).rgb;   // the background, read once for every effect that looks at it\n    vec3 C = PIC;\n    float A = 1.0;\n' :&#10;            '    vec3 C = vec3(0.0);   // the colour, times how much covers\n    float A = 0.0;        // how much covers: where it is 0 the picture under the Scene shows\n') +&#10;            '    vec2 q = vec2(uv.x, 1.0 - uv.y);   // as the editor counts: from the top left\n' +&#10;            '    float S = R.y / 1080.0, T = iTime;\n' +&#10;            '    vec2 qa = q * vec2(R.x / R.y, 1.0);   // q with square pixels, for the masks\n';&#10;    let body = '';&#10;    const masks = state.items.filter(m =&gt; m.type === 'mask' &amp;&amp; !m.hidden &amp;&amp; m.pts.length &gt; 2);&#10;    let run = [];&#10;    const flush = () =&gt; { if (run.length &gt; 1) body += loopCode(run); else if (run.length) body += itemCode(run[0], false); run = []; };&#10;    for (const it of state.items)&#10;        if (!it.hidden &amp;&amp; loopable(it, masks))&#10;            run.push(it);&#10;        else if (!it.hidden) {&#10;            flush();&#10;            const code = itemCode(it, it.id === state.sel);&#10;            const on = code ? masks.filter(m =&gt; m.all !== false || (m.only || []).includes(it.id)) : [];&#10;            body += !on.length ? code :   // what the element added is taken back again where its masks are: worked out only where it drew, each mask once a pixel&#10;                '    {\n    vec3 C0 = C; float A0 = A;\n' + code +&#10;                '    if (C != C0 || A != A0) {\n' + on.map(m =&gt; '        if (mk' + m.id + ' &lt; 0.0) mk' + m.id + ' = mask' + m.id + '(qa);\n').join('') +&#10;                '        float mk = ' + on.map(m =&gt; 'mk' + m.id).reduce((a, b) =&gt; 'max(' + a + ', ' + b + ')') + ';\n' +&#10;                '        C = mix(C, C0, mk); A = mix(A, A0, mk);\n    }\n    }\n';&#10;        }&#10;    flush();&#10;    const shapes = state.items.filter(t =&gt; t.type === 'board' &amp;&amp; !t.hidden &amp;&amp; t.pts.length !== 4);&#10;    if (masks.length || shapes.length)&#10;        s = s.replace('void sceneImage(', masks.map(maskCode).join('') + shapes.map(t =&gt; polyFn('shape' + t.id, t.pts) + '    return s * sqrt(d);   // &lt; 0 inside, in heights\n}\n').join('') + 'void sceneImage(');&#10;    for (let k = 1; k &lt; AUSRC.length; k++)   // the sound, worked out once a pixel, only what is used&#10;        if (new RegExp('\\bAU' + k + '\\b').test(body + masks.map(maskCode).join('')))&#10;            s += '    AU' + k + ' = ' + AUGLSL[k] + ';   // ' + AUSRC[k] + '\n';&#10;    s += masks.map(m =&gt; '    float mk' + m.id + ' = -1.0;   // mask ' + m.id + ', not worked out yet\n').join('') + body.split('tex0(uv).rgb').join(state.bg ? 'PIC' : 'tex0(uv).rgb');&#10;    if (state.bg)   // edit aids, switched by P14 (Edges) and P17 (the magnifier at P15, P16) with no new shader&#10;        s += '    if (P14 &gt; 0.5) edgeView(C, uv, int(P14 + 0.5) - 1, P21, P22);\n' +&#10;             '    if (P17 &gt; 0.5) magnifier(C, fc, vec2(P15, 1.0 - P16) * R);\n';&#10;    const needed = ONDEMAND.filter(b =&gt; body.includes(b.name + '(')).map(b =&gt; b.code).join('');   // only the effects in use&#10;    return s.replace('@NEEDED@', needed) + '    o = A &gt; 0.0001 ? vec4(min(C / A, vec3(1.0)), A) : vec4(0.0);\n}\n\n' + VIEW_MAIN;&#10;}&#10;&#10;// a mask in GLSL: how much it holds back at p (q with square pixels), 0 to 1, from how far p is inside its shape&#10;function polyFn(name, P) {   // how far p is from a shape's edge (its body: s * sqrt(d), negative inside)&#10;    const k = W / H, n = P.length;&#10;    const pts = P.map(p =&gt; 'vec2(' + f(p[0] * k) + ', ' + f(p[1]) + ')').join(', ');&#10;    return 'float ' + name + '(vec2 p)\n{\n' +&#10;        '    vec2 v[' + n + '] = vec2[' + n + '](' + pts + ');\n' +&#10;        '    float d = dot(p - v[0], p - v[0]), s = 1.0;\n' +&#10;        '    for (int i = 0, j = ' + (n - 1) + '; i &lt; ' + n + '; j = i, i++) {\n' +&#10;        '        vec2 e = v[j] - v[i], w = p - v[i];\n' +&#10;        '        vec2 b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);\n' +&#10;        '        d = min(d, dot(b, b));\n' +&#10;        '        bvec3 c = bvec3(p.y &gt;= v[i].y, p.y &lt; v[j].y, e.x * w.y &gt; e.y * w.x);\n' +&#10;        '        if (all(c) || all(not(c))) s = -s;\n    }\n';&#10;}&#10;function maskCode(m) {&#10;    const k = W / H, n = m.pts.length;&#10;    const pts = m.pts.map(p =&gt; 'vec2(' + f(p[0] * k) + ', ' + f(p[1]) + ')').join(', ');&#10;    const fe = f(0.0005 + 0.08 * (m.feather === undefined ? 0.2 : m.feather));&#10;    return 'float mask' + m.id + '(vec2 p)\n{\n' +&#10;        '    vec2 v[' + n + '] = vec2[' + n + '](' + pts + ');\n' +&#10;        '    float d = dot(p - v[0], p - v[0]), s = 1.0;\n' +&#10;        '    for (int i = 0, j = ' + (n - 1) + '; i &lt; ' + n + '; j = i, i++) {\n' +&#10;        '        vec2 e = v[j] - v[i], w = p - v[i];\n' +&#10;        '        vec2 b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);\n' +&#10;        '        d = min(d, dot(b, b));\n' +&#10;        '        bvec3 c = bvec3(p.y &gt;= v[i].y, p.y &lt; v[j].y, e.x * w.y &gt; e.y * w.x);\n' +&#10;        '        if (all(c) || all(not(c))) s = -s;\n    }\n' +&#10;        '    float in_ = 1.0 - smoothstep(-' + fe + ', ' + fe + ', s * sqrt(d));   // 1 inside\n' +&#10;        '    return ' + (m.invert ? '(1.0 - in_)' : 'in_') + ' * (1.0 - ' + AN(m, 'transp', f(m.transp || 0)) + ');\n}\n';&#10;}&#10;&#10;let sentCode = '';&#10;function sendCode() {&#10;    const code = buildCode();&#10;    if (code !== sentCode) {&#10;        sentCode = code;&#10;        out(1, { labels: TEXTS.slice(0, 16), code: code });&#10;    }&#10;    sendP();&#10;}&#10;&#10;function sendAids(loupe) {&#10;    out(1, { p: { P21: state.esens, P22: state.ewidth, P14: state.edit &amp;&amp; state.edges &amp;&amp; state.bg ? 1 + state.efilter : 0, P15: loupe ? loupe[0] : 0, P16: loupe ? loupe[1] : 0, P17: loupe &amp;&amp; state.bg ? 1 : 0, P31: state.ausens } });&#10;}&#10;let tlDirty = false;   // the timeline changed while dragging: a new shader once you let go&#10;c.on('dragend', () =&gt; { sendAids(null); if (tlDirty) { tlDirty = false; sendCode(); } });&#10;&#10;function sendP() {&#10;    const it = selected();&#10;    if (!it || it.type === 'image' || it.type === 'mask')&#10;        return;&#10;    if (it.type === 'board')&#10;        out(1, { p: boardQuad(it).flat().concat([it.speed, it.bright, it.transp || 0,&#10;                                          it.rsize === undefined ? 0.6 : it.rsize, it.rstr === undefined ? 0.6 : it.rstr]) });&#10;    if (it.type === 'board')&#10;        out(1, { p: { P23: it.fade || 0 } });&#10;    else&#10;        out(1, { p: [it.x, it.y, it.size, it.speed, it.power, it.transp || 0] });&#10;    const [r, g, b] = hexRGB(hexOf(it));&#10;    out(1, { p: { P18: r, P19: g, P20: b } });&#10;}&#10;&#10;// ---------- colours ----------&#10;function hexRGB(hex) { const n = parseInt(hex.slice(1), 16); return [(n &gt;&gt; 16 &amp; 255) / 255, (n &gt;&gt; 8 &amp; 255) / 255, (n &amp; 255) / 255]; }&#10;function rgbHex(r, g, b) { return '#' + [r, g, b].map(v =&gt; Math.round(Math.max(0, Math.min(1, v)) * 255).toString(16).padStart(2, '0')).join(''); }&#10;function codeOf(it) {   // #RRGGBB, with AA after it when it is see-through&#10;    const a = Math.round((1 - (it.transp || 0)) * 255);&#10;    return hexOf(it).toUpperCase() + (a &lt; 255 ? ('0' + a.toString(16)).slice(-2).toUpperCase() : '');&#10;}&#10;function parseColour(t) {   // '#f80', '#f808', '#ff8800', '#ff880080', 'ff8800', '255, 136, 0' or '255 136 0 128' -&gt; [hex, alpha 0..1 or null]&#10;    t = String(t).trim();&#10;    const nums = t.match(/&#94;\s*(\d{1,3})[\s,;]+(\d{1,3})[\s,;]+(\d{1,3})(?:[\s,;]+(\d{1,3}))?\s*$/);&#10;    const c = v =&gt; Math.max(0, Math.min(255, +v));&#10;    if (nums) return [rgbHex(c(nums[1]) / 255, c(nums[2]) / 255, c(nums[3]) / 255), nums[4] !== undefined ? c(nums[4]) / 255 : null];&#10;    let h = t.replace(/&#94;#/, '').toLowerCase();&#10;    if (!/&#94;[0-9a-f]+$/.test(h) || ![3, 4, 6, 8].includes(h.length)) return null;&#10;    if (h.length &lt;= 4) h = h.split('').map(x =&gt; x + x).join('');&#10;    return ['#' + h.slice(0, 6), h.length === 8 ? parseInt(h.slice(6), 16) / 255 : null];&#10;}&#10;function applyColour(it, t) {&#10;    const c = parseColour(t);&#10;    if (!it || !c) return false;&#10;    it.hex = c[0];&#10;    if (c[1] !== null) it.transp = 1 - c[1];&#10;    return true;&#10;}&#10;function toHSV(hex) {&#10;    const [r, g, b] = hexRGB(hex), mx = Math.max(r, g, b), mn = Math.min(r, g, b), d = mx - mn;&#10;    let h = 0;&#10;    if (d &gt; 0) h = mx === r ? ((g - b) / d + 6) % 6 : mx === g ? (b - r) / d + 2 : (r - g) / d + 4;&#10;    return [h / 6, mx &gt; 0 ? d / mx : 0, mx];&#10;}&#10;function fromHSV(h, s, v) {&#10;    const k = n =&gt; (n + h * 6) % 6, fn = n =&gt; v - v * s * Math.max(0, Math.min(k(n), 4 - k(n), 1));&#10;    return rgbHex(fn(5), fn(3), fn(1));&#10;}&#10;&#10;// ---------- elements ----------&#10;const selected = () =&gt; state.items.find(it =&gt; it.id === state.sel);&#10;&#10;function addBoard(x, y) {&#10;    const w = 0.18, h = 0.14;&#10;    const it = { id: state.next++, type: 'board', fx: 0, color: 7, text: 0, speed: 0.35, bright: 0.5, seed: Math.random(), mode: 0, pic: 0,&#10;                 pts: [[x - w / 2, y - h / 2], [x + w / 2, y - h / 2], [x + w / 2, y + h / 2], [x - w / 2, y + h / 2]] };&#10;    state.items.push(it);&#10;    select(it.id);&#10;}&#10;&#10;function addLight(x, y) {&#10;    const it = { id: state.next++, type: 'light', x: x, y: y, mode: 1, color: 0, size: 0.3, speed: 0.4, power: 0.5, seed: Math.random() };&#10;    state.items.push(it);&#10;    select(it.id);&#10;}&#10;&#10;function addMask(x, y) {&#10;    const r = 0.12, pts = [];&#10;    for (let i = 0; i &lt; 6; i++) { const a = i / 6 * 2 * Math.PI - Math.PI / 2; pts.push([x + r * Math.cos(a) * H / W, y + r * Math.sin(a)]); }&#10;    const it = { id: state.next++, type: 'mask', pts: pts, feather: 0.2, invert: 0, all: true, only: [], transp: 0, seed: Math.random() };&#10;    state.items.push(it);&#10;    select(it.id);&#10;}&#10;&#10;// ---------- the sound player: an Audio Player in the patch, run from Properties (Scene), heard and fed to the Scene's In A ----------&#10;// Out 3 its file, Out 4 Play, Out 5 Stop, Out 6 Loop, Out 7 Volume (dB)&#10;if (state.snd === undefined) state.snd = { file: '', loop: true, vol: 0.85, playing: false };&#10;const AUDIOEXT = /\.(wav|wave|mp3|aif|aiff|flac|ogg)$/i;&#10;const sndDb = v =&gt; v &lt; 0.01 ? -60 : Math.round((-40 + 46 * v) * 10) / 10;   // the slider (0..1) as decibels, 0 dB a little past the middle&#10;function sendSound(file) {&#10;    if (file &amp;&amp; state.snd.file) out(3, state.snd.file);&#10;    out(6, state.snd.loop ? 1 : 0);&#10;    out(7, sndDb(state.snd.vol));&#10;}&#10;function setSound(path) {&#10;    state.snd.file = path; state.snd.playing = false;&#10;    out(5);&#10;    sendSound(true);&#10;    rebuild();&#10;}&#10;// ---------- Help: the help page, in the editor, a tab for each part and Prev / Next through it ----------&#10;const HELP = [{&quot;t&quot;: &quot;What Cinemnode is&quot;, &quot;lines&quot;: [&quot;Cinemnode turns a photo into a cinemagraph: you lay moving effects, lights, pictures and masks over your own image. It is an MNodes project of 1920 x 1080 with these nodes:&quot;, &quot;# Node  |  What it does&quot;, &quot;| Cinemnode (Scene)  |  Draws the photo and all effects; see-through where there is nothing&quot;, &quot;| Cinemnode Editor (Script)  |  The editor itself: toolbar, panels, handles, timeline&quot;, &quot;| Background File (File)  |  Picks files: the background, and pictures for Image layers&quot;, &quot;| Colour Code (Text Input)  |  Type a colour code here (#RRGGBB, #RRGGBBAA or 255, 128, 0) for the selected element&quot;, &quot;| Audio In, Audio Out  |  The plugin's sound: into the Scene's In A for the Audio panel, and out again unchanged&quot;, &quot;| Transport  |  The DAW's beat and bar, for Beat and Bar in the Audio panel&quot;, &quot;| Sound Player (Audio Player)  |  Plays the sound file chosen in Properties (Scene)&quot;, &quot;Edit and Perform. In Edit mode you see the editor, and the picture fits between the toolbar, the dock and the timeline. Done (at the bottom of the toolbar) goes to Perform: only the picture with its effects, full screen. Double-click the Scene to go back to Edit mode, or send a message to In 1 of the Script (a Widget Toggle, for instance).&quot;]}, {&quot;t&quot;: &quot;The editor&quot;, &quot;lines&quot;: [&quot;The editor is laid out like Photoshop: tools on the left, a dock on the right, and the timeline below when you open it.&quot;, &quot;Toolbar (top to bottom)&quot;, &quot;# Button  |  What it does&quot;, &quot;| Board  |  New board: an area with an effect&quot;, &quot;| Image  |  New picture layer (picks a file)&quot;, &quot;| Mask  |  New mask: a shape where effects do not show&quot;, &quot;| Light  |  New light (double-clicking an empty spot works too)&quot;, &quot;| Copy  |  Copy of the selected element&quot;, &quot;| Delete  |  Removes the selected element&quot;, &quot;| Undo / Redo  |  Back and forth through the last 80 changes&quot;, &quot;| Picture  |  Choose the background photo&quot;, &quot;| Edges  |  Shows the edges in the photo (set up in Properties)&quot;, &quot;| Fit  |  Whole picture in view; shows the zoom level when zoomed in&quot;, &quot;| Timeline  |  Opens or closes the timeline&quot;, &quot;| Audio  |  Opens or closes the Audio panel&quot;, &quot;| Snap  |  Snapping to other elements and the sides, on or off&quot;, &quot;| Clear  |  Removes everything that is not locked (click twice)&quot;, &quot;| Panels  |  Hides or shows the dock&quot;, &quot;| Help  |  Opens this help in the editor: a tab for each part, Prev and Next (or the mouse wheel) to page through, click outside or the cross to close&quot;, &quot;| Done  |  Goes to Perform&quot;, &quot;Dock. On the right are Properties (the settings of the selected element, or the background when nothing is selected) and Layers (all elements, the top one in front). In Layers, click a name to select it; the eye hides, the lock locks, and the arrows move a layer forward or back. Each part folds in by its header; the &lt; / &gt; tab on the edge folds the whole dock away. The mouse wheel scrolls the dock when it is too long.&quot;, &quot;Zoom and pan. The mouse wheel on an empty spot zooms in and out around the mouse. When zoomed in, drag an empty spot to move the picture. Fit resets it.&quot;]}, {&quot;t&quot;: &quot;Elements&quot;, &quot;lines&quot;: [&quot;There are four kinds of element. They stack in the order of Layers, except pictures: those always lie on top.&quot;, &quot;## Board&quot;, &quot;An area with an effect, fitted into the photo.&quot;, &quot;- Shape: 4 points give an area in perspective; drag each corner into place (Ctrl + drag scales the whole board). Double-click the edge for an extra point, right-click a point to remove it (3 at least). With more or fewer than 4 points, the effect is spread over a straight box around the points and your shape is cut out of it.&quot;, &quot;- Properties: group and effect, a kind where there is one (Snow or Fireflies for Particles, for instance), colour, Speed, Brightness, the effect's own two sliders, Edge fade and Transparency.&quot;, &quot;- Picture: Off, Surface, Bright parts or Dark parts: the effect follows the photo, for instance only on its bright parts. For effects that move the photo itself, Surface means: stronger where the photo is bright.&quot;, &quot;- Edge fade: 0 is a hard edge; higher fades the effect out towards the inside, at 100% all the way to the middle. It scales with the board. Not on Light box.&quot;, &quot;## Light&quot;, &quot;A light: a glow at a point. Pick a mode (On, Blink, Twinkle, Broken tube, Pulse, Strobe, Candle, Traffic light, Aircraft, Lens flare), colour, Size, Speed and Strength. The ring around the light shows its reach.&quot;, &quot;## Image&quot;, &quot;A picture as a layer, always on top of the effects. PNG with transparency works.&quot;, &quot;- Drag to move, mouse wheel = bigger or smaller, Shift + wheel = turn.&quot;, &quot;- The corners change the box (Ctrl keeps its proportions).&quot;, &quot;- Fit shows the whole picture in the box, Fill fills the box and cuts off the rest.&quot;, &quot;## Mask&quot;, &quot;A shape where the effects do not show. It starts as a hexagon.&quot;, &quot;- Double-click the edge for another point, right-click a point to remove it.&quot;, &quot;- inside / outside: hide the effects inside the shape, or outside it.&quot;, &quot;- Soft edge for a soft border, Transparency to let the effect partly through.&quot;, &quot;- All effects or Only the ones I pick: then click the boards and lights the mask should block.&quot;, &quot;- Masks work on effects and lights, not on pictures.&quot;]}, {&quot;t&quot;: &quot;Effects&quot;, &quot;lines&quot;: [&quot;A board first picks a group, then an effect. Effects in Moving picture and some in Film look move the photo itself, so they need a background photo.&quot;, &quot;# Group  |  Effect  |  What it does  |  Own sliders&quot;, &quot;| Signs  |  Plasma  |  Colourful moving pattern  |  -&quot;, &quot;| Signs  |  Text  |  Ticker with scrolling text  |  -&quot;, &quot;| Signs  |  Glitch  |  Glitching digital screen  |  -&quot;, &quot;| Signs  |  Colour bars  |  Test card with colour bars  |  -&quot;, &quot;| Signs  |  Retro  |  Retro pattern  |  -&quot;, &quot;| Signs  |  Window light  |  Lit window  |  -&quot;, &quot;| Signs  |  Neon edge  |  Neon tube along the edge  |  -&quot;, &quot;| Signs  |  Light box  |  Lit area with a glow around it, with a light mode  |  Glow size&quot;, &quot;| Signs  |  TV glow  |  Flickering light of a TV  |  Flicker, Colours&quot;, &quot;| Signs  |  Custom  |  Your own effect  |  -&quot;, &quot;| Light  |  Colour glow  |  One colour of the photo lights up (pick the spot with the picker)  |  Tolerance, Softness&quot;, &quot;| Light  |  Edge glow  |  The photo's edges light up: Glow, Running or Sparkle  |  Sensitivity, Glow width&quot;, &quot;| Light  |  Light rays  |  Rays of light  |  Light from, Rays&quot;, &quot;| Light  |  Beacon  |  Turning beam: Lighthouse or Searchlight  |  Beam width, Reach&quot;, &quot;| Light  |  Headlight sweep  |  Headlights sweeping over a wall  |  Width, How often&quot;, &quot;| Light  |  Light trails  |  Light trails of traffic: Cars or One colour  |  Traffic, Trail length&quot;, &quot;| Weather  |  Rain  |  Falling rain  |  (Amount = how much)&quot;, &quot;| Weather  |  Clouds  |  Drifting clouds  |  -&quot;, &quot;| Weather  |  Smoke  |  Smoke plume from the bottom middle  |  -&quot;, &quot;| Weather  |  Steam  |  Rising steam  |  Amount, Width&quot;, &quot;| Weather  |  Fog  |  Fog: Ground fog or Mist bank  |  Thickness, Height&quot;, &quot;| Weather  |  Lightning  |  Lightning: Strike or In the clouds  |  Flash, Bolt&quot;, &quot;| Weather  |  Rain on glass  |  Rain on a window pane  |  Drops, Mist&quot;, &quot;| Weather  |  Frost  |  Ice growing over a window  |  Grow, Blur&quot;, &quot;| Weather  |  Window drops  |  Drops that land on the window, wander down and vanish  |  Drops, Size&quot;, &quot;| Weather  |  Rainbow  |  Rainbow  |  Strength, Width&quot;, &quot;| Water  |  Ripple  |  Rings in water: On top or In the picture  |  Circle size, Strength&quot;, &quot;| Water  |  Water sparkle  |  Glints: Glints or Moon path  |  Amount, Size&quot;, &quot;| Water  |  Shore waves  |  Waves rolling onto a beach, with foam  |  Reach, Foam&quot;, &quot;| Water  |  Caustics  |  Net of light as on a pool floor  |  Strength, Size&quot;, &quot;| Nature  |  Particles  |  Snow, Dust, Fireflies, Leaves, Blossom, Hail, Sand or Stars  |  Amount, Size&quot;, &quot;| Nature  |  Fire  |  Fire: Flames or Rocket  |  Height, Detail&quot;, &quot;| Sky &amp; space  |  Shooting stars  |  Shooting stars  |  How often, Trail length&quot;, &quot;| Sky &amp; space  |  Star trails  |  Star trails around a point  |  Stars, Arc length&quot;, &quot;| Sky &amp; space  |  Nebula  |  Nebula  |  Strength, Detail&quot;, &quot;| Sky &amp; space  |  Northern lights  |  Aurora  |  Strength, Height&quot;, &quot;| Sky &amp; space  |  Planet bands  |  Bands of a planet  |  Opacity, Bands&quot;, &quot;| Moving picture  |  Flow  |  The photo flows in one direction (water, clouds)  |  Direction, Length&quot;, &quot;| Moving picture  |  Sway  |  Swaying: Grass, Leaves or Flag  |  Wind, Wave size&quot;, &quot;| Moving picture  |  Heat haze  |  Heat shimmer  |  Strength, Size&quot;, &quot;| Moving picture  |  Reflection  |  Reflection: Water or Wet street  |  Ripples, Clearness&quot;, &quot;| Moving picture  |  Breathe  |  Slow zoom in and out  |  Amount&quot;, &quot;| Moving picture  |  Cloud shadows  |  Cloud shadows passing over  |  Darkness, Cloud size&quot;, &quot;| Moving picture  |  Dappled light  |  Moving light through leaves  |  Strength, Patch size&quot;, &quot;| Moving picture  |  Swell  |  Swell of the sea  |  Rise, Tilt&quot;, &quot;| Film look  |  Day / night  |  Grades the picture towards night  |  Night, Blue&quot;, &quot;| Film look  |  Handheld  |  Handheld camera  |  Shake, Zoom&quot;, &quot;| Film look  |  Colour fringe  |  Colour fringes  |  Strength, Wobble&quot;, &quot;| Film look  |  Bloom  |  Bright parts glow  |  Glow, Size&quot;, &quot;| Film look  |  Film grain  |  Film grain  |  Amount, Grain size&quot;, &quot;| Film look  |  Vignette  |  Dark corners  |  Amount, Breathe&quot;, &quot;| Film look  |  Old film  |  Old film with scratches  |  Amount, Scratches&quot;, &quot;| Light  |  Firelight  |  A fire's warm light flickering over the room (strongest at the bottom of the board)  |  Flicker, Reach&quot;, &quot;| Light  |  Sun glow  |  A soft glow round the sun in the middle of the board, slowly breathing  |  Size, Pulse&quot;, &quot;| Nature  |  Embers  |  Glowing sparks rising from the bottom of the board and dying out  |  Amount, Height&quot;, &quot;| Nature / Moving picture  |  Flame flicker  |  The flame in the picture itself licks and wavers (a candle, a fireplace)  |  Strength, Size&quot;, &quot;| Sky &amp; space  |  Birds  |  Small birds crossing the board now and then, flapping  |  How many, Size&quot;, &quot;| Sky &amp; space / Moving picture  |  Cloud drift  |  The picture in the board drifts slowly sideways, seamlessly (put it over the sky only)  |  Direction, Distance&quot;]}, {&quot;t&quot;: &quot;Menu, copying and colours&quot;, &quot;lines&quot;: [&quot;Right-click menu. Right-click an element for its menu:&quot;, &quot;# Option  |  On  |  What it does&quot;, &quot;| Make square  |  Board (4 points)  |  A straight square, as big and as turned as it was&quot;, &quot;| Make rectangle  |  Board (4 points)  |  Takes the perspective off, keeps width and height&quot;, &quot;| Straighten  |  Board (4 points)  |  Level again&quot;, &quot;| Back to 4 corners  |  Board (other shape)  |  Back to a board with 4 corners&quot;, &quot;| Replace picture, No turn, Fit / Fill  |  Image  |  Other file, no turn, Fit or Fill&quot;, &quot;| Hide the effects inside/outside, Mask all effects  |  Mask  |  Invert, or mask all effects again&quot;, &quot;| Copy size  |  All  |  Remembers size, turn and shape&quot;, &quot;| Paste size  |  All  |  Same width and height; its own turn and shape stay&quot;, &quot;| Paste size and shape  |  Board, Image, Mask  |  Takes the turn and shape as well&quot;, &quot;| Duplicate, Bring to front, Send to back  |  All  |  Copy, to the front, to the back&quot;, &quot;| Hide, Lock, Delete  |  All  |  Hide, lock in place, remove&quot;, &quot;Copy and Paste work between all kinds: a light counts as a square as big as its ring; a mask pasted onto a board (size and shape) gives the board the same points.&quot;, &quot;Undo and Redo in the toolbar remember the last 80 changes. Selecting an element is not a change; a run of wheel turns is one step. Ctrl+Z does not work, because the Script gets no keys.&quot;, &quot;Colours. Pick a colour from the row, or switch between RGB and HSV sliders. Type a code in the Colour Code field: #RGB, #RGBA, #RRGGBB, #RRGGBBAA, or 255, 128, 0 (with a fourth number for alpha). Keep your own colours in the palette; right-click a palette colour to remove it.&quot;]}, {&quot;t&quot;: &quot;Timeline&quot;, &quot;lines&quot;: [&quot;The timeline animates the selected element in a loop, with straight lines between the keys. Open it with Timeline in the toolbar.&quot;, &quot;- Select an element and pick a property in the list on the left. A round dot means: this property is animated.&quot;, &quot;- Click Animate (or the graph) to start.&quot;, &quot;- Click in the graph for a key, drag a key to move it, right-click a key to remove it. The start and end of the loop move together, so the loop never jumps.&quot;, &quot;- Set with loop how long one round takes (0.5 to 30 seconds).&quot;, &quot;# Element  |  What you can animate&quot;, &quot;| Board  |  Transparency, Brightness, the effect's own two sliders, Edge fade, Red, Green, Blue&quot;, &quot;| Light  |  Transparency, Size, Strength, Across, Down, Red, Green, Blue&quot;, &quot;| Image  |  Transparency, Across, Down, Size, Turn&quot;, &quot;| Mask  |  Transparency&quot;, &quot;An animated property is locked in Properties (with a link to the timeline), and dragging or the mouse wheel does not change it either. The animation plays in Perform too.&quot;]}, {&quot;t&quot;: &quot;Audio&quot;, &quot;lines&quot;: [&quot;The Audio button opens a panel under the picture, in the same place as the timeline. Each setting of the selected board, light or mask (the same ones the timeline offers) can follow a part of the sound:&quot;, &quot;- Level: how loud the sound is overall&quot;, &quot;- Bass, Mid, High: a part of the spectrum&quot;, &quot;- Beat: a pulse on every beat of the DAW, fading until the next one&quot;, &quot;- Bar: a ramp from 0 to 1 over each bar of the DAW&quot;, &quot;The slider next to it says how far the sound moves the setting: to the right it goes up, to the left down, from where its own slider in Properties puts it. Sensitivity (on the right) sets how loud the sound must be before it moves anything. The meters show what comes in now.&quot;, &quot;The sound comes from the plugin's audio input (Audio In, wired to the Scene's In A, and passed on unchanged to Audio Out). Beat and Bar come from the Transport node (following the DAW), and only move while the DAW plays. Pictures (images) cannot follow the sound yet. The reaction plays in Perform too.&quot;, &quot;Sound player. With nothing selected, Properties has a SOUND part under BACKGROUND: Choose sound... loads a WAV, MP3, AIFF, FLAC or OGG file, with Play, Stop, Loop and Volume. The file plays through the plugin's output (so you hear it) and goes into the Scene's In A together with the plugin's input, so the Audio panel follows it.&quot;]}, {&quot;t&quot;: &quot;Mouse and keys&quot;, &quot;lines&quot;: [&quot;# Where  |  Action  |  Result&quot;, &quot;| Element  |  Drag  |  Move (Alt: no snapping)&quot;, &quot;| Element  |  Mouse wheel  |  Bigger or smaller&quot;, &quot;| Element  |  Shift + mouse wheel  |  Turn&quot;, &quot;| Element  |  Right-click  |  Menu&quot;, &quot;| Corner or point  |  Drag  |  Move it&quot;, &quot;| Board corner  |  Ctrl + drag  |  Scale the whole board&quot;, &quot;| Image corner  |  Ctrl + drag  |  Scale the box, keeping its proportions&quot;, &quot;| Edge of a board or mask  |  Double-click  |  Add a point&quot;, &quot;| Point of a board or mask  |  Right-click  |  Remove the point&quot;, &quot;| Empty spot  |  Double-click  |  New light&quot;, &quot;| Empty spot  |  Mouse wheel  |  Zoom&quot;, &quot;| Empty spot (zoomed in)  |  Drag  |  Move the picture&quot;, &quot;| Empty spot  |  Click  |  Deselect&quot;, &quot;| Scene in Perform  |  Double-click  |  Back to Edit mode&quot;]}, {&quot;t&quot;: &quot;Limits&quot;, &quot;lines&quot;: [&quot;- Pictures always lie on top of all effects; masks do not work on them.&quot;, &quot;- On a board with more or fewer than 4 points, an effect that draws the edge (Neon edge) follows the box, not the cut shape.&quot;, &quot;- Ctrl+Z and other keys do not work in the editor; use Undo and Redo in the toolbar.&quot;, &quot;- Filmstrips are gone (tried in 2.0 to 2.5, removed in 2.6).&quot;]}, {&quot;t&quot;: &quot;Versions&quot;, &quot;lines&quot;: [&quot;# Version  |  New&quot;, &quot;| 3.7  |  Help in the editor: this page, with tabs and Prev / Next&quot;, &quot;| 3.6  |  Sound player in Properties (Scene): a file to play, heard and followed by the Audio panel&quot;, &quot;| 3.5  |  Audio panel: settings follow the sound (Level, Bass, Mid, High) or the DAW's Beat and Bar. Six new effects: Firelight, Sun glow, Embers, Flame flicker, Birds, Cloud drift&quot;, &quot;| 3.4  |  All editor text 25% bigger&quot;, &quot;| 3.3  |  Faster updates with many elements: boards and lights share one loop, so each kind of effect is in the shader once; masks are worked out only where something is drawn&quot;, &quot;| 3.2  |  Bigger, brighter editor text: hints, toolbar, section labels and sliders (values now sit right of the slider)&quot;, &quot;| 3.1  |  Bigger, brighter names on the picture and in the layer list&quot;, &quot;| 3.0  |  Edge fade per board&quot;, &quot;| 2.9  |  Dragging the picture no longer stutters with locked layers&quot;, &quot;| 2.8  |  Boards with more or fewer than 4 points&quot;, &quot;| 2.7  |  Copy and Paste size between all kinds of element&quot;, &quot;| 2.6  |  Filmstrips removed; a mask set to outside stays clickable&quot;, &quot;| 1.9  |  Masks&quot;, &quot;| 1.8  |  Picture layers&quot;, &quot;| 1.7  |  Right-click menu, Make square, Copy and Paste size, Undo and Redo&quot;, &quot;| 1.6  |  Window drops, new Shore waves, Picture options for all effects&quot;, &quot;| 1.5  |  Many new effects, in groups&quot;, &quot;| 1.4  |  Animated properties locked, &lt; and &gt; for the dock&quot;, &quot;| 1.3  |  Animate everything of an element, RGB too&quot;, &quot;| 1.2  |  Timeline for transparency in a loop&quot;, &quot;| 1.1  |  Twelve cinemagraph effects&quot;, &quot;| 1.0  |  Scene Kit becomes Cinemnode, in Darc Sector colours&quot;]}];&#10;const LOGO = 'C:/Users/Danny/Downloads/Cinemnode logo.png';   // the Darc Sector logo, at the top of the help   // [{ t: title, lines: [...] }]: '## ' a heading, '- ' a point, '# ' a table's header, '| ' a row (cells split by '  |  ')&#10;let help = null;   // { tab, screen } while it is open&#10;const HW = 1320, HH = 900, HX = (W - HW) / 2, HY = (H - HH) / 2, HBODY = HH - 232;&#10;function wrap(text, size, width) {   // lines of at most width, by a guess of the letters' width&#10;    const cw = size * 0.53, max = Math.max(8, Math.floor(width / cw)), out = [];&#10;    let line = '';&#10;    for (const w of String(text).split(' ')) {&#10;        if (line &amp;&amp; (line + ' ' + w).length &gt; max) { out.push(line); line = w; }&#10;        else line = line ? line + ' ' + w : w;&#10;    }&#10;    if (line) out.push(line);&#10;    return out.length ? out : [''];&#10;}&#10;function helpScreens(tab) {   // the tab's lines laid out, cut into screens that fit the body: [[{x, y, text, size, fill}...], ...]&#10;    const screens = [[]], BW = HW - 80;&#10;    let y = 0;&#10;    const put = (rows, h, gap) =&gt; {   // rows: items with their own y from 0; h their height&#10;        if (y + h &gt; HBODY &amp;&amp; y &gt; 0) { screens.push([]); y = 0; }&#10;        rows.forEach(o =&gt; screens[screens.length - 1].push(Object.assign({}, o, { y: y + o.y })));&#10;        y += h + gap;&#10;    };&#10;    for (const l of HELP[tab].lines) {&#10;        if (l.startsWith('## ')) put([{ x: 0, y: 0, text: l.slice(3), size: 22, fill: ACC }], 30, 6);&#10;        else if (l.startsWith('- ')) { const w = wrap(l.slice(2), 18, BW - 28); put(w.map((t, i) =&gt; ({ x: 28, y: i * 26, text: t, size: 18, fill: '#e4def5' })).concat([{ x: 8, y: 0, dot: true }]), w.length * 26, 4); }&#10;        else if (l.startsWith('# ')) { const c = l.slice(2).split('  |  '); put(c.map((t, i) =&gt; ({ x: HCOL(c.length, i), y: 0, text: t, size: 15, fill: '#9a94b8' })), 24, 2); }&#10;        else if (l.startsWith('| ')) {&#10;            const c = l.slice(2).split('  |  ');&#10;            if (c.length &gt; 3) {   // the effects: group, name | what it does | its sliders&#10;                const w = wrap(c[2] + (c[3] ? '  (' + c[3] + ')' : ''), 17, BW - 390);&#10;                put([{ x: 0, y: 0, text: c[0], size: 15, fill: '#9a94b8' }, { x: 190, y: 0, text: c[1], size: 18, fill: '#c9a6ff' }]&#10;                    .concat(w.map((t, i) =&gt; ({ x: 390, y: i * 24, text: t, size: 17, fill: '#e4def5' }))), Math.max(26, w.length * 24), 4);&#10;            } else {   // two or three columns, each wrapped in its own width&#10;                const xs = c.map((t, i) =&gt; HCOL(c.length, i)), rows = [];&#10;                let n = 1;&#10;                c.forEach((t, i) =&gt; {&#10;                    const w = wrap(t, i ? 17 : 18, (i &lt; c.length - 1 ? xs[i + 1] : BW) - xs[i] - 16);&#10;                    n = Math.max(n, w.length);&#10;                    w.forEach((tt, k) =&gt; rows.push({ x: xs[i], y: k * 24, text: tt, size: i ? 17 : 18, fill: i ? '#e4def5' : '#c9a6ff' }));&#10;                });&#10;                put(rows, Math.max(26, n * 24), 4);&#10;            }&#10;        } else { const w = wrap(l, 18, BW); put(w.map((t, i) =&gt; ({ x: 0, y: i * 26, text: t, size: 18, fill: '#e4def5' })), w.length * 26, 12); }&#10;    }&#10;    return screens;&#10;}&#10;const HCOL = (n, i) =&gt; n &gt; 3 ? [0, 190, 390, 900][i] : n === 3 ? [0, 360, 600][i] : [0, 300][i];   // where a table's columns start&#10;function drawHelp() {&#10;    const sheet = layer.rect({ x: 0, y: 0, w: W, h: H, fill: '#050610b0', interactive: true });&#10;    sheet.on('click', e =&gt; { e.stop(); help = null; rebuild(); });&#10;    sheet.on('wheel', e =&gt; e.stop());&#10;    const g = layer.group({ x: HX, y: HY });&#10;    const box = g.rect({ w: HW, h: HH, radius: 14, fill: '#14121f', stroke: ACC, strokeWidth: 1.5, interactive: true, shadow: { color: '#000000c0', y: 8, blur: 30 } });&#10;    box.on('click', e =&gt; e.stop());&#10;    box.on('wheel', e =&gt; { e.stop(); step(e.delta &gt; 0 ? 1 : -1); });&#10;    g.text({ x: 32, y: 34, text: 'CINEMNODE HELP', size: 22, baseline: 'middle', fill: ACC, interactive: false });&#10;    g.text({ x: 248, y: 35, text: 'by Darc Sector', size: 16, baseline: 'middle', fill: '#9a94b8', interactive: false });&#10;    g.image({ x: HW - 170, y: 8, w: 104, h: 95, src: LOGO, fit: 'contain', interactive: false });&#10;    const x = g.group({ x: HW - 52, y: 14, cursor: 'pointer', tooltip: 'Close' });&#10;    x.rect({ w: 38, h: 38, radius: 8, fill: '#1a1628' });&#10;    x.line({ x1: 12, y1: 12, x2: 26, y2: 26, width: 2.5, stroke: '#f1ecff', interactive: false });&#10;    x.line({ x1: 26, y1: 12, x2: 12, y2: 26, width: 2.5, stroke: '#f1ecff', interactive: false });&#10;    x.on('click', e =&gt; { e.stop(); help = null; rebuild(); });&#10;    // the tabs, in rows as they fit&#10;    let tx = 32, ty = 62;&#10;    HELP.forEach((p, i) =&gt; {&#10;        const bw = p.t.length * 9.6 + 26;&#10;        if (tx + bw &gt; HW - 180) { tx = 32; ty += 36; }   // (the logo sits on the right)&#10;        button(g, tx, ty, bw, p.t, () =&gt; { help.tab = i; help.screen = 0; rebuild(); }, i === help.tab);&#10;        tx += bw + 6;&#10;    });&#10;    const top = ty + 50;&#10;    g.line({ x1: 32, y1: top - 10, x2: HW - 32, y2: top - 10, width: 1, stroke: '#2f2850', interactive: false });&#10;    const screens = helpScreens(help.tab);&#10;    help.screen = Math.min(help.screen, screens.length - 1);&#10;    screens[help.screen].forEach(o =&gt; o.dot ? g.circle({ x: 40 + o.x + 6, y: top + 18 + o.y, r: 4, fill: ACC, interactive: false })   // a point: a round dot&#10;                                           : g.text({ x: 40 + o.x, y: top + 18 + o.y, text: o.text, size: o.size, baseline: 'middle', fill: o.fill, interactive: false }));&#10;    // Prev / Next: through the screens of a tab, then on to the next tab&#10;    const step = d =&gt; {&#10;        const n = helpScreens(help.tab).length;&#10;        if (d &gt; 0) { if (help.screen &lt; n - 1) help.screen++; else if (help.tab &lt; HELP.length - 1) { help.tab++; help.screen = 0; } }&#10;        else { if (help.screen &gt; 0) help.screen--; else if (help.tab &gt; 0) { help.tab--; help.screen = helpScreens(help.tab).length - 1; } }&#10;        rebuild();&#10;    };&#10;    const first = help.tab === 0 &amp;&amp; help.screen === 0, last = help.tab === HELP.length - 1 &amp;&amp; help.screen === screens.length - 1;&#10;    const by = HH - 58;&#10;    g.line({ x1: 32, y1: by - 14, x2: HW - 32, y2: by - 14, width: 1, stroke: '#2f2850', interactive: false });&#10;    button(g, 32, by, 130, '&lt; Prev', () =&gt; { if (!first) step(-1); }, false);&#10;    button(g, HW - 162, by, 130, 'Next &gt;', () =&gt; { if (!last) step(1); }, !last);&#10;    g.text({ x: HW / 2, y: by + 15, text: HELP[help.tab].t + (screens.length &gt; 1 ? '  -  ' + (help.screen + 1) + ' of ' + screens.length : '') + '      (' + (help.tab + 1) + ' / ' + HELP.length + ')',&#10;             size: 16, align: 'center', baseline: 'middle', fill: '#aaa4c6', interactive: false });&#10;}&#10;&#10;let wantSound = false;   // the next file from the File node is a sound for the player&#10;let wantImage = false;   // the next file from the File node is a picture layer, not the background&#10;function addImage(path) {&#10;    const it = { id: state.next++, type: 'image', src: path, x: 0.5, y: 0.5, w: 0.3, h: 0.3 * W / H, scale: 0.5, rot: 0.5, transp: 0, fit: 0, seed: Math.random() };&#10;    state.items.push(it);&#10;    select(it.id);&#10;}&#10;&#10;function duplicate() {&#10;    const it = selected();&#10;    if (!it)&#10;        return;&#10;    const n = JSON.parse(JSON.stringify(it));&#10;    n.id = state.next++;&#10;    n.seed = Math.random();&#10;    if (n.pts)&#10;        n.pts = n.pts.map(p =&gt; [p[0] + 0.03, p[1] + 0.03]);&#10;    else { n.x += 0.03; n.y += 0.03; }&#10;    state.items.push(n);&#10;    select(n.id);&#10;}&#10;&#10;function remove(id) {&#10;    const it = state.items.find(t =&gt; t.id === id);&#10;    if (!it || it.locked)&#10;        return;&#10;    state.items = state.items.filter(it =&gt; it.id !== id);&#10;    if (state.sel === id)&#10;        state.sel = 0;&#10;    sendCode();&#10;    rebuild();&#10;}&#10;&#10;// a press on another element makes it the selected one at once (its shader reads P from then on), but its&#10;// handles are drawn anew only when the mouse lets go, so the drag that started with the press goes on&#10;let pending = false;&#10;function pick(id) {&#10;    if (state.sel === id)&#10;        return;&#10;    state.sel = id;&#10;    sendCode();&#10;    pending = true;&#10;}&#10;c.on('press', () =&gt; { wheeling = false; });&#10;c.on('release', () =&gt; { checkpoint(); if (tlDirty) { tlDirty = false; sendCode(); } if (pending) { pending = false; rebuild(); } });&#10;&#10;function select(id) {&#10;    sure = false;&#10;    hexTyping = null;&#10;    state.sel = id;&#10;    sendCode();&#10;    rebuild();&#10;}&#10;&#10;function centre(it) {&#10;    if (!it.pts)&#10;        return [it.x, it.y];&#10;    return [it.pts.reduce((a, p) =&gt; a + p[0], 0) / it.pts.length, it.pts.reduce((a, p) =&gt; a + p[1], 0) / it.pts.length];&#10;}&#10;&#10;// scale (and turn, in degrees) a sign round its middle; the turn is worked out in pixels so it stays square&#10;function transform(it, k, deg) {&#10;    const [cx, cy] = centre(it);&#10;    const a = deg * Math.PI / 180, ca = Math.cos(a), sa = Math.sin(a);&#10;    it.pts = it.pts.map(p =&gt; {&#10;        const dx = (p[0] - cx) * W, dy = (p[1] - cy) * H;&#10;        return [cx + k * (dx * ca - dy * sa) / W, cy + k * (dx * sa + dy * ca) / H];&#10;    });&#10;}&#10;&#10;// ---------- undo and redo ----------&#10;// every change is one step back: the elements as they were, kept as text (choosing another one is no change); a run&#10;// of wheel turns on one element is one step&#10;let past = [], future = [], now = null, wheeling = false;&#10;const snapshot = () =&gt; JSON.stringify(state.items);&#10;function checkpoint() {&#10;    const s = snapshot();&#10;    if (now !== null &amp;&amp; s !== now) {&#10;        past.push(now);&#10;        if (past.length &gt; 80)&#10;            past.shift();&#10;        future = [];&#10;    }&#10;    now = s;&#10;}&#10;function wheelStep() {&#10;    if (!wheeling) { checkpoint(); wheeling = true; }&#10;}&#10;function restore(s) {&#10;    state.items = JSON.parse(s);&#10;    if (!state.items.some(t =&gt; t.id === state.sel))&#10;        state.sel = 0;&#10;    now = s;&#10;    menu = null; sure = false; hexTyping = null; wheeling = false;&#10;    sendCode();&#10;    rebuild();&#10;}&#10;function undo() { checkpoint(); if (past.length) { future.push(now); restore(past.pop()); } }&#10;function redo() { checkpoint(); if (future.length) { past.push(now); restore(future.pop()); } }&#10;&#10;// ---------- a board's shape ----------&#10;// a board as its middle, its turn (radians, along its top and bottom edges) and its width and height, in pixels&#10;function frameOf(it) {&#10;    const P = it.pts.map(p =&gt; [p[0] * W, p[1] * H]);&#10;    const d = (a, b) =&gt; Math.hypot(b[0] - a[0], b[1] - a[1]);&#10;    const [cx, cy] = centre(it);&#10;    const a = Math.atan2(P[1][1] - P[0][1] + P[2][1] - P[3][1], P[1][0] - P[0][0] + P[2][0] - P[3][0]);&#10;    return { cx: cx * W, cy: cy * H, a: a, w: (d(P[0], P[1]) + d(P[3], P[2])) / 2, h: (d(P[0], P[3]) + d(P[1], P[2])) / 2 };&#10;}&#10;// the four corners the effect is spread over: a 4-point board's own; with more or fewer points, the straight box round&#10;// them, turned by it.qa (radians: the board's turn when it got its fifth point)&#10;function boardQuad(it) {&#10;    if (it.pts.length === 4)&#10;        return it.pts;&#10;    const a = it.qa || 0, ca = Math.cos(a), sa = Math.sin(a), [cx, cy] = centre(it);&#10;    const L = it.pts.map(p =&gt; { const x = (p[0] - cx) * W, y = (p[1] - cy) * H; return [x * ca + y * sa, -x * sa + y * ca]; });&#10;    const x0 = Math.min(...L.map(l =&gt; l[0])), x1 = Math.max(...L.map(l =&gt; l[0])), y0 = Math.min(...L.map(l =&gt; l[1])), y1 = Math.max(...L.map(l =&gt; l[1]));&#10;    return [[x0, y0], [x1, y0], [x1, y1], [x0, y1]].map(([x, y]) =&gt; [cx + (x * ca - y * sa) / W, cy + (x * sa + y * ca) / H]);&#10;}&#10;function addMaskPoint(it, u, v) {   // a new point on the edge nearest to (u, v), in pixels&#10;    let best = 0, bd = 1e9;&#10;    const n = it.pts.length;&#10;    for (let i = 0; i &lt; n; i++) {&#10;        const a = it.pts[i], b = it.pts[(i + 1) % n];&#10;        const ex = (b[0] - a[0]) * W, ey = (b[1] - a[1]) * H, wx = (u - a[0]) * W, wy = (v - a[1]) * H;&#10;        const t = Math.max(0, Math.min(1, (wx * ex + wy * ey) / Math.max(1e-6, ex * ex + ey * ey)));&#10;        const d = Math.hypot(wx - ex * t, wy - ey * t);&#10;        if (d &lt; bd) { bd = d; best = i; }&#10;    }&#10;    if (it.type === 'board' &amp;&amp; it.pts.length === 4)&#10;        it.qa = frameOf(it).a;   // the box the effect is spread over keeps the board's turn&#10;    it.pts.splice(best + 1, 0, [u, v]);&#10;    sendCode();&#10;    rebuild();&#10;}&#10;function setFrame(it, f) {   // the board as a straight rectangle, w by h, turned by a round its middle&#10;    const ca = Math.cos(f.a), sa = Math.sin(f.a);&#10;    it.pts = [[-1, -1], [1, -1], [1, 1], [-1, 1]].map(([u, v]) =&gt; {&#10;        const x = u * f.w / 2, y = v * f.h / 2;&#10;        return [clampN((f.cx + x * ca - y * sa) / W), clampN((f.cy + x * sa + y * ca) / H)];&#10;    });&#10;}&#10;function squareUp(it, square) {   // no perspective: a rectangle as wide and high as it was (a square as big), as turned as it was&#10;    const f = frameOf(it);&#10;    if (square)&#10;        f.w = f.h = Math.sqrt(f.w * f.h);&#10;    setFrame(it, f);&#10;}&#10;function straighten(it) {   // a level rectangle&#10;    const f = frameOf(it);&#10;    f.a = 0;&#10;    setFrame(it, f);&#10;}&#10;// a copied size, from any element, for any element: { w, h (pixels), a (its turn, radians), rel (its corners or points&#10;// from its middle, in pixels) }&#10;let clip = null;&#10;const lightR = it =&gt; 6 + 250 * it.size * it.size;   // a light's reach, in pixels (as its ring shows)&#10;function shapeOf(it) {&#10;    if (it.type === 'board' &amp;&amp; it.pts.length === 4) {&#10;        const f = frameOf(it);&#10;        return { w: f.w, h: f.h, a: f.a, rel: it.pts.map(p =&gt; [p[0] * W - f.cx, p[1] * H - f.cy]) };&#10;    }&#10;    if (it.pts) {   // a mask's points (or a board's, not 4), and the box round them&#10;        const [cx, cy] = centre(it), rel = it.pts.map(p =&gt; [p[0] * W - cx * W, p[1] * H - cy * H]);&#10;        const xs = rel.map(r =&gt; r[0]), ys = rel.map(r =&gt; r[1]);&#10;        return { w: Math.max(...xs) - Math.min(...xs), h: Math.max(...ys) - Math.min(...ys), a: 0, rel: rel };&#10;    }&#10;    const [w, h] = it.type === 'image' ? imgBox(it, it.scale) : [2 * lightR(it), 2 * lightR(it)];&#10;    const a = it.type === 'image' ? (it.rot - 0.5) * 2 * Math.PI : 0, ca = Math.cos(a), sa = Math.sin(a);&#10;    return { w: w, h: h, a: a, rel: [[-1, -1], [1, -1], [1, 1], [-1, 1]].map(([u, v]) =&gt; { const x = u * w / 2, y = v * h / 2; return [x * ca - y * sa, x * sa + y * ca]; }) };&#10;}&#10;function copySize(it) { clip = shapeOf(it); }&#10;const turnOf = a =&gt; (((a / (2 * Math.PI) + 0.5) % 1) + 1) % 1;   // radians -&gt; an image's rot (0.5: not turned)&#10;function pasteSize(it) {   // as wide and high as the copied one, along its own sides, keeping its own turn and shape&#10;    if (it.type === 'light') { it.size = Math.sqrt(Math.max(0, (Math.max(clip.w, clip.h) / 2 - 6) / 250)); return; }&#10;    if (it.type === 'image') { it.w = Math.max(0.005, clip.w / (W * 2 * it.scale)); it.h = Math.max(0.005, clip.h / (H * 2 * it.scale)); return; }&#10;    const own = shapeOf(it), [cx, cy] = centre(it), kx = clip.w / Math.max(1, own.w), ky = clip.h / Math.max(1, own.h);&#10;    const ca = Math.cos(own.a), sa = Math.sin(own.a);&#10;    it.pts = it.pts.map(p =&gt; {&#10;        const dx = (p[0] - cx) * W, dy = (p[1] - cy) * H;&#10;        const u = (dx * ca + dy * sa) * kx, v = (-dx * sa + dy * ca) * ky;&#10;        return [clampN((cx * W + u * ca - v * sa) / W), clampN((cy * H + u * sa + v * ca) / H)];&#10;    });&#10;}&#10;function pasteShape(it) {   // the copied one's size, turn and shape, round this one's middle&#10;    const [cx, cy] = centre(it);&#10;    if (it.type === 'image') {&#10;        it.w = Math.max(0.005, clip.w / (W * 2 * it.scale)); it.h = Math.max(0.005, clip.h / (H * 2 * it.scale));&#10;        if (!tlOn(it, 'rot')) it.rot = turnOf(clip.a);&#10;    } else if (it.type !== 'light') {&#10;        it.pts = clip.rel.map(r =&gt; [clampN(cx + r[0] / W), clampN(cy + r[1] / H)]);&#10;        it.qa = clip.a;&#10;    }&#10;}&#10;&#10;// ---------- the right-click menu ----------&#10;let menu = null;   // { id, x, y } while it is open&#10;function openMenu(it, e) {&#10;    e.stop();&#10;    sure = false;&#10;    hexTyping = null;&#10;    if (state.sel !== it.id) { state.sel = it.id; sendCode(); }&#10;    menu = { id: it.id, x: e.x, y: e.y };&#10;    rebuild();&#10;}&#10;function drawMenu() {&#10;    const it = state.items.find(t =&gt; t.id === menu.id);&#10;    if (!it) { menu = null; return; }&#10;    const close = e =&gt; { e.stop(); menu = null; rebuild(); };&#10;    const shut = layer.rect({ x: 0, y: 0, w: W, h: H, fill: '#00000000', interactive: true });&#10;    shut.on('click', close);&#10;    shut.on('rightclick', close);&#10;    shut.on('wheel', close);&#10;    const board = it.type === 'board';&#10;    const sizeLocked = it.type === 'light' &amp;&amp; tlOn(it, 'size');&#10;    const sizes = [['Copy size', () =&gt; copySize(it)], ['Paste size', clip &amp;&amp; !sizeLocked ? () =&gt; pasteSize(it) : null]];&#10;    if (it.type !== 'light')&#10;        sizes.push(['Paste size and shape', clip ? () =&gt; pasteShape(it) : null]);&#10;    const L = [];&#10;    if (board)&#10;        L.push(...(it.pts.length === 4 ? [['Make square', () =&gt; squareUp(it, true)], ['Make rectangle', () =&gt; squareUp(it, false)], ['Straighten', () =&gt; straighten(it)]] :&#10;                   [['Back to 4 corners', () =&gt; { const q = boardQuad(it); it.pts = q.map(p =&gt; p.slice()); }]]), null);&#10;    if (it.type === 'mask')&#10;        L.push([it.invert ? 'Hide the effects inside' : 'Hide the effects outside', () =&gt; { it.invert = it.invert ? 0 : 1; }],&#10;               ['Mask all effects', it.all === false ? () =&gt; { it.all = true; } : null], null, ...sizes, null,&#10;               ['Duplicate', duplicate], ['Hide', () =&gt; { it.hidden = true; }], ['Lock', () =&gt; { it.locked = true; }], ['Delete', () =&gt; remove(it.id)]);&#10;    else {&#10;    if (it.type === 'image')&#10;        L.push(['Replace picture...', () =&gt; { wantImage = 'replace'; out(2); }], ['No turn', tlOn(it, 'rot') ? null : () =&gt; { it.rot = 0.5; }],&#10;               ['Fit / Fill', () =&gt; { it.fit = it.fit ? 0 : 1; }], null);&#10;    L.push(...sizes);&#10;    L.push(null, ['Duplicate', duplicate],&#10;           ['Bring to front', () =&gt; { state.items = state.items.filter(t =&gt; t !== it).concat([it]); }],&#10;           ['Send to back', () =&gt; { state.items = [it].concat(state.items.filter(t =&gt; t !== it)); }],&#10;           null, ['Hide', () =&gt; { it.hidden = true; }], ['Lock', () =&gt; { it.locked = true; }], ['Delete', () =&gt; remove(it.id)]);&#10;    }&#10;    const MW = 250, RH = 34, SH = 11;&#10;    const MH = 40 + L.reduce((a, r) =&gt; a + (r ? RH : SH), 0) + 8;&#10;    const g = layer.group({ x: Math.min(menu.x + 4, W - MW - 8), y: Math.max(8, Math.min(menu.y + 4, H - MH - 8)) });&#10;    g.rect({ w: MW, h: MH, radius: 8, fill: '#14121ff8', stroke: '#2f2850', strokeWidth: 1, interactive: true, shadow: { color: '#000000a0', y: 6, blur: 18 } });&#10;    g.text({ x: 16, y: 22, text: itemName(it), size: 16, baseline: 'middle', fill: ACC, interactive: false });&#10;    let y = 40;&#10;    for (const r of L) {&#10;        if (!r) { g.line({ x1: 12, y1: y + SH / 2, x2: MW - 12, y2: y + SH / 2, width: 1, stroke: '#2f2850', interactive: false }); y += SH; continue; }&#10;        const [name, fn] = r;&#10;        const row = g.group({ x: 4, y: y, cursor: fn ? 'pointer' : 'default' });&#10;        const bg = row.rect({ w: MW - 8, h: RH - 2, radius: 5, fill: '#00000000', interactive: true });&#10;        row.text({ x: 12, y: (RH - 2) / 2, text: name, size: 19, baseline: 'middle', interactive: false,&#10;                   fill: !fn ? '#5c5774' : name === 'Delete' ? '#ff6b7a' : '#f1ecff' });&#10;        if (fn) {&#10;            row.on('enter', () =&gt; bg.set({ fill: '#8a3fff40' }));&#10;            row.on('leave', () =&gt; bg.set({ fill: '#00000000' }));&#10;            row.on('click', e =&gt; { e.stop(); menu = null; fn(); sendCode(); rebuild(); });&#10;        } else&#10;            row.on('click', e =&gt; e.stop());&#10;        y += RH;&#10;    }&#10;}&#10;&#10;// ---------- pictures ----------&#10;// a picture is a box (w across, h down: shares of the Scene, times 2 x scale) round x, y, turned by rot (0.5: not turned);&#10;// the file sits in it whole (Fit) or fills it and is cut (Fill)&#10;const imgBox = (it, sc) =&gt; [it.w * W * 2 * sc, it.h * H * 2 * sc];&#10;function imageCorners(it) {   // the box's corners on the canvas&#10;    const [bw, bh] = imgBox(it, it.scale), a = (it.rot - 0.5) * 2 * Math.PI, ca = Math.cos(a), sa = Math.sin(a);&#10;    return [[-1, -1], [1, -1], [1, 1], [-1, 1]].map(([u, v]) =&gt; { const x = u * bw / 2, y = v * bh / 2;&#10;        return [X(it.x) + (x * ca - y * sa) * view.s, Y(it.y) + (x * sa + y * ca) * view.s]; });&#10;}&#10;let images = {}, imgLayer = null;   // the drawn pictures, by id&#10;function imageProps(it, t) {   // where and how a picture is drawn, at t seconds (its timeline) or as it is (t null)&#10;    const v = (k, still) =&gt; t === null ? still : tlAt(it, k, still, t);&#10;    const sc = v('scale', it.scale), [bw, bh] = imgBox(it, sc);&#10;    const cx = X(v('x', it.x)), cy = Y(v('y', it.y));&#10;    return { x: cx - bw * view.s / 2, y: cy - bh * view.s / 2, w: bw * view.s, h: bh * view.s, rotation: (v('rot', it.rot) - 0.5) * 360,&#10;             opacity: 1 - v('transp', it.transp || 0) };&#10;}&#10;function drawImages() {&#10;    images = {};&#10;    const g = imgLayer = layer.group(state.edit ? { clip: [view.x, view.y, W * view.s, H * view.s] } : {});&#10;    for (const it of state.items)&#10;        if (it.type === 'image' &amp;&amp; !it.hidden &amp;&amp; it.src)&#10;            images[it.id] = g.image(Object.assign({ src: it.src, fit: it.fit ? 'cover' : 'contain', interactive: false }, imageProps(it, time())));&#10;}&#10;function onTick() {   // the pictures' timelines&#10;    for (const it of state.items)&#10;        if (images[it.id] &amp;&amp; it.tl &amp;&amp; Object.values(it.tl.tracks).some(k =&gt; k.on))&#10;            images[it.id].set(imageProps(it, time()));&#10;}&#10;&#10;// ---------- drawing the editor ----------&#10;let layer = null, handles = null, picking = false;&#10;const clampN = v =&gt; Math.max(-0.5, Math.min(1.5, v));&#10;&#10;function rebuild() {&#10;    checkpoint();&#10;    if (layer)&#10;        layer.remove();&#10;    layer = c.group({});&#10;    handles = {};&#10;    fitView();&#10;    sendView();&#10;    drawImages();&#10;    if (state.edit) {&#10;        const bg = layer.rect({ x: 0, y: 0, w: W, h: H, fill: '#00000000', interactive: true, cursor: state.zoom &gt; 1 ? 'grab' : 'default' });&#10;        let panFrom = null, panned = false;&#10;        bg.on('click', () =&gt; { if (!panned &amp;&amp; state.sel) select(0); panned = false; });&#10;        bg.on('doubleclick', e =&gt; addLight(U(e.x), V(e.y)));&#10;        bg.on('press', () =&gt; { panFrom = [state.panX, state.panY]; panned = false; });&#10;        bg.on('drag', e =&gt; { if (!panFrom || state.zoom &lt;= 1) return; panned = true;&#10;            state.panX = panFrom[0] + e.totalX; state.panY = panFrom[1] + e.totalY; fitView(); sendView(); placeAll(); });&#10;        bg.on('wheel', e =&gt; zoomAt(e.x, e.y, e.delta &gt; 0 ? 1.15 : 1 / 1.15));&#10;        for (const it of state.items)&#10;            if (!it.hidden)&#10;                drawHandles(it);&#10;        drawToolbar();&#10;        drawDock();&#10;        if (state.tlOpen)&#10;            drawTimeline();&#10;        else if (state.auOpen)&#10;            drawAudio();&#10;        if (menu)&#10;            drawMenu();&#10;        if (help)&#10;            drawHelp();&#10;        if (picking) {&#10;            const sheet = layer.rect({ x: 0, y: 0, w: W, h: H, fill: '#00000000', cursor: 'crosshair', interactive: true,&#10;                                       tooltip: 'Click the colour to light up' });&#10;            sheet.on('move', e =&gt; sendAids([U(e.x), V(e.y)]));&#10;            sheet.on('click', e =&gt; { e.stop(); const it = selected(); picking = false;&#10;                if (it) { it.kx = U(e.x); it.ky = V(e.y); } sendAids(null); sendCode(); rebuild(); });&#10;            sheet.on('rightclick', e =&gt; { e.stop(); picking = false; sendAids(null); rebuild(); });&#10;        }&#10;    } else {&#10;        const bg = layer.rect({ x: 0, y: 0, w: W, h: H, fill: '#00000000', interactive: true });&#10;        bg.on('doubleclick', () =&gt; setEdit(true));&#10;    }&#10;}&#10;&#10;function boardPoints(it) {&#10;    return it.pts.map(p =&gt; [X(p[0]), Y(p[1])]);&#10;}&#10;&#10;function drawHandles(it) {&#10;    const sel = it.id === state.sel;&#10;    const col = sel ? ACC : '#ffffffaa';&#10;    if (it.locked) {   // on lock: only its outline, which the mouse goes through&#10;        handles[it.id] = { outline: it.type !== 'light' ?&#10;            layer.polygon({ x: 0, y: 0, points: it.type === 'image' ? imageCorners(it) : boardPoints(it), fill: '#00000000', stroke: col, strokeWidth: 1, opacity: 0.4, interactive: false }) :&#10;            layer.circle({ x: X(it.x), y: Y(it.y), r: 6, fill: '#00000000', stroke: col, strokeWidth: 1.5, opacity: 0.5, interactive: false }) };&#10;        return;&#10;    }&#10;    if (it.type === 'mask') {&#10;        const h = {}, MC = sel ? '#ff4f8b' : '#ff4f8baa';&#10;        h.poly = layer.polygon({ x: 0, y: 0, points: boardPoints(it), fill: it.invert ? (sel ? '#ff4f8b10' : '#ff4f8b08') : sel ? '#ff4f8b30' : '#ff4f8b18', interactive: true,   // a little colour even outside: a clear fill lets the mouse through stroke: MC, strokeWidth: sel ? 2.5 : 1.5,&#10;                                 cursor: 'move', tooltip: 'Mask - drag: move - double-click the edge: a point more - wheel: size - Shift + wheel: turn - right-click: options' });&#10;        h.poly.on('press', () =&gt; { pick(it.id); dragFrom = keep(it); });&#10;        h.poly.on('drag', e =&gt; { const cur = selected(); if (!cur || !dragFrom) return;&#10;            const moved = dragFrom.pts.map(p =&gt; [p[0] + DU(e.totalX), p[1] + DV(e.totalY)]);&#10;            const [sx, sy] = snapDelta(moved, cur.id, e.alt);&#10;            cur.pts = moved.map(p =&gt; [clampN(p[0] + sx), clampN(p[1] + sy)]); moveHandles(cur); });&#10;        h.poly.on('wheel', e =&gt; { if (it.id !== state.sel) select(it.id); const cur = selected(); wheelStep();&#10;            if (e.shift) transform(cur, 1, e.delta &gt; 0 ? 2 : -2); else transform(cur, e.delta &gt; 0 ? 1.04 : 1 / 1.04, 0);&#10;            moveHandles(cur); e.stop(); });&#10;        h.poly.on('doubleclick', e =&gt; { e.stop(); addMaskPoint(it, U(e.x), V(e.y)); });&#10;        h.poly.on('rightclick', e =&gt; openMenu(it, e));&#10;        h.name = layer.text({ x: X(it.pts[0][0]), y: Y(it.pts[0][1]) - 12, text: it.invert ? 'Mask (outside)' : 'Mask', size: 22, fill: sel ? '#ff7aa8' : '#ffb3cc',&#10;                              baseline: 'bottom', align: 'center', interactive: false, shadow: '#000000' });&#10;        h.dots = it.pts.map((p, i) =&gt; {&#10;            const d = layer.circle({ x: X(p[0]), y: Y(p[1]), r: sel ? 9 : 6, fill: sel ? '#ff4f8b' : '#ffffff60', stroke: '#000000', strokeWidth: 1.5,&#10;                                     cursor: 'crosshair', tooltip: 'Drag this point - right-click: take it away' });&#10;            d.on('press', () =&gt; { pick(it.id); });&#10;            d.on('drag', e =&gt; { const cur = selected(); if (!cur) return;&#10;                const [sx, sy] = snapDelta([[U(e.x), V(e.y)]], cur.id, e.alt);&#10;                cur.pts[i] = [clampN(U(e.x) + sx), clampN(V(e.y) + sy)]; moveHandles(cur); sendAids(cur.pts[i]); });&#10;            d.on('rightclick', e =&gt; { e.stop(); if (it.pts.length &gt; 3) { it.pts.splice(i, 1); sendCode(); rebuild(); } });&#10;            return d;&#10;        });&#10;        handles[it.id] = h;&#10;    } else if (it.type === 'image') {&#10;        const h = {};&#10;        h.poly = layer.polygon({ x: 0, y: 0, points: imageCorners(it), fill: sel ? '#8a3fff14' : '#ffffff05', stroke: col, strokeWidth: sel ? 2.5 : 1.5,&#10;                                 cursor: 'move', tooltip: 'Picture - drag: move - wheel: bigger/smaller - Shift + wheel: turn - right-click: options' });&#10;        h.poly.on('press', () =&gt; { pick(it.id); dragFrom = keep(it); });&#10;        h.poly.on('drag', e =&gt; { const cur = selected(); if (!cur || !dragFrom || tlOn(cur, 'x') || tlOn(cur, 'y')) return;&#10;            const p = [dragFrom.x + DU(e.totalX), dragFrom.y + DV(e.totalY)];&#10;            const [sx, sy] = snapDelta([p], cur.id, e.alt);&#10;            cur.x = clampN(p[0] + sx); cur.y = clampN(p[1] + sy); moveHandles(cur); });&#10;        h.poly.on('wheel', e =&gt; { if (it.id !== state.sel) select(it.id); const cur = selected(); e.stop();&#10;            if (tlOn(cur, e.shift ? 'rot' : 'scale')) return;&#10;            wheelStep();&#10;            if (e.shift) cur.rot = ((cur.rot + (e.delta &gt; 0 ? 1 : -1) / 180) % 1 + 1) % 1;&#10;            else cur.scale = Math.max(0.01, Math.min(1, cur.scale * (e.delta &gt; 0 ? 1.04 : 1 / 1.04)));&#10;            moveHandles(cur); refreshSliders(); });&#10;        h.poly.on('rightclick', e =&gt; openMenu(it, e));&#10;        const c0 = imageCorners(it)[0];&#10;        h.name = layer.text({ x: c0[0], y: c0[1] - 8, text: fileName(it.src), size: 22, fill: sel ? NAMESEL : '#ffffff', baseline: 'bottom', interactive: false, shadow: '#000000' });&#10;        h.dots = imageCorners(it).map(p =&gt; {   // a corner: the box wider or narrower, higher or lower, round its middle&#10;            const d = layer.circle({ x: p[0], y: p[1], r: sel ? 10 : 6, fill: sel ? ACC : '#ffffff60', stroke: '#000000', strokeWidth: 1.5, cursor: 'crosshair',&#10;                                     tooltip: 'Drag: the box wider or higher (Ctrl: keep its shape)' });&#10;            d.on('press', () =&gt; { pick(it.id); dragFrom = Object.assign(keep(it), { w: it.w, h: it.h }); });&#10;            d.on('drag', e =&gt; { const cur = selected(); if (!cur || !dragFrom) return;&#10;                const a = (cur.rot - 0.5) * 2 * Math.PI, dx = (e.x - X(cur.x)) / view.s, dy = (e.y - Y(cur.y)) / view.s;&#10;                const u = Math.abs(dx * Math.cos(a) + dy * Math.sin(a)), v = Math.abs(-dx * Math.sin(a) + dy * Math.cos(a));&#10;                if (e.ctrl) { const k = Math.max(u / (dragFrom.w * W * cur.scale), v / (dragFrom.h * H * cur.scale));&#10;                    cur.w = Math.max(0.005, dragFrom.w * k); cur.h = Math.max(0.005, dragFrom.h * k); }&#10;                else { cur.w = Math.max(0.005, u / (W * cur.scale)); cur.h = Math.max(0.005, v / (H * cur.scale)); }&#10;                moveHandles(cur); });&#10;            return d;&#10;        });&#10;        handles[it.id] = h;&#10;    } else if (it.type === 'board') {&#10;        const h = {};&#10;        h.poly = layer.polygon({ x: 0, y: 0, points: boardPoints(it), fill: sel ? '#8a3fff1c' : '#ffffff08',&#10;                                 stroke: col, strokeWidth: sel ? 2.5 : 1.5, cursor: 'move',&#10;                                 tooltip: 'Drag: move - wheel: bigger/smaller - Shift + wheel: rotate - right-click: options' });&#10;        h.poly.on('press', () =&gt; { pick(it.id); dragFrom = keep(it); });&#10;        h.poly.on('drag', e =&gt; { const cur = selected(); if (!cur || !dragFrom) return;&#10;            const moved = dragFrom.pts.map(p =&gt; [p[0] + DU(e.totalX), p[1] + DV(e.totalY)]);&#10;            const [sx, sy] = snapDelta(moved, cur.id, e.alt);&#10;            cur.pts = moved.map(p =&gt; [clampN(p[0] + sx), clampN(p[1] + sy)]); moveHandles(cur); });&#10;        h.poly.on('wheel', e =&gt; { if (it.id !== state.sel) select(it.id); const cur = selected(); wheelStep();&#10;            if (e.shift) transform(cur, 1, e.delta &gt; 0 ? 2 : -2); else transform(cur, e.delta &gt; 0 ? 1.04 : 1 / 1.04, 0);&#10;            moveHandles(cur); e.stop(); });&#10;        h.poly.on('rightclick', e =&gt; openMenu(it, e));&#10;        h.poly.on('doubleclick', e =&gt; { e.stop(); addMaskPoint(it, U(e.x), V(e.y)); });&#10;        h.name = layer.text({ x: X(it.pts[0][0]), y: Y(it.pts[0][1]) - 8, text: FX[it.fx], size: 22, fill: sel ? NAMESEL : '#ffffff',&#10;                              baseline: 'bottom', interactive: false, shadow: '#000000' });&#10;        h.dots = it.pts.map((p, i) =&gt; {&#10;            const d = layer.circle({ x: X(p[0]), y: Y(p[1]), r: sel ? 11 : 7, fill: sel ? ACC : '#ffffff60',&#10;                                     stroke: '#000000', strokeWidth: 1.5, cursor: 'crosshair',&#10;                                     tooltip: 'Drag this point - double-click the edge: a point more - right-click: take it away' });&#10;            d.on('rightclick', e =&gt; { e.stop(); if (it.pts.length &gt; 3) { if (it.pts.length === 4) it.qa = frameOf(it).a; it.pts.splice(i, 1); sendCode(); rebuild(); } });&#10;            d.on('press', () =&gt; { pick(it.id); dragFrom = keep(it); });&#10;            d.on('drag', e =&gt; { const cur = selected(); if (!cur || !dragFrom) return;&#10;                const [sx, sy] = snapDelta([[U(e.x), V(e.y)]], cur.id, e.alt);&#10;                const to = [clampN(U(e.x) + sx), clampN(V(e.y) + sy)];&#10;                if (cur.pts.length === 4 &amp;&amp; !!cur.scaleCorners !== !!e.ctrl) {&#10;                    // scale the whole board from the opposite corner, as far as the corner has moved along its diagonal (in pixels)&#10;                    const a = dragFrom.pts[(i + 2) % 4], o = dragFrom.pts[i];&#10;                    const vx = (o[0] - a[0]) * W, vy = (o[1] - a[1]) * H, ux = (to[0] - a[0]) * W, uy = (to[1] - a[1]) * H;&#10;                    const k = Math.max(0.05, (ux * vx + uy * vy) / Math.max(1e-6, vx * vx + vy * vy));&#10;                    cur.pts = dragFrom.pts.map(p =&gt; [clampN(a[0] + (p[0] - a[0]) * k), clampN(a[1] + (p[1] - a[1]) * k)]);&#10;                } else&#10;                    cur.pts[i] = to;&#10;                moveHandles(cur); sendAids(cur.pts[i]); });&#10;            return d;&#10;        });&#10;        handles[it.id] = h;&#10;    } else {&#10;        const h = {};&#10;        const r = (6 + 250 * it.size * it.size) * view.s;&#10;        h.ring = layer.circle({ x: X(it.x), y: Y(it.y), r: r, fill: '#00000000', stroke: col + (sel ? '' : ''), strokeWidth: 1, opacity: 0.5, interactive: false });&#10;        h.dot = layer.circle({ x: X(it.x), y: Y(it.y), r: sel ? 12 : 8, fill: sel ? ACC : '#ffffff60', stroke: '#000000', strokeWidth: 1.5,&#10;                               cursor: 'move', tooltip: 'Light - drag: move - wheel: size - right-click: options' });&#10;        h.dot.on('press', () =&gt; { pick(it.id); dragFrom = keep(it); });&#10;        h.dot.on('drag', e =&gt; { const cur = selected(); if (!cur || !dragFrom || tlOn(cur, 'x') || tlOn(cur, 'y')) return;&#10;            const p = [dragFrom.x + DU(e.totalX), dragFrom.y + DV(e.totalY)];&#10;            const [sx, sy] = snapDelta([p], cur.id, e.alt);&#10;            cur.x = clampN(p[0] + sx); cur.y = clampN(p[1] + sy); moveHandles(cur); sendAids([cur.x, cur.y]); });&#10;        h.dot.on('wheel', e =&gt; { if (it.id !== state.sel) select(it.id); const cur = selected(); if (tlOn(cur, 'size')) { e.stop(); return; } wheelStep();&#10;            cur.size = Math.max(0, Math.min(1, cur.size + (e.delta &gt; 0 ? 0.02 : -0.02))); moveHandles(cur); refreshSliders(); e.stop(); });&#10;        h.dot.on('rightclick', e =&gt; openMenu(it, e));&#10;        handles[it.id] = h;&#10;    }&#10;}&#10;&#10;// a drag or a wheel moved the selected element: move its handles and send its P, with no new drawing or shader&#10;function moveHandles(it) {&#10;    place(it);&#10;    sendP();&#10;}&#10;function place(it) {   // put an element's handles where it is on the canvas now&#10;    const h = handles[it.id];&#10;    if (images[it.id])&#10;        images[it.id].set(imageProps(it, it.tl &amp;&amp; Object.values(it.tl.tracks).some(k =&gt; k.on) ? time() : null));&#10;    if (h &amp;&amp; h.outline)   // a locked one: only its outline&#10;        h.outline.set(it.type === 'light' ? { x: X(it.x), y: Y(it.y) } : { points: it.type === 'image' ? imageCorners(it) : boardPoints(it) });&#10;    else if (h &amp;&amp; it.type === 'mask') {&#10;        h.poly.set({ points: boardPoints(it) });&#10;        h.dots.forEach((d, i) =&gt; d.set({ x: X(it.pts[i][0]), y: Y(it.pts[i][1]) }));&#10;        h.name.set({ x: X(it.pts[0][0]), y: Y(it.pts[0][1]) - 12 });&#10;        tlDirty = true;   // its shape is in the shader: a new one once the mouse lets go&#10;    } else if (h &amp;&amp; it.type === 'image') {&#10;        const P = imageCorners(it);&#10;        h.poly.set({ points: P });&#10;        h.dots.forEach((d, i) =&gt; d.set({ x: P[i][0], y: P[i][1] }));&#10;        h.name.set({ x: P[0][0], y: P[0][1] - 8 });&#10;    } else if (h &amp;&amp; it.type === 'board') {&#10;        h.poly.set({ points: boardPoints(it) });&#10;        h.dots.forEach((d, i) =&gt; d.set({ x: X(it.pts[i][0]), y: Y(it.pts[i][1]) }));&#10;        h.name.set({ x: X(it.pts[0][0]), y: Y(it.pts[0][1]) - 8 });&#10;        if (it.pts.length !== 4)&#10;            tlDirty = true;   // its shape is in the shader: a new one once the mouse lets go&#10;    } else if (h) {&#10;        h.dot.set({ x: X(it.x), y: Y(it.y) });&#10;        h.ring.set({ x: X(it.x), y: Y(it.y), r: (6 + 250 * it.size * it.size) * view.s });&#10;    }&#10;}&#10;function placeAll() {   // the view moved: every handle follows, and the pictures' window with it&#10;    if (imgLayer &amp;&amp; state.edit)&#10;        imgLayer.set({ clip: [view.x, view.y, W * view.s, H * view.s] });&#10;    state.items.forEach(place);&#10;}&#10;&#10;// ---------- the Layers panel ----------&#10;const fileName = p =&gt; String(p || '').split(/[\\/]/).pop();&#10;const itemName = it =&gt; it.type === 'image' ? 'Image ' + it.id + ' - ' + fileName(it.src) : it.type === 'mask' ? 'Mask ' + it.id + (it.all === false ? ' - some effects' : ' - all effects') :&#10;    (it.type === 'board' ? 'Board ' : 'Light ') + it.id + ' - ' + (it.type === 'board' ? FX[it.fx] : MODES[it.mode]);&#10;&#10;function moveItem(it, d) {   // d +1: one to the front (drawn later), -1: one to the back&#10;    const a = state.items, i = a.indexOf(it), j = i + d;&#10;    if (j &lt; 0 || j &gt;= a.length)&#10;        return;&#10;    a[i] = a[j]; a[j] = it;&#10;    sendCode();&#10;    rebuild();&#10;}&#10;&#10;function eye(g, x, y, on) {&#10;    const col = on ? '#f1ecff' : '#5c5774';&#10;    g.circle({ x: x, y: y, rx: 9, ry: 5.5, fill: '#00000000', stroke: col, strokeWidth: 1.5, interactive: false });&#10;    g.circle({ x: x, y: y, r: 2.5, fill: col, interactive: false });&#10;    if (!on)&#10;        g.line({ x1: x - 9, y1: y + 7, x2: x + 9, y2: y - 7, width: 1.5, stroke: col, interactive: false });&#10;}&#10;&#10;function padlock(g, x, y, on) {&#10;    const col = on ? ACC : '#5c5774';&#10;    g.arc({ x: on ? x : x + 4, y: y - 3, r: 4.5, width: 1.8, start: -90, end: 90, stroke: col, interactive: false });&#10;    g.rect({ x: x - 6, y: y - 2, w: 12, h: 9, radius: 2, fill: col, interactive: false });&#10;}&#10;&#10;const LROWS = 12;&#10;function drawLayers(g, y, LW) {   // the list of elements, in the dock under Properties; returns where it ends&#10;    const RH = 30;&#10;    const list = state.items.slice().reverse();   // the front first&#10;    state.lscroll = Math.max(0, Math.min(state.lscroll || 0, list.length - LROWS));&#10;    if (!list.length) {&#10;        g.text({ x: 16, y: y + 10, text: 'Nothing yet: add a board or a light (toolbar).', size: 18, baseline: 'middle', fill: '#aaa4c6', interactive: false });&#10;        y += 30;&#10;    }&#10;    list.slice(state.lscroll, state.lscroll + LROWS).forEach(it =&gt; {&#10;        const sel = it.id === state.sel;&#10;        const row = g.group({ x: 8, y: y });&#10;        const rb = row.rect({ w: LW - 16, h: RH - 4, radius: 6, fill: sel ? '#8a3fff38' : '#00000000', stroke: sel ? ACC : '#00000000', strokeWidth: 1, cursor: 'pointer', tooltip: 'Select' });&#10;        rb.on('click', e =&gt; { e.stop(); select(it.id); });&#10;        rb.on('wheel', e =&gt; { e.stop(); state.lscroll += e.delta &gt; 0 ? -1 : 1; rebuild(); });&#10;        const eb = row.rect({ x: 2, y: 0, w: 28, h: RH - 4, fill: '#00000000', cursor: 'pointer', tooltip: it.hidden ? 'Show' : 'Hide' });&#10;        eb.on('click', e =&gt; { e.stop(); it.hidden = !it.hidden; sendCode(); rebuild(); });&#10;        eye(row, 16, (RH - 4) / 2, !it.hidden);&#10;        row.text({ x: 38, y: (RH - 4) / 2, text: itemName(it), size: 19, baseline: 'middle', fill: it.hidden ? '#7f7a99' : sel ? NAMESEL : '#ffffff', interactive: false });&#10;        const lb = row.rect({ x: LW - 100, y: 0, w: 28, h: RH - 4, fill: '#00000000', cursor: 'pointer', tooltip: it.locked ? 'Unlock' : 'Lock' });&#10;        lb.on('click', e =&gt; { e.stop(); it.locked = !it.locked; rebuild(); });&#10;        padlock(row, LW - 86, (RH - 4) / 2, !!it.locked);&#10;        const up = row.triangle({ x1: LW - 60, y1: 18, x2: LW - 48, y2: 18, x3: LW - 54, y3: 8, fill: '#b8b2d0', cursor: 'pointer', tooltip: 'Bring forward' });&#10;        up.on('click', e =&gt; { e.stop(); moveItem(it, 1); });&#10;        const dn = row.triangle({ x1: LW - 40, y1: 8, x2: LW - 28, y2: 8, x3: LW - 34, y3: 18, fill: '#b8b2d0', cursor: 'pointer', tooltip: 'Send backward' });&#10;        dn.on('click', e =&gt; { e.stop(); moveItem(it, -1); });&#10;        y += RH;&#10;    });&#10;    if (list.length &gt; LROWS) {&#10;        g.text({ x: 16, y: y + 8, text: (state.lscroll + 1) + '-' + Math.min(list.length, state.lscroll + LROWS) + ' of ' + list.length + ' - scroll for more',&#10;                 size: 14, baseline: 'middle', fill: '#5c5774', interactive: false });&#10;        y += 20;&#10;    }&#10;    return y + 6;&#10;}&#10;&#10;// ---------- the toolbar: down the left side, as in Photoshop ----------&#10;const TW = 64;&#10;function icon(g, kind, col) {   // a small picture of what a tool does, drawn round (24, 20)&#10;    const o = { interactive: false };&#10;    const line = (x1, y1, x2, y2) =&gt; g.line(Object.assign({ x1: x1, y1: y1, x2: x2, y2: y2, width: 2, stroke: col }, o));&#10;    const plus = () =&gt; { line(39, 5, 39, 15); line(34, 10, 44, 10); };&#10;    if (kind === 'board') {&#10;        g.polygon(Object.assign({ points: [[12, 12], [32, 9], [33, 30], [11, 27]], fill: '#00000000', stroke: col, strokeWidth: 2 }, o));&#10;        plus();&#10;    } else if (kind === 'light') {&#10;        g.circle(Object.assign({ x: 21, y: 21, r: 5, fill: col }, o));&#10;        g.circle(Object.assign({ x: 21, y: 21, r: 10, fill: '#00000000', stroke: col, strokeWidth: 1.5 }, o));&#10;        plus();&#10;    } else if (kind === 'copy') {&#10;        g.rect(Object.assign({ x: 12, y: 8, w: 15, h: 17, radius: 2, fill: '#00000000', stroke: col, strokeWidth: 2 }, o));&#10;        g.rect(Object.assign({ x: 20, y: 14, w: 15, h: 17, radius: 2, fill: '#14121f', stroke: col, strokeWidth: 2 }, o));&#10;    } else if (kind === 'delete') {&#10;        g.rect(Object.assign({ x: 16, y: 13, w: 16, h: 19, radius: 2, fill: '#00000000', stroke: col, strokeWidth: 2 }, o));&#10;        line(12, 11, 36, 11); line(21, 7, 27, 7);&#10;    } else if (kind === 'mask') {   // a shape, half of it blocked&#10;        g.polygon(Object.assign({ points: [[10, 20], [17, 9], [31, 9], [37, 20], [31, 31], [17, 31]], fill: '#00000000', stroke: col, strokeWidth: 2 }, o));&#10;        g.polygon(Object.assign({ points: [[24, 9], [31, 9], [37, 20], [31, 31], [24, 31]], fill: col }, o));&#10;    } else if (kind === 'image') {   // a small picture with a plus&#10;        g.rect(Object.assign({ x: 10, y: 12, w: 22, h: 18, radius: 2, fill: '#00000000', stroke: col, strokeWidth: 2 }, o));&#10;        g.triangle(Object.assign({ x1: 13, y1: 28, x2: 20, y2: 18, x3: 27, y3: 28, fill: col }, o));&#10;        plus();&#10;    } else if (kind === 'picture') {&#10;        g.rect(Object.assign({ x: 11, y: 9, w: 26, h: 22, radius: 2, fill: '#00000000', stroke: col, strokeWidth: 2 }, o));&#10;        g.triangle(Object.assign({ x1: 14, y1: 29, x2: 22, y2: 17, x3: 30, y3: 29, fill: col }, o));&#10;        g.circle(Object.assign({ x: 31, y: 15, r: 2.5, fill: col }, o));&#10;    } else if (kind === 'edges') {&#10;        g.rect(Object.assign({ x: 10, y: 10, w: 13, h: 19, fill: '#00000000', stroke: '#40ff73', strokeWidth: 2 }, o));&#10;        g.circle(Object.assign({ x: 31, y: 20, r: 7, fill: '#00000000', stroke: '#ff59d9', strokeWidth: 2 }, o));&#10;    } else if (kind === 'snap') {   // a magnet&#10;        g.arc(Object.assign({ x: 24, y: 17, r: 8, width: 5, start: 90, end: 270, stroke: col }, o));&#10;        g.rect(Object.assign({ x: 13.5, y: 22, w: 5, h: 7, fill: '#ff5a5a' }, o));&#10;        g.rect(Object.assign({ x: 29.5, y: 22, w: 5, h: 7, fill: '#ff5a5a' }, o));&#10;    } else if (kind === 'clear') {&#10;        line(15, 10, 33, 28); line(33, 10, 15, 28);&#10;    } else if (kind === 'help') {   // a question mark in a ring&#10;        g.circle(Object.assign({ x: 24, y: 20, r: 12, fill: '#00000000', stroke: col, strokeWidth: 2 }, o));&#10;        g.text(Object.assign({ x: 24, y: 21, text: '?', size: 18, align: 'center', baseline: 'middle', fill: col }, o));&#10;    } else if (kind === 'panels') {&#10;        g.rect(Object.assign({ x: 11, y: 9, w: 26, h: 22, radius: 2, fill: '#00000000', stroke: col, strokeWidth: 2 }, o));&#10;        g.rect(Object.assign({ x: 27, y: 9, w: 10, h: 22, fill: col }, o));&#10;    } else if (kind === 'audio') {   // bars of a spectrum&#10;        [[12, 8], [18, 16], [24, 4], [30, 12], [36, 20]].forEach(([x, h]) =&gt; g.rect(Object.assign({ x: x - 2, y: 32 - (28 - h), w: 4, h: 28 - h, radius: 1, fill: col }, o)));&#10;    } else if (kind === 'timeline') {   // a line with keys on it&#10;        line(9, 30, 19, 14); line(19, 14, 29, 24); line(29, 24, 39, 10);&#10;        [[19, 14], [29, 24]].forEach(([x, y]) =&gt; g.rect(Object.assign({ x: x - 3, y: y - 3, w: 6, h: 6, fill: col }, o)));&#10;    } else if (kind === 'fit') {   // a frame with its corners&#10;        line(11, 9, 18, 9); line(11, 9, 11, 15); line(37, 9, 30, 9); line(37, 9, 37, 15);&#10;        line(11, 31, 18, 31); line(11, 31, 11, 25); line(37, 31, 30, 31); line(37, 31, 37, 25);&#10;        g.circle(Object.assign({ x: 24, y: 20, r: 4, fill: col }, o));&#10;    } else if (kind.startsWith('undo') || kind.startsWith('redo')) {   // a curved arrow, back or forth (grey with nothing to do)&#10;        const c2 = kind.endsWith('0') ? '#5c5774' : col, back = kind.startsWith('undo');&#10;        g.arc(Object.assign({ x: 24, y: 20, r: 9, width: 2, start: back ? 0 : 180, end: back ? 180 : 360, stroke: c2 }, o));&#10;        g.line(Object.assign({ x1: 24, y1: 29, x2: back ? 17 : 31, y2: 29, width: 2, stroke: c2 }, o));&#10;        g.triangle(Object.assign(back ? { x1: 25, y1: 6, x2: 25, y2: 16, x3: 18, y3: 11 } : { x1: 23, y1: 6, x2: 23, y2: 16, x3: 30, y3: 11 }, { fill: c2 }, o));&#10;    } else if (kind === 'done') {&#10;        line(14, 19, 21, 26); line(21, 26, 34, 11);&#10;    }&#10;}&#10;&#10;function tool(g, y, kind, label, tip, fn, on, accent) {&#10;    const b = g.group({ x: 8, y: y, cursor: 'pointer', tooltip: tip });&#10;    const bg = b.rect({ w: 48, h: 50, radius: 8, fill: accent ? ACC : on ? '#8a3fff40' : '#00000000', stroke: on ? ACC : '#00000000', strokeWidth: 1 });&#10;    const col = accent ? '#ffffff' : on ? '#b98cff' : '#f1ecff';&#10;    icon(b, kind, col);&#10;    b.text({ x: 24, y: 42, text: label, size: 14, align: 'center', baseline: 'middle', fill: col, interactive: false });&#10;    b.on('enter', () =&gt; { if (!on &amp;&amp; !accent) bg.set({ fill: '#ffffff14' }); });&#10;    b.on('leave', () =&gt; { if (!on &amp;&amp; !accent) bg.set({ fill: '#00000000' }); });&#10;    b.on('click', e =&gt; { e.stop(); fn(); });&#10;    return y + 56;&#10;}&#10;&#10;function drawToolbar() {&#10;    const g = layer.group({ x: 0, y: 0 });&#10;    g.rect({ w: TW, h: H, fill: '#14121ff4', stroke: '#2f2850', strokeWidth: 1, interactive: true });&#10;    g.text({ x: TW / 2, y: 20, text: 'CN', size: 19, align: 'center', baseline: 'middle', fill: ACC, interactive: false });&#10;    const sep = y =&gt; { g.line({ x1: 12, y1: y + 2, x2: TW - 12, y2: y + 2, width: 1, stroke: '#2f2850', interactive: false }); return y + 10; };&#10;    let y = 40;&#10;    y = tool(g, y, 'board', 'Board', 'Add a board (a sign or a screen with an effect)', () =&gt; addBoard(0.5, 0.5));&#10;    y = tool(g, y, 'image', 'Image', 'Add a picture as a layer, over the effects (PNG with see-through parts works)', () =&gt; { wantImage = true; out(2); });&#10;    y = tool(g, y, 'mask', 'Mask', 'Add a mask: the effects do not show inside it', () =&gt; addMask(0.5, 0.5));&#10;    y = tool(g, y, 'light', 'Light', 'Add a light (double-clicking the picture does too)', () =&gt; addLight(0.5, 0.5));&#10;    y = tool(g, y, 'copy', 'Copy', 'Copy the selected element', duplicate);&#10;    y = tool(g, y, 'delete', 'Delete', 'Delete the selected element (or right-click it: Delete)', () =&gt; { if (state.sel) remove(state.sel); });&#10;    y = tool(g, y, past.length ? 'undo' : 'undo0', 'Undo', past.length ? 'Undo the last change' : 'Nothing to undo', undo);&#10;    y = tool(g, y, future.length ? 'redo' : 'redo0', 'Redo', future.length ? 'Redo what Undo took back' : 'Nothing to redo', redo);&#10;    y = sep(y);&#10;    y = tool(g, y, 'picture', 'Picture', 'Choose a background picture', () =&gt; out(2));&#10;    if (state.bg)&#10;        y = tool(g, y, 'edges', 'Edges', 'Show the edges in the picture (set them up in Properties)', () =&gt; { state.edges = !state.edges; sendAids(null); rebuild(); }, state.edges);&#10;    y = tool(g, y, 'fit', state.zoom &gt; 1 ? Math.round(state.zoom * 100) + '%' : 'Fit', 'Show the whole picture (wheel on an empty spot zooms, dragging it moves the picture)',&#10;             () =&gt; { state.zoom = 1; state.panX = 0; state.panY = 0; rebuild(); }, state.zoom &gt; 1);&#10;    y = tool(g, y, 'timeline', 'Timeline', 'Animate the selected element in a loop: its Transparency, colour and the rest', () =&gt; { state.tlOpen = !state.tlOpen; state.auOpen = false; rebuild(); }, state.tlOpen);&#10;    y = tool(g, y, 'audio', 'Audio', 'Let the selected element follow the sound on In A, or the beat of your DAW', () =&gt; { state.auOpen = !state.auOpen; state.tlOpen = false; rebuild(); }, state.auOpen);&#10;    y = tool(g, y, 'snap', 'Snap', 'Snap to the other elements and the sides (Alt while dragging: no snap)', () =&gt; { state.snap = !state.snap; rebuild(); }, state.snap);&#10;    y = sep(y);&#10;    tool(g, y, 'clear', sure ? 'Sure?' : 'Clear', sure ? 'Click again: everything not locked goes' : 'Delete everything that is not locked', () =&gt; {&#10;        if (!sure) { sure = true; rebuild(); return; }&#10;        sure = false; state.items = state.items.filter(t =&gt; t.locked); state.sel = 0; sendCode(); rebuild(); }, sure);&#10;    tool(g, H - 178, 'help', 'Help', 'How Cinemnode works', () =&gt; { help = help ? null : { tab: 0, screen: 0 }; rebuild(); }, !!help);&#10;    tool(g, H - 120, 'panels', 'Panels', state.dock ? 'Hide the panels' : 'Show the panels', () =&gt; { state.dock = !state.dock; rebuild(); }, state.dock);&#10;    tool(g, H - 62, 'done', 'Done', 'Leave edit mode (double-click the Scene to come back)', () =&gt; setEdit(false), false, true);&#10;}&#10;&#10;// ---------- the panel ----------&#10;let sliders = [];&#10;&#10;function button(g, x, y, w, label, fn, on) {&#10;    const b = g.group({ x: x, y: y, cursor: 'pointer' });&#10;    const bg = b.rect({ w: w, h: 30, radius: 6, fill: on ? ACC : '#1a1628', stroke: on ? ACC : '#2f2850', strokeWidth: 1 });&#10;    b.text({ x: w / 2, y: 15, text: label, size: 18, align: 'center', baseline: 'middle', fill: on ? '#ffffff' : '#f1ecff', interactive: false });&#10;    b.on('enter', () =&gt; { if (!on) bg.set({ stroke: ACC }); });&#10;    b.on('leave', () =&gt; { if (!on) bg.set({ stroke: '#2f2850' }); });&#10;    b.on('click', e =&gt; { e.stop(); fn(); });&#10;    return b;&#10;}&#10;&#10;function chips(g, x, y, w, names, cur, fn) {&#10;    let cx = x, cy = y;&#10;    names.forEach((n, i) =&gt; {&#10;        const bw = Math.max(54, n.length * 8.2 + 20);&#10;        if (cx + bw &gt; x + w) { cx = x; cy += 36; }&#10;        button(g, cx, cy, bw, n, () =&gt; fn(i), i === cur);&#10;        cx += bw + 6;&#10;    });&#10;    return cy + 36;&#10;}&#10;&#10;function swatches(g, x, y, it) {&#10;    if (tlOn(it, 'r') || tlOn(it, 'g') || tlOn(it, 'b'))   // the timeline animates the colour: no swatches or sliders&#10;        return lockedRow(g, x, y, 'Colour', 'animated on the timeline (' + ['r', 'g', 'b'].filter(k =&gt; tlOn(it, k)).map(k =&gt; ({ r: 'Red', g: 'Green', b: 'Blue' })[k]).join(', ') + ')') + 4;&#10;    const cur = hexOf(it).toLowerCase();&#10;    const set = hex =&gt; { it.hex = hex; sendCode(); rebuild(); };&#10;    const all = COLORS.map(([n, hex]) =&gt; [n, hex, false]).concat(state.palette.map(hex =&gt; [hex + ' - right-click forgets it', hex, true]));&#10;    let cx = x;&#10;    all.forEach(([n, hex, mine], i) =&gt; {&#10;        if (cx &gt; x + CW - 48) { cx = x; y += 32; }&#10;        const on = hex.toLowerCase() === cur;&#10;        const s = g.circle({ x: cx + 14, y: y + 14, r: mine ? 10 : 12, fill: hex, stroke: on ? '#ffffff' : mine ? '#ffffff60' : '#00000080',&#10;                             strokeWidth: on ? 3 : 1, cursor: 'pointer', tooltip: n });&#10;        s.on('click', e =&gt; { e.stop(); set(hex); });&#10;        if (mine)&#10;            s.on('rightclick', e =&gt; { e.stop(); state.palette = state.palette.filter(p =&gt; p !== hex); rebuild(); });&#10;        cx += 34;&#10;    });&#10;    if (cx &gt; x + CW - 48) { cx = x; y += 32; }&#10;    const add = g.group({ x: cx + 14, y: y + 14, cursor: 'pointer', tooltip: 'Keep this colour in your palette' });&#10;    add.circle({ r: 12, fill: '#1a1628', stroke: ACC, strokeWidth: 1 });&#10;    add.text({ text: '+', size: 22, align: 'center', baseline: 'middle', fill: ACC, interactive: false });&#10;    add.on('click', e =&gt; { e.stop(); if (!state.palette.includes(hexOf(it)) &amp;&amp; state.palette.length &lt; 24) state.palette.push(hexOf(it)); rebuild(); });&#10;    y += 34;&#10;    // the colour as a code, and RGB or HSV&#10;    y = codeField(g, x, y, it);&#10;    if (state.cmode === 0) {   // Red, Green and Blue, 0 to 255: the shader follows at once (P18-P20)&#10;        let rgb = hexRGB(hexOf(it));&#10;        const mixer = (k, label) =&gt; slider(g, x, y, CW, label, () =&gt; rgb[k], v =&gt; { rgb[k] = Math.round(v * 255) / 255; it.hex = rgbHex(rgb[0], rgb[1], rgb[2]); },&#10;                                           v =&gt; String(Math.round(v * 255)));&#10;        y = mixer(0, 'Red'); y = mixer(1, 'Green'); y = mixer(2, 'Blue');&#10;    } else {   // Hue, Saturation and Value&#10;        let hsv = toHSV(hexOf(it));&#10;        const mixer = (k, label, f) =&gt; slider(g, x, y, CW, label, () =&gt; hsv[k], v =&gt; { hsv[k] = v; it.hex = fromHSV(hsv[0], hsv[1], hsv[2]); }, f);&#10;        y = mixer(0, 'Hue', v =&gt; Math.round(v * 360) + ' deg'); y = mixer(1, 'Saturation', v =&gt; Math.round(v * 100) + '%'); y = mixer(2, 'Value', v =&gt; Math.round(v * 100) + '%');&#10;    }&#10;    return y + 4;&#10;}&#10;&#10;function codeField(g, x, y, it) {   // the code (#RRGGBB or #RRGGBBAA); a click opens keys to type one&#10;    const typing = hexTyping !== null;&#10;    const f = g.group({ x: x, y: y, cursor: 'text', tooltip: 'Click to type a colour code: #RGB, #RGBA, #RRGGBB or #RRGGBBAA' });&#10;    f.rect({ w: 170, h: 30, radius: 6, fill: '#0b0a12', stroke: typing ? ACC : '#2f2850', strokeWidth: 1 });&#10;    const chip = f.rect({ x: 6, y: 6, w: 18, h: 18, radius: 4, fill: hexOf(it), interactive: false });&#10;    const shown = typing ? '#' + hexTyping + '_' : codeOf(it);&#10;    const code = f.text({ x: 32, y: 15, text: shown, size: 19, baseline: 'middle', fill: typing ? ACC : '#f1ecff', interactive: false });&#10;    if (!typing)&#10;        sliders.push(() =&gt; { chip.set({ fill: hexOf(it) }); code.set({ text: codeOf(it) }); });   // follows the sliders&#10;    f.on('click', e =&gt; { e.stop(); hexTyping = typing ? null : ''; rebuild(); });&#10;    ['RGB', 'HSV'].forEach((n, i) =&gt; button(g, x + CW - 132 + i * 68, y, 62, n, () =&gt; { state.cmode = i; rebuild(); }, state.cmode === i));&#10;    y += 40;&#10;    if (!typing)&#10;        return y;&#10;    const keys = '0123456789ABCDEF'.split('');&#10;    const KW = 36, gap = 5, per = Math.floor((CW + gap) / (KW + gap));&#10;    keys.forEach((k, i) =&gt; {&#10;        button(g, x + (i % per) * (KW + gap), y + Math.floor(i / per) * 36, KW, k, () =&gt; { if (hexTyping.length &lt; 8) { hexTyping += k; rebuild(); } }, false);&#10;    });&#10;    y += Math.ceil(keys.length / per) * 36;&#10;    button(g, x, y, 60, 'Back', () =&gt; { hexTyping = hexTyping.slice(0, -1); rebuild(); }, false);&#10;    button(g, x + 66, y, 90, 'Cancel', () =&gt; { hexTyping = null; rebuild(); }, false);&#10;    const ok = [3, 4, 6, 8].includes(hexTyping.length);&#10;    button(g, x + 162, y, 70, 'OK', () =&gt; { if (ok &amp;&amp; applyColour(it, hexTyping)) { hexTyping = null; sendCode(); rebuild(); } }, ok);&#10;    g.text({ x: x + 244, y: y + 15, text: '3, 4, 6 or 8 digits', size: 16, baseline: 'middle', fill: '#aaa4c6', interactive: false });&#10;    return y + 42;&#10;}&#10;&#10;function lockedRow(g, x, y, label, note) {   // a setting the timeline animates: its name, and a link to the timeline instead of a slider&#10;    g.text({ x: x, y: y + 11, text: label, size: 18, baseline: 'middle', fill: '#c9c3e0', interactive: false });&#10;    const b = g.group({ x: x + LBLW, y: y, cursor: 'pointer', tooltip: 'Locked: the timeline animates it. Click to open the timeline.' });&#10;    b.circle({ x: 5, y: 11, r: 4.5, fill: ACC });&#10;    b.text({ x: 16, y: 11, text: note || 'animated on the timeline', size: 16, baseline: 'middle', fill: ACC });&#10;    b.on('click', e =&gt; { e.stop(); state.tlOpen = true; rebuild(); });&#10;    return y + 30;&#10;}&#10;function aslider(g, x, y, w, label, it, key, get, setv, fmt) {   // a slider, locked while the timeline animates what it sets&#10;    return tlOn(it, key) ? lockedRow(g, x, y, label) : slider(g, x, y, w, label, get, setv, fmt);&#10;}&#10;&#10;function transpRow(panel, y, it, PW) {   // the Transparency slider (locked while the timeline animates it), and a light's animated place&#10;    if (tlOn(it, 'transp'))&#10;        y = lockedRow(panel, 16, y, 'Transparency');&#10;    else&#10;        y = slider(panel, 16, y, PW - 32, 'Transparency', () =&gt; it.transp || 0, v =&gt; { it.transp = v; if (it.type === 'mask') tlDirty = true; }, v =&gt; Math.round(v * 100) + '%');&#10;    if (tlOn(it, 'x') || tlOn(it, 'y'))   // a light's place has no slider: say so here&#10;        y = lockedRow(panel, 16, y, 'Position', 'animated on the timeline (' + [['x', 'Across'], ['y', 'Down']].filter(k =&gt; tlOn(it, k[0])).map(k =&gt; k[1]).join(', ') + ')');&#10;    return y;&#10;}&#10;&#10;function drawTimeline() {&#10;    const x0 = TW, w = W - TW - (state.dock ? DW : 0), y0 = H - TLH;&#10;    const g = layer.group({ x: x0, y: y0 });&#10;    g.rect({ w: w, h: TLH, fill: '#14121ff4', stroke: '#2f2850', strokeWidth: 1, interactive: true });&#10;    const it = selected();&#10;    g.text({ x: 16, y: 20, text: 'TIMELINE', size: 16, baseline: 'middle', fill: ACC, interactive: false });&#10;    if (!it) {&#10;        g.text({ x: 110, y: 20, text: 'Select a board or a light to animate what it has.', size: 18, baseline: 'middle', fill: '#aaa4c6', interactive: false });&#10;        return;&#10;    }&#10;    const tl = tlOf(it), props = tlProps(it);&#10;    let prop = props.find(p =&gt; p[0] === state.tlProp) || props[0];&#10;    const [key, name, now, show] = prop;&#10;    const tr = tlTrack(it, key, now);&#10;    g.text({ x: 110, y: 20, text: itemName(it), size: 16, baseline: 'middle', fill: '#b8b2d0', interactive: false });&#10;    button(g, w - 480, 6, 110, tr.on ? 'Animated' : 'Animate', () =&gt; { tr.on = !tr.on; sendCode(); rebuild(); }, tr.on);&#10;    button(g, w - 364, 6, 110, 'Reset keys', () =&gt; { delete tl.tracks[key]; tlTrack(it, key, now).on = tr.on; sendCode(); rebuild(); }, false);&#10;    // the loop's length (for all of this element's tracks): its own little slider, in seconds&#10;    g.text({ x: w - 236, y: 21, text: 'loop', size: 16, baseline: 'middle', fill: '#aaa4c6', interactive: false });&#10;    const lw = 120, lx = w - 128, val = g.text({ x: lx - 6, y: 21, text: tl.len.toFixed(1) + ' s', size: 15, align: 'right', baseline: 'middle', fill: '#b8b2d0', interactive: false });&#10;    const track = g.rect({ x: lx, y: 15, w: lw, h: 12, radius: 6, fill: '#1a1628', stroke: '#2f2850', strokeWidth: 1, cursor: 'ew-resize', tooltip: 'How long one loop takes' });&#10;    const fill = g.rect({ x: lx, y: 15, w: lw * tlLenV(tl.len), h: 12, radius: 6, fill: ACC, interactive: false });&#10;    const setLen = ex =&gt; { const v = Math.max(0, Math.min(1, (ex - x0 - lx) / lw)); tl.len = Math.round(tlLen(v) * 10) / 10; fill.set({ w: lw * tlLenV(tl.len) }); val.set({ text: tl.len.toFixed(1) + ' s' }); tlDirty = true; };&#10;    track.on('press', e =&gt; { e.stop(); setLen(e.x); });&#10;    track.on('drag', e =&gt; { e.stop(); setLen(e.x); });&#10;    // what to animate: one chip each, a dot on the ones that are animated&#10;    let cx = 16;&#10;    props.forEach(p =&gt; {&#10;        const on = tlOn(it, p[0]), label = (on ? '    ' : '') + p[1];&#10;        const bw = Math.max(60, p[1].length * 9.8 + 24 + (on ? 16 : 0));&#10;        button(g, cx, 40, bw, label, () =&gt; { state.tlProp = p[0]; rebuild(); }, p[0] === key);&#10;        if (on)   // a round dot: this one is animated&#10;            g.circle({ x: cx + 13, y: 55, r: 4.5, fill: p[0] === key ? '#ffffff' : ACC, interactive: false });&#10;        cx += bw + 6;&#10;    });&#10;    // the graph: time across (one loop), the value up&#10;    const gx = 56, gy = 84, gw = w - gx - 24, gh = TLH - gy - 30;&#10;    const area = g.rect({ x: gx, y: gy, w: gw, h: gh, fill: '#0b0a12', stroke: '#2f2850', strokeWidth: 1, cursor: 'crosshair', interactive: true,&#10;                          tooltip: 'Click to add a key - drag a key - right-click a key to remove it' });&#10;    for (let i = 0; i &lt;= 4; i++) {&#10;        const lx2 = gx + gw * i / 4;&#10;        g.line({ x1: lx2, y1: gy, x2: lx2, y2: gy + gh, width: 1, stroke: '#2f285080', interactive: false });&#10;        g.text({ x: lx2, y: gy + gh + 13, text: (tl.len * i / 4).toFixed(1) + ' s', size: 14, align: i === 0 ? 'left' : i === 4 ? 'right' : 'center', baseline: 'middle', fill: '#7f7a99', interactive: false });&#10;    }&#10;    g.line({ x1: gx, y1: gy + gh / 2, x2: gx + gw, y2: gy + gh / 2, width: 1, stroke: '#2f285080', interactive: false });&#10;    [[1, gy], [0.5, gy + gh / 2], [0, gy + gh]].forEach(([v, ty]) =&gt;&#10;        g.text({ x: gx - 8, y: ty, text: show(v), size: 14, align: 'right', baseline: 'middle', fill: '#7f7a99', interactive: false }));&#10;    const KX = u =&gt; gx + u * gw, KY = v =&gt; gy + (1 - v) * gh;&#10;    // the other animated tracks, faint, to line things up with&#10;    props.forEach(p =&gt; {&#10;        if (p[0] === key || !tlOn(it, p[0])) return;&#10;        const k = tl.tracks[p[0]].keys;&#10;        for (let i = 1; i &lt; k.length; i++)&#10;            g.line({ x1: KX(k[i - 1][0]), y1: KY(k[i - 1][1]), x2: KX(k[i][0]), y2: KY(k[i][1]), width: 1, stroke: '#5c577490', interactive: false });&#10;    });&#10;    const col = tr.on ? ACC : '#7f7a99';&#10;    const lines = [], dots = [];&#10;    const draw = () =&gt; {&#10;        tr.keys.forEach((k, i) =&gt; {&#10;            if (i) lines[i - 1].set({ x1: KX(tr.keys[i - 1][0]), y1: KY(tr.keys[i - 1][1]), x2: KX(k[0]), y2: KY(k[1]) });&#10;            dots[i].set({ x: KX(k[0]), y: KY(k[1]) });&#10;        });&#10;    };&#10;    tr.keys.forEach((k, i) =&gt; { if (i) lines.push(g.line({ x1: 0, y1: 0, x2: 0, y2: 0, width: 2, stroke: col, interactive: false })); });&#10;    tr.keys.forEach((k, i) =&gt; {&#10;        const end = i === 0 || i === tr.keys.length - 1;&#10;        const d = g.circle({ x: 0, y: 0, r: 7, fill: end ? '#14121f' : col, stroke: col, strokeWidth: 2, cursor: end ? 'ns-resize' : 'move',&#10;                             tooltip: end ? 'Start and end of the loop (they move together)' : 'Drag - right-click removes' });&#10;        d.on('drag', e =&gt; {&#10;            e.stop();&#10;            const v = Math.max(0, Math.min(1, 1 - (e.y - y0 - gy) / gh));&#10;            if (end) { tr.keys[0][1] = v; tr.keys[tr.keys.length - 1][1] = v; }&#10;            else {&#10;                const lo = tr.keys[i - 1][0] + 0.01, hi = tr.keys[i + 1][0] - 0.01;&#10;                k[0] = Math.max(lo, Math.min(hi, (e.x - x0 - gx) / gw));&#10;                k[1] = v;&#10;            }&#10;            draw();&#10;            tlDirty = true;&#10;        });&#10;        d.on('rightclick', e =&gt; { e.stop(); if (!end) { tr.keys.splice(i, 1); sendCode(); rebuild(); } });&#10;        d.on('click', e =&gt; e.stop());&#10;        dots.push(d);&#10;    });&#10;    draw();&#10;    area.on('click', e =&gt; {   // a new key where you click&#10;        e.stop();&#10;        const u = Math.max(0.01, Math.min(0.99, (e.x - x0 - gx) / gw)), v = Math.max(0, Math.min(1, 1 - (e.y - y0 - gy) / gh));&#10;        if (tr.keys.some(k =&gt; Math.abs(k[0] - u) &lt; 0.01)) return;&#10;        tr.keys.push([u, v]);&#10;        tr.keys.sort((a, b) =&gt; a[0] - b[0]);&#10;        tr.on = true;&#10;        sendCode(); rebuild();&#10;    });&#10;    if (!tr.on)&#10;        g.text({ x: gx + gw / 2, y: gy + gh / 2, text: 'Click Animate (or the graph) to animate ' + name, size: 18, align: 'center', baseline: 'middle', fill: '#9a94b8', interactive: false });&#10;}&#10;&#10;function drawAudio() {   // the Audio panel: each setting of the selected element can follow a part of the sound, or the beat&#10;    const x0 = TW, w = W - TW - (state.dock ? DW : 0), y0 = H - AUH;&#10;    const g = layer.group({ x: x0, y: y0 });&#10;    g.rect({ w: w, h: AUH, fill: '#14121ff4', stroke: '#2f2850', strokeWidth: 1, interactive: true });&#10;    g.text({ x: 16, y: 20, text: 'AUDIO', size: 16, baseline: 'middle', fill: ACC, interactive: false });&#10;    // on the right: what comes in now (the Scene's own analysis of In A, and the bar from the DAW), and the sensitivity&#10;    const mx = w - 300;&#10;    g.text({ x: mx, y: 20, text: 'In A now', size: 16, baseline: 'middle', fill: '#aaa4c6', interactive: false });&#10;    [['Level', 'levelA'], ['Bass', 'bass'], ['Mid', 'mid'], ['High', 'treble'], ['Bar', 'P30']].forEach(([n, src], i) =&gt; {&#10;        const bx = mx + i * 56, by = 44, bh = 150;&#10;        g.rect({ x: bx, y: by, w: 40, h: bh, radius: 4, fill: '#0b0a12', stroke: '#2f2850', strokeWidth: 1, interactive: false });&#10;        g.rect({ x: bx + 2, y: by + bh - 2, w: 36, h: 0, radius: 3, fill: ACC, interactive: false,&#10;                 bind: { h: [src, 0, -(bh - 4), { smooth: 0.08 }] } });&#10;        g.text({ x: bx + 20, y: by + bh + 16, text: n, size: 15, align: 'center', baseline: 'middle', fill: '#c9c3e0', interactive: false });&#10;    });&#10;    g.text({ x: mx, y: 238, text: 'Sensitivity', size: 16, baseline: 'middle', fill: '#c9c3e0', interactive: false });&#10;    const sx = mx, sw = 270, sv = g.text({ x: mx + sw, y: 238, text: Math.round(state.ausens * 100) + '%', size: 15, align: 'right', baseline: 'middle', fill: '#c9c3e0', interactive: false });&#10;    const st = g.rect({ x: sx, y: 254, w: sw, h: 12, radius: 6, fill: '#1a1628', stroke: '#2f2850', strokeWidth: 1, cursor: 'ew-resize',&#10;                        tooltip: 'How loud the sound must be before it moves anything: higher, softer parts count too' });&#10;    const sf = g.rect({ x: sx, y: 254, w: sw * state.ausens, h: 12, radius: 6, fill: ACC, interactive: false });&#10;    const setS = ex =&gt; { state.ausens = Math.max(0, Math.min(1, (ex - x0 - sx) / sw)); sf.set({ w: sw * state.ausens }); sv.set({ text: Math.round(state.ausens * 100) + '%' }); sendAids(null); };&#10;    st.on('press', e =&gt; { e.stop(); setS(e.x); });&#10;    st.on('drag', e =&gt; { e.stop(); setS(e.x); });&#10;    g.text({ x: mx, y: 290, text: 'Beat, Bar: the DAW, while it plays.', size: 14, baseline: 'middle', fill: '#9a94b8', interactive: false });&#10;    g.text({ x: mx, y: 310, text: 'Sound: the plugin input, and the player', size: 14, baseline: 'middle', fill: '#9a94b8', interactive: false });&#10;    const it = selected();&#10;    if (!it || it.type === 'image') {&#10;        g.text({ x: 110, y: 20, text: it ? 'A picture cannot follow the sound (yet): select a board, a light or a mask.' : 'Select a board, a light or a mask to let it follow the sound.',&#10;                 size: 18, baseline: 'middle', fill: '#aaa4c6', interactive: false });&#10;        return;&#10;    }&#10;    g.text({ x: 110, y: 20, text: itemName(it), size: 16, baseline: 'middle', fill: '#b8b2d0', interactive: false });&#10;    const props = tlProps(it), RH2 = 34, nw = 150, cw = 66, ax = 16 + nw + AUSRC.length * (cw + 4) + 10, aw = Math.max(80, mx - 30 - ax - 56);&#10;    props.forEach((p, i) =&gt; {&#10;        const key = p[0], y = 44 + i * RH2, a = (it.au &amp;&amp; it.au[key]) || { src: 0, amt: 0.5 };&#10;        g.text({ x: 16, y: y + 15, text: p[1], size: 16, baseline: 'middle', fill: a.src ? '#ffffff' : '#c9c3e0', interactive: false });&#10;        AUSRC.forEach((n, k) =&gt; {&#10;            const b = g.group({ x: 16 + nw + k * (cw + 4), y: y, cursor: 'pointer', tooltip: k ? 'Follow ' + n.toLowerCase() : 'Not following the sound' });&#10;            const on = a.src === k;&#10;            b.rect({ w: cw, h: 28, radius: 6, fill: on ? (k ? ACC : '#2a2440') : '#1a1628', stroke: on ? ACC : '#2f2850', strokeWidth: 1 });&#10;            b.text({ x: cw / 2, y: 14, text: n, size: 15, align: 'center', baseline: 'middle', fill: on ? '#ffffff' : '#c9c3e0', interactive: false });&#10;            b.on('click', e =&gt; { e.stop(); it.au = it.au || {}; it.au[key] = { src: k, amt: a.amt }; if (!k) delete it.au[key]; sendCode(); rebuild(); });&#10;        });&#10;        if (!a.src) return;&#10;        // how far: -100% (down) to +100% (up), from the middle&#10;        const val = g.text({ x: ax + aw + 56, y: y + 15, text: Math.round(a.amt * 100) + '%', size: 15, align: 'right', baseline: 'middle', fill: '#c9c3e0', interactive: false });&#10;        const tr = g.rect({ x: ax, y: y + 9, w: aw, h: 12, radius: 6, fill: '#1a1628', stroke: '#2f2850', strokeWidth: 1, cursor: 'ew-resize',&#10;                            tooltip: 'How far the sound moves it: right up, left down' });&#10;        g.line({ x1: ax + aw / 2, y1: y + 6, x2: ax + aw / 2, y2: y + 24, width: 1, stroke: '#5c5774', interactive: false });&#10;        const fill = g.rect({ x: ax + aw / 2, y: y + 9, w: 0, h: 12, radius: 6, fill: ACC, interactive: false });&#10;        const show = () =&gt; { const v = it.au[key].amt; fill.set({ x: ax + aw / 2 + Math.min(0, v) * aw / 2, w: Math.abs(v) * aw / 2 }); val.set({ text: Math.round(v * 100) + '%' }); };&#10;        const set = ex =&gt; { it.au[key].amt = Math.round(Math.max(-1, Math.min(1, ((ex - x0 - ax) / aw) * 2 - 1)) * 100) / 100; show(); tlDirty = true; };&#10;        tr.on('press', e =&gt; { e.stop(); set(e.x); });&#10;        tr.on('drag', e =&gt; { e.stop(); set(e.x); });&#10;        tr.on('release', () =&gt; { if (tlDirty) { tlDirty = false; sendCode(); } });&#10;        show();&#10;    });&#10;}&#10;&#10;const LBLW = 165;   // the width of a slider's name&#10;function slider(g, x, y, w, label, get, setv, fmt) {   // fmt: how to show its value, beside the name&#10;    g.text({ x: x, y: y + 11, text: label, size: 18, baseline: 'middle', fill: '#e4def5', interactive: false });&#10;    const val = fmt ? g.text({ x: x + w, y: y + 11, text: fmt(get()), size: 16, align: 'right', baseline: 'middle', fill: '#c9c3e0', interactive: false }) : null;&#10;    const show = () =&gt; { if (val) val.set({ text: fmt(get()) }); };&#10;    const tx = x + LBLW, tw = w - LBLW - (fmt ? 56 : 0);   // the value sits right of the track, so a long name never runs into it&#10;    const track = g.rect({ x: tx, y: y + 5, w: tw, h: 12, radius: 6, fill: '#1a1628', stroke: '#2f2850', strokeWidth: 1, cursor: 'ew-resize' });&#10;    const fill = g.rect({ x: tx, y: y + 5, w: tw * get(), h: 12, radius: 6, fill: ACC, interactive: false });&#10;    const set = ex =&gt; { const v = Math.max(0, Math.min(1, (ex - tx) / tw)); setv(v); refreshSliders(); sendP(); };&#10;    track.on('press', e =&gt; { e.stop(); set(e.x - panel.get('x')); });&#10;    track.on('drag', e =&gt; { e.stop(); set(e.x - panel.get('x')); });&#10;    sliders.push(() =&gt; { fill.set({ w: tw * get() }); show(); });&#10;    return y + 30;&#10;}&#10;&#10;function refreshSliders() { sliders.forEach(s =&gt; s()); }&#10;&#10;let panel = null, sure = false;&#10;// ---------- the dock: Properties and Layers down the right side, each folds in, the whole dock folds away ----------&#10;const DW = 520, CW = DW - 32;   // the dock's width and the width of what is in it&#10;function section(g, y, name, sub, open, fn) {   // a header that folds its section in and out&#10;    const h = g.group({ x: 0, y: y, cursor: 'pointer', tooltip: open ? 'Fold in' : 'Fold out' });&#10;    h.rect({ w: DW, h: 32, fill: '#1d1830' });&#10;    h.triangle(open ? { x1: 14, y1: 12, x2: 24, y2: 12, x3: 19, y3: 20, fill: '#b8b2d0', interactive: false }&#10;                    : { x1: 15, y1: 11, x2: 15, y2: 21, x3: 23, y3: 16, fill: '#b8b2d0', interactive: false });&#10;    h.text({ x: 34, y: 16, text: name, size: 16, baseline: 'middle', fill: ACC, interactive: false });&#10;    if (sub)&#10;        h.text({ x: 34 + name.length * 11.5 + 14, y: 16, text: sub, size: 16, baseline: 'middle', fill: '#aaa4c6', interactive: false });&#10;    h.on('click', e =&gt; { e.stop(); fn(); rebuild(); });&#10;    return y + 40;&#10;}&#10;&#10;function dockTab(g, x, open) {   // the little tab on the dock's edge that folds it away or brings it back&#10;    const t = g.group({ x: x, y: H / 2 - 48, cursor: 'pointer', tooltip: open ? 'Hide the panels' : 'Show the panels' });&#10;    t.rect({ w: 22, h: 96, radius: 6, fill: '#14121ff4', stroke: '#2f2850', strokeWidth: 1 });&#10;    t.text({ x: 11, y: 48, text: open ? '&gt;' : '&lt;', size: 25, align: 'center', baseline: 'middle', fill: ACC, interactive: false });&#10;    t.on('click', e =&gt; { e.stop(); state.dock = !open; rebuild(); });&#10;}&#10;&#10;function drawDock() {&#10;    sliders = [];&#10;    panel = null;&#10;    if (!state.dock) {&#10;        dockTab(layer, W - 22, false);&#10;        return;&#10;    }&#10;    panel = layer.group({ x: W - DW, y: 0 });&#10;    const bg = panel.rect({ w: DW, h: H, fill: '#14121ff4', stroke: '#2f2850', strokeWidth: 1, interactive: true });&#10;    dockTab(panel, -22, true);&#10;    const g = panel.group({ x: 0, y: -(state.dscroll || 0) });   // what is in it, scrolled by the wheel when it is too long&#10;    const it = selected();&#10;    let y = 0;&#10;    y = section(g, y, 'PROPERTIES', it ? itemName(it) : 'Scene', state.openP, () =&gt; state.openP = !state.openP);&#10;    if (state.openP)&#10;        y = drawProps(g, y, it);&#10;    y = section(g, y, 'LAYERS', 'top = front', state.openL, () =&gt; state.openL = !state.openL);&#10;    if (state.openL)&#10;        y = drawLayers(g, y, DW);&#10;    const most = Math.max(0, y + 20 - H);&#10;    if ((state.dscroll || 0) &gt; most) { state.dscroll = most; g.set({ y: -most }); }&#10;    bg.on('wheel', e =&gt; {&#10;        e.stop();&#10;        const s = Math.max(0, Math.min(most, (state.dscroll || 0) + (e.delta &gt; 0 ? -60 : 60)));&#10;        if (s !== state.dscroll) { state.dscroll = s; g.set({ y: -s }); }&#10;    });&#10;}&#10;&#10;function drawProps(panel, y, it) {   // what the selected element (or with none, the Scene) has to set; returns where it ends&#10;    const PW = DW;&#10;    if (state.bg &amp;&amp; state.edges) {   // what the edges show: straight ones (rectangles), round ones (circles), or all, coloured by kind&#10;        panel.text({ x: 16, y: y + 6, text: 'EDGES - green straight, pink round', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        y = chips(panel, 16, y + 18, PW - 32, EFILTERS, state.efilter, i =&gt; { state.efilter = i; sendAids(null); rebuild(); });&#10;        y = slider(panel, 16, y, PW - 32, 'Sensitivity', () =&gt; state.esens, v =&gt; { state.esens = v; sendAids(null); });&#10;        y = slider(panel, 16, y, PW - 32, 'Edge width', () =&gt; state.ewidth, v =&gt; { state.ewidth = v; sendAids(null); });&#10;        y += 8;&#10;    }&#10;    if (!it) {&#10;        panel.text({ x: 16, y: y + 6, text: 'BACKGROUND', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        y += 18;&#10;        button(panel, 16, y, 150, 'Choose...', () =&gt; out(2), false);&#10;        if (state.bg)&#10;            button(panel, 172, y, 150, 'No background', () =&gt; setBackground(''), false);&#10;        panel.text({ x: 16, y: y + 46, text: state.bg ? state.bg.split(/[\\/]/).pop() : 'none: the Scene is see-through', size: 15, baseline: 'middle', fill: '#b8b2d0', interactive: false });&#10;        y += 66;&#10;        // the sound player: what the Audio panel follows (with the sound on the plugin's input), and what you hear&#10;        panel.text({ x: 16, y: y + 6, text: 'SOUND - a file to play, for the Audio panel', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        y += 18;&#10;        const snd = state.snd;&#10;        button(panel, 16, y, 170, 'Choose sound...', () =&gt; { wantSound = true; out(2); }, false);&#10;        if (snd.file) {&#10;            button(panel, 192, y, 90, snd.playing ? 'Playing' : 'Play', () =&gt; { snd.playing = true; out(4); rebuild(); }, snd.playing);&#10;            button(panel, 288, y, 80, 'Stop', () =&gt; { snd.playing = false; out(5); rebuild(); }, false);&#10;            button(panel, 374, y, 80, 'Loop', () =&gt; { snd.loop = !snd.loop; sendSound(false); rebuild(); }, snd.loop);&#10;        }&#10;        panel.text({ x: 16, y: y + 46, text: snd.file ? snd.file.split(/[\\/]/).pop() : 'none: WAV, MP3, AIFF, FLAC or OGG', size: 15, baseline: 'middle', fill: '#b8b2d0', interactive: false });&#10;        y += 62;&#10;        if (snd.file) {&#10;            y = slider(panel, 16, y, PW - 32, 'Volume', () =&gt; snd.vol, v =&gt; { snd.vol = v; out(7, sndDb(v)); }, v =&gt; sndDb(v) &lt;= -60 ? 'off' : sndDb(v) + ' dB');&#10;            y += 6;&#10;        }&#10;        panel.text({ x: 16, y: y + 8, text: 'Click a board, a light or an image to set it up.', size: 18, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        panel.text({ x: 16, y: y + 30, text: 'Double-click the picture for a new light.', size: 18, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        return y + 54;&#10;    } else if (it.type === 'board') {&#10;        const choose = fx =&gt; { it.fx = fx; picking = false; if (FXK[fx]) { it.rsize = FXK[fx][2]; it.rstr = FXK[fx][3]; } it.style = 0; sendCode(); rebuild(); };&#10;        let cat = CATS.findIndex(c =&gt; c[1].includes(it.fx));&#10;        if (state.fxCatFor === it.id &amp;&amp; state.fxCat !== undefined) cat = state.fxCat;   // a group looked at, not chosen from yet&#10;        panel.text({ x: 16, y: y + 6, text: 'BOARD - group', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        y = chips(panel, 16, y + 18, PW - 32, CATS.map(c =&gt; c[0]), cat, i =&gt; { state.fxCat = i; state.fxCatFor = it.id; rebuild(); });&#10;        const list = CATS[cat][1], needsBg = list.some(MOVES) &amp;&amp; !state.bg;&#10;        panel.text({ x: 16, y: y + 6, text: 'effect' + (needsBg ? ' (these need a background picture)' : ''), size: 15, fill: needsBg ? ACC : '#7f7a99', baseline: 'middle', interactive: false });&#10;        y = chips(panel, 16, y + 18, PW - 32, list.map(k =&gt; FX[k]), list.indexOf(it.fx), i =&gt; choose(list[i]));&#10;        if (it.fx === 13 || it.fx === 14 || it.fx === 15) {&#10;            panel.text({ x: 16, y: y + 6, text: 'light mode', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;            y = chips(panel, 16, y + 18, PW - 32, MODES.slice(0, 7), Math.min(it.mode || 0, 6), i =&gt; { it.mode = i; sendCode(); rebuild(); });&#10;        }&#10;        if (it.fx === 14) {&#10;            button(panel, 16, y + 2, 190, picking ? 'Click the picture...' : 'Pick colour from picture', () =&gt; { picking = !picking; rebuild(); }, picking);&#10;            panel.text({ x: 216, y: y + 17, text: state.bg ? 'lights that colour up in the board' : 'needs a background',&#10;                         size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;            y += 40;&#10;        } else if (it.fx === 15) {&#10;            panel.text({ x: 16, y: y + 6, text: 'style' + (state.bg ? '' : ' (needs a background)'), size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;            y = chips(panel, 16, y + 18, PW - 32, ESTYLES, it.estyle || 0, i =&gt; { it.estyle = i; sendCode(); rebuild(); });&#10;        } else {&#10;            if (FXSTYLES[it.fx]) {&#10;                panel.text({ x: 16, y: y + 6, text: 'kind', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;                y = chips(panel, 16, y + 18, PW - 32, FXSTYLES[it.fx], it.style || 0, i =&gt; { it.style = i; sendCode(); rebuild(); });&#10;            }&#10;            panel.text({ x: 16, y: y + 6, text: 'picture' + (state.bg ? '' : ' (needs a background)'), size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;            y = chips(panel, 16, y + 18, PW - 32, it.fx === 10 ? PICS_RIPPLE : PICS, Math.min(it.pic || 0, it.fx === 10 ? 1 : 3),&#10;                      i =&gt; { it.pic = i; sendCode(); rebuild(); });&#10;        }&#10;        if (it.fx === 1) {&#10;            panel.text({ x: 16, y: y + 6, text: 'text (edit the list at the top of the Script)', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;            y = chips(panel, 16, y + 18, PW - 32, TEXTS, it.text, i =&gt; { it.text = i; sendCode(); rebuild(); });&#10;        }&#10;        button(panel, 16, y + 2, 140, 'Full screen', () =&gt; { if (it.locked) return; it.pts = [[0, 0], [1, 0], [1, 1], [0, 1]]; sendP(); rebuild(); });&#10;        panel.text({ x: 172, y: y + 17, text: 'corners', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        button(panel, 250, y + 2, 84, 'Shape', () =&gt; { it.scaleCorners = false; rebuild(); }, !it.scaleCorners);&#10;        button(panel, 340, y + 2, 84, 'Scale', () =&gt; { it.scaleCorners = true; rebuild(); }, !!it.scaleCorners);&#10;        if (it.locked)&#10;            panel.text({ x: 438, y: y + 17, text: 'locked', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        y += 40;&#10;        if (!NOCOLOUR(it.fx))   // the moving picture has no colour of its own (some have a tint)&#10;            y = swatches(panel, 16, y + 4, it);&#10;        y = slider(panel, 16, y, PW - 32, 'Speed', () =&gt; it.speed, v =&gt; it.speed = v);&#10;        if (!NOBRIGHT(it.fx))&#10;            y = aslider(panel, 16, y, PW - 32, it.fx === 9 ? 'Amount' : 'Brightness', it, 'bright', () =&gt; it.bright, v =&gt; it.bright = v);&#10;        if (FXK[it.fx]) {&#10;            const [n1, n2, d1, d2] = FXK[it.fx];&#10;            y = aslider(panel, 16, y, PW - 32, n1, it, 'k1', () =&gt; it.rsize === undefined ? d1 : it.rsize, v =&gt; it.rsize = v,&#10;                       it.fx === 16 ? v =&gt; Math.round(v * 360) + ' deg' : null);&#10;            if (n2)&#10;                y = aslider(panel, 16, y, PW - 32, n2, it, 'k2', () =&gt; it.rstr === undefined ? d2 : it.rstr, v =&gt; it.rstr = v);&#10;        }&#10;        if (it.fx === 13)&#10;            y = aslider(panel, 16, y, PW - 32, 'Glow size', it, 'k1', () =&gt; it.rsize === undefined ? 0.6 : it.rsize, v =&gt; it.rsize = v);&#10;        if (it.fx === 14) {&#10;            y = aslider(panel, 16, y, PW - 32, 'Tolerance', it, 'k1', () =&gt; it.rsize === undefined ? 0.6 : it.rsize, v =&gt; it.rsize = v);&#10;            y = aslider(panel, 16, y, PW - 32, 'Softness', it, 'k2', () =&gt; it.rstr === undefined ? 0.6 : it.rstr, v =&gt; it.rstr = v);&#10;        }&#10;        if (it.fx === 15) {&#10;            y = aslider(panel, 16, y, PW - 32, 'Sensitivity', it, 'k1', () =&gt; it.rsize === undefined ? 0.6 : it.rsize, v =&gt; it.rsize = v);&#10;            y = aslider(panel, 16, y, PW - 32, 'Glow width', it, 'k2', () =&gt; it.rstr === undefined ? 0.6 : it.rstr, v =&gt; it.rstr = v);&#10;        }&#10;        if (it.fx === 10) {&#10;            y = aslider(panel, 16, y, PW - 32, 'Circle size', it, 'k1', () =&gt; it.rsize === undefined ? 0.6 : it.rsize, v =&gt; it.rsize = v);&#10;            y = aslider(panel, 16, y, PW - 32, 'Strength', it, 'k2', () =&gt; it.rstr === undefined ? 0.6 : it.rstr, v =&gt; it.rstr = v);&#10;        }&#10;        if (it.fx !== 13)&#10;            y = aslider(panel, 16, y, PW - 32, 'Edge fade', it, 'fade', () =&gt; it.fade || 0, v =&gt; it.fade = v, v =&gt; v &lt; 0.005 ? 'none' : Math.round(v * 100) + '%');&#10;        y = transpRow(panel, y, it, PW);&#10;    } else if (it.type === 'mask') {&#10;        panel.text({ x: 16, y: y + 6, text: 'MASK - the effects do not show', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        y = chips(panel, 16, y + 18, PW - 32, ['inside the shape', 'outside the shape'], it.invert ? 1 : 0, i =&gt; { it.invert = i; sendCode(); rebuild(); });&#10;        y = slider(panel, 16, y, PW - 32, 'Soft edge', () =&gt; it.feather === undefined ? 0.2 : it.feather, v =&gt; { it.feather = v; tlDirty = true; }, v =&gt; Math.round(v * 100) + '%');&#10;        y = transpRow(panel, y, it, PW);&#10;        panel.text({ x: 16, y: y + 6, text: 'masks', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        y = chips(panel, 16, y + 18, PW - 32, ['All effects', 'Only the ones I pick'], it.all === false ? 1 : 0, i =&gt; { it.all = i === 0; if (!it.only) it.only = []; sendCode(); rebuild(); });&#10;        if (it.all === false) {&#10;            const fx = state.items.filter(t =&gt; t.type === 'board' || t.type === 'light');&#10;            if (!fx.length)&#10;                panel.text({ x: 16, y: y + 10, text: 'No boards or lights yet.', size: 18, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;            fx.forEach((t, i) =&gt; {&#10;                const on = it.only.includes(t.id);&#10;                button(panel, 16 + (i % 2) * ((PW - 32) / 2 + 4), y + Math.floor(i / 2) * 36, (PW - 32) / 2 - 4, itemName(t).slice(0, 30),&#10;                       () =&gt; { it.only = on ? it.only.filter(k =&gt; k !== t.id) : it.only.concat([t.id]); sendCode(); rebuild(); }, on);&#10;            });&#10;            y += Math.ceil(Math.max(1, fx.length) / 2) * 36 + 6;&#10;        }&#10;        panel.text({ x: 16, y: y + 8, text: 'double-click the edge: a point more - right-click a point: take it away', size: 15, fill: '#9a94b8', baseline: 'middle', interactive: false });&#10;        panel.text({ x: 16, y: y + 26, text: 'Masks work on the effects; images lie over everything.', size: 15, fill: '#9a94b8', baseline: 'middle', interactive: false });&#10;        return y + 44;&#10;    } else if (it.type === 'image') {&#10;        panel.text({ x: 16, y: y + 6, text: 'IMAGE - ' + fileName(it.src), size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        y += 18;&#10;        button(panel, 16, y, 170, 'Other picture...', () =&gt; { wantImage = 'replace'; out(2); }, false);&#10;        y += 44;&#10;        panel.text({ x: 16, y: y + 6, text: 'in its box', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        y = chips(panel, 16, y + 18, PW - 32, ['Fit (whole picture)', 'Fill (cut to the box)'], it.fit ? 1 : 0, i =&gt; { it.fit = i; rebuild(); });&#10;        y = slider(panel, 16, y, PW - 32, 'Box width', () =&gt; Math.min(1, it.w), v =&gt; { it.w = Math.max(0.005, v); moveHandles(it); }, v =&gt; Math.round(v * 200) + '%');&#10;        y = slider(panel, 16, y, PW - 32, 'Box height', () =&gt; Math.min(1, it.h), v =&gt; { it.h = Math.max(0.005, v); moveHandles(it); }, v =&gt; Math.round(v * 200) + '%');&#10;        y = aslider(panel, 16, y, PW - 32, 'Size', it, 'scale', () =&gt; it.scale, v =&gt; { it.scale = Math.max(0.01, v); moveHandles(it); }, v =&gt; Math.round(v * 200) + '%');&#10;        y = aslider(panel, 16, y, PW - 32, 'Turn', it, 'rot', () =&gt; it.rot, v =&gt; { it.rot = v; moveHandles(it); }, v =&gt; Math.round((v - 0.5) * 360) + ' deg');&#10;        if (tlOn(it, 'transp'))&#10;            y = lockedRow(panel, 16, y, 'Transparency');&#10;        else&#10;            y = slider(panel, 16, y, PW - 32, 'Transparency', () =&gt; it.transp || 0, v =&gt; { it.transp = v; moveHandles(it); }, v =&gt; Math.round(v * 100) + '%');&#10;        if (tlOn(it, 'x') || tlOn(it, 'y'))&#10;            y = lockedRow(panel, 16, y, 'Position', 'animated on the timeline');&#10;        panel.text({ x: 16, y: y + 8, text: 'Pictures lie over all the effects.', size: 15, fill: '#9a94b8', baseline: 'middle', interactive: false });&#10;        panel.text({ x: 16, y: y + 26, text: 'Drag a corner for the box (Ctrl: keep its shape).', size: 15, fill: '#9a94b8', baseline: 'middle', interactive: false });&#10;        return y + 48;&#10;    } else {&#10;        panel.text({ x: 16, y: y + 6, text: 'LIGHT - mode', size: 16, fill: '#aaa4c6', baseline: 'middle', interactive: false });&#10;        y = chips(panel, 16, y + 18, PW - 32, MODES, it.mode, i =&gt; { it.mode = i; sendCode(); rebuild(); });&#10;        y = swatches(panel, 16, y + 4, it);&#10;        y = aslider(panel, 16, y, PW - 32, 'Size', it, 'size', () =&gt; it.size, v =&gt; { it.size = v; moveHandles(it); });&#10;        y = slider(panel, 16, y, PW - 32, 'Speed', () =&gt; it.speed, v =&gt; it.speed = v);&#10;        y = aslider(panel, 16, y, PW - 32, 'Strength', it, 'power', () =&gt; it.power, v =&gt; it.power = v);&#10;        y = transpRow(panel, y, it, PW);&#10;    }&#10;    panel.text({ x: 16, y: y + 8, text: 'drag corners (Ctrl: scale) - drag inside - Alt: no snap', size: 15, fill: '#9a94b8', baseline: 'middle', interactive: false });&#10;    panel.text({ x: 16, y: y + 26, text: 'wheel = scale - Shift+wheel = rotate - right-click = options', size: 15, fill: '#9a94b8', baseline: 'middle', interactive: false });&#10;    return y + 44;&#10;}&#10;&#10;function setEdit(on) {&#10;    state.edit = !!on;&#10;    sendAids(null);&#10;    rebuild();&#10;}&#10;&#10;function setBackground(path) {&#10;    state.bg = path;&#10;    out(1, { image1: path });&#10;    sendCode();&#10;    sendAids(null);&#10;    rebuild();&#10;}&#10;&#10;function onInput(n, value) {&#10;    if (n === 3 &amp;&amp; typeof value === 'string' &amp;&amp; value.trim().length) {   // a colour code from a Text Input&#10;        const it = selected();&#10;        if (applyColour(it, value)) { hexTyping = null; sendCode(); rebuild(); }&#10;    }&#10;    if (n === 2 &amp;&amp; typeof value === 'string' &amp;&amp; value.length &amp;&amp; (wantSound || AUDIOEXT.test(value))) {   // a sound: for the player&#10;        if (value !== state.snd.file) setSound(value);&#10;        wantSound = false; wantImage = false;&#10;        return;&#10;    }&#10;    if (n === 2 &amp;&amp; typeof value === 'string' &amp;&amp; value.length) {&#10;        const it = selected();&#10;        if (wantImage === 'replace' &amp;&amp; it &amp;&amp; it.type === 'image') { it.src = value; rebuild(); }&#10;        else if (wantImage) addImage(value);&#10;        else if (!state.items.some(t =&gt; t.type === 'image' &amp;&amp; t.src === value))   // (the File node sends its last file again when the project opens)&#10;            setBackground(value);&#10;        wantImage = false;&#10;    }&#10;    if (n === 1)&#10;        setEdit(value === undefined ? !state.edit : (value === true || (typeof value === 'number' &amp;&amp; value &gt; 0.5) || value === 'on'));&#10;}&#10;&#10;function onStart() {&#10;    sentCode = '';&#10;    if (state.bg)&#10;        out(1, { image1: state.bg });&#10;    sendCode();&#10;    sendAids(null);&#10;    sendSound(true);&#10;    state.snd.playing = false;&#10;    rebuild();&#10;}&#10;"
                 live="1" textsize="9.0" state="{&quot;items&quot;:[{&quot;id&quot;:1,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:12,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.7000619195046436,&quot;seed&quot;:0.17156311723022521,&quot;mode&quot;:0,&quot;pic&quot;:1,&quot;pts&quot;:[[0.07776671850699846,0.4982042509072058],[0.13222197558268592,0.4939879146627204],[0.1392892690513219,0.7678016243303957],[0.09143856143079314,0.77111655780197]],&quot;style&quot;:0,&quot;hex&quot;:&quot;#ff9a3c&quot;,&quot;fade&quot;:0.03573033707865155,&quot;transp&quot;:0},{&quot;id&quot;:2,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.11373481422737816,&quot;y&quot;:0.8149525665864072,&quot;mode&quot;:6,&quot;color&quot;:0,&quot;size&quot;:0.4301547987616101,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.04751783068180471},{&quot;id&quot;:3,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.30772802892572915,&quot;y&quot;:0.5968193248474597,&quot;mode&quot;:6,&quot;color&quot;:0,&quot;size&quot;:0.33015479876161,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.7906405350936061},{&quot;id&quot;:4,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.718813265602813,&quot;y&quot;:0.46473933524819167,&quot;mode&quot;:6,&quot;color&quot;:0,&quot;size&quot;:0.1359442724458207,&quot;speed&quot;:0.52687306501548,&quot;power&quot;:0.5961300309597521,&quot;seed&quot;:0.16675573319649772},{&quot;id&quot;:5,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.5293722592143986,&quot;y&quot;:0.4145345349053334,&quot;mode&quot;:6,&quot;color&quot;:0,&quot;size&quot;:0.33015479876161,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.8290263587898108},{&quot;id&quot;:6,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.8305020942563069,&quot;y&quot;:0.4871433546868461,&quot;mode&quot;:6,&quot;color&quot;:0,&quot;size&quot;:0.23015479876160996,&quot;speed&quot;:0.7520123839009291,&quot;power&quot;:0.9400619195046442,&quot;seed&quot;:0.7917747146546521},{&quot;id&quot;:7,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:58,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.12108359133126904,&quot;bright&quot;:0.8707739938080495,&quot;seed&quot;:0.6736798311959769,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.1977982469034936,0.36976448604811846],[0.22531258065052864,0.3727341919084327],[0.22294028058201035,0.4174268335356168],[0.1977982469034936,0.4197396296397461]],&quot;style&quot;:0,&quot;hex&quot;:&quot;#ffffff&quot;,&quot;fade&quot;:0.4847191011235958,&quot;transp&quot;:0,&quot;rsize&quot;:0.5,&quot;rstr&quot;:1},{&quot;id&quot;:9,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:38,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.43780185758513956,&quot;bright&quot;:0.7173684210526317,&quot;seed&quot;:0.6250162503122356,&quot;mode&quot;:0,&quot;pic&quot;:1,&quot;pts&quot;:[[0.07959771995968788,0.0698228060836349],[0.2941152028740443,0.12866872505964344],[0.40607344701426956,0.46473933524819167],[0.06733959268709307,0.39964994575352675]],&quot;style&quot;:0,&quot;hex&quot;:&quot;#ffffff&quot;,&quot;transp&quot;:0.014794007490636875,&quot;rsize&quot;:0.6,&quot;rstr&quot;:0.4,&quot;fade&quot;:0.5714981273408236},{&quot;id&quot;:10,&quot;type&quot;:&quot;mask&quot;,&quot;pts&quot;:[[0.2859432884549459,0.28994983300460425],[0.2941152028740443,0.39964994575352675],[0.27695382469241153,0.39964994575352675],[0.2761367866368701,0.27832610038965316]],&quot;feather&quot;:0.2,&quot;invert&quot;:0,&quot;all&quot;:true,&quot;only&quot;:[],&quot;transp&quot;:0,&quot;seed&quot;:0.12030407372010887},{&quot;id&quot;:12,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:12,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.5,&quot;seed&quot;:0.23831761547963537,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.30772802892572915,0.5],[0.3219006322171888,0.5],[0.3206745638459821,0.5841789734065184],[0.2941152028740443,0.5995380219597866]],&quot;style&quot;:0,&quot;hex&quot;:&quot;#ffffff&quot;,&quot;fade&quot;:0.4847191011235958,&quot;transp&quot;:0.709213483146067},{&quot;id&quot;:13,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.2079937784675618,&quot;y&quot;:0.5525967869597399,&quot;mode&quot;:6,&quot;color&quot;:0,&quot;size&quot;:0.4006811145510838,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.2753054499702705,&quot;transp&quot;:0.6942322097378273,&quot;hex&quot;:&quot;#ff3b3b&quot;},{&quot;id&quot;:14,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.43980919839139404,&quot;y&quot;:0.5325984326886085,&quot;mode&quot;:6,&quot;color&quot;:0,&quot;size&quot;:0.4006811145510838,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.7848621007886631,&quot;transp&quot;:0.6942322097378273,&quot;hex&quot;:&quot;#ff3b3b&quot;},{&quot;id&quot;:15,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.5735592933617311,&quot;y&quot;:0.5325984326886085,&quot;mode&quot;:6,&quot;color&quot;:0,&quot;size&quot;:0.46068111455108385,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.09550059227826546,&quot;transp&quot;:0.6942322097378273,&quot;hex&quot;:&quot;#ff3b3b&quot;},{&quot;id&quot;:16,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:34,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.8979876160990711,&quot;bright&quot;:0.5,&quot;seed&quot;:0.27917615233252024,&quot;mode&quot;:0,&quot;pic&quot;:1,&quot;pts&quot;:[[0.9065806296078425,0.4354315918058512],[0.9453965708285855,0.4208958829507377],[0.9876705012875298,0.47820254278263213],[0.9968937294322523,0.6648276661417959],[0.9976583244661476,0.8978262212255335],[0.8816009732363225,0.8493136013642364],[0.8812167522098558,0.548996975128994],[0.887365250388084,0.47820254278263213]],&quot;qa&quot;:0.636071546480598,&quot;style&quot;:0,&quot;rsize&quot;:0.18294117647058797,&quot;rstr&quot;:0.29427244582043327},{&quot;id&quot;:17,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.870744967430404,&quot;y&quot;:0.21752585223821505,&quot;mode&quot;:2,&quot;color&quot;:0,&quot;size&quot;:0.23999999999999996,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.1356327932488426,&quot;transp&quot;:0.5984644194756553},{&quot;id&quot;:18,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.870744967430404,&quot;y&quot;:0.19307035534479267,&quot;mode&quot;:2,&quot;color&quot;:0,&quot;size&quot;:0.19999999999999998,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.7555023778846328,&quot;transp&quot;:0.5984644194756553},{&quot;id&quot;:19,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.8488928865083181,&quot;y&quot;:0.32099468495933103,&quot;mode&quot;:2,&quot;color&quot;:0,&quot;size&quot;:0.19999999999999998,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.9442479673689548,&quot;transp&quot;:0.5984644194756553},{&quot;id&quot;:20,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.8488928865083181,&quot;y&quot;:0.33541916561666624,&quot;mode&quot;:2,&quot;color&quot;:0,&quot;size&quot;:0.23999999999999996,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.6186864568208974,&quot;transp&quot;:0.5984644194756553},{&quot;id&quot;:21,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.7579941215940931,&quot;y&quot;:0.39964994575352675,&quot;mode&quot;:2,&quot;color&quot;:0,&quot;size&quot;:0.23999999999999996,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.39659493815146796,&quot;transp&quot;:0.5984644194756553},{&quot;id&quot;:22,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:18,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.5,&quot;seed&quot;:0.03652522617881915,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.9446535453859496,0.4871433546868461],[0.9588649325656006,0.49992849116144394],[0.9639346811819595,0.5525967869597399],[0.9087660257661797,0.5525967869597399],[0.9185692068429238,0.5]],&quot;rsize&quot;:0.5,&quot;rstr&quot;:0.5,&quot;style&quot;:0,&quot;qa&quot;:0.5854848338785311},{&quot;id&quot;:23,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:40,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.5,&quot;seed&quot;:0.03613934292583787,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.6296867469967812,0.6175447777318371],[0.6522387612729618,0.6634961523499352],[0.660699808996446,0.8598337488727458],[0.48823954682543175,0.7755142769491195]],&quot;rsize&quot;:0.6,&quot;rstr&quot;:0.5,&quot;style&quot;:0,&quot;hex&quot;:&quot;#ffd59a&quot;,&quot;fade&quot;:0.6433333333333333,&quot;transp&quot;:0.8379026217228466},{&quot;id&quot;:24,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:56,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.5,&quot;seed&quot;:0.6927821282483542,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.3829610857035188,0.21061167835965863],[0.4611332610973065,0.21752585223821505],[0.45975410092499724,0.3060023235162172],[0.3829610857035188,0.3129083070599364]],&quot;rsize&quot;:0.4,&quot;rstr&quot;:0.4,&quot;style&quot;:0,&quot;fade&quot;:0.3529962546816479},{&quot;id&quot;:25,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:17,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.3833436532507738,&quot;bright&quot;:0.5,&quot;seed&quot;:0.45499713124036667,&quot;mode&quot;:0,&quot;pic&quot;:1,&quot;pts&quot;:[[0.15643171174968976,0.44977797437269623],[0.26144308726623433,0.46473933524819167],[0.24101304557454123,0.5],[0.13681870811353805,0.5]],&quot;rsize&quot;:0.09634674922600585,&quot;rstr&quot;:0.12108359133126904,&quot;style&quot;:1},{&quot;id&quot;:26,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:57,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.5,&quot;seed&quot;:0.05286294898701116,&quot;mode&quot;:0,&quot;pic&quot;:1,&quot;pts&quot;:[[0.4254659998335673,0.33541916561666624],[0.45975410092499724,0.32099468495933103],[0.4611332610973065,0.3727341919084327],[0.4254659998335673,0.36976448604811846]],&quot;rsize&quot;:0.75,&quot;rstr&quot;:0.4,&quot;style&quot;:0,&quot;fade&quot;:0.6403745318352061},{&quot;id&quot;:27,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:19,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.10625386996904006,&quot;bright&quot;:0.5,&quot;seed&quot;:0.6796545415142685,&quot;mode&quot;:0,&quot;pic&quot;:1,&quot;pts&quot;:[[0.37171863989606957,0.24322140869197123],[0.4493536163851348,0.27546003513163103],[0.4477195402740519,0.5297323674305864],[0.37893840209507984,0.5497307217017178]],&quot;rsize&quot;:0.16563467492260062,&quot;rstr&quot;:0.07656346749226012,&quot;style&quot;:0},{&quot;id&quot;:11,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:22,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.6431578947368422,&quot;bright&quot;:0.5,&quot;seed&quot;:0.8249355885984428,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.1895123463852704,0.44759920622458566],[0.24835186858162,0.44977797437269623],[0.2761367866368701,0.5275128224305031],[0.1287247200622084,0.5325984326886085]],&quot;rsize&quot;:0.3,&quot;rstr&quot;:0.5,&quot;style&quot;:0,&quot;hex&quot;:&quot;#ffd59a&quot;},{&quot;id&quot;:28,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:56,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.5,&quot;seed&quot;:0.6454812642661327,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.13681870811353805,0.26746785734784073],[0.2149908835073258,0.27438203122639715],[0.21361172333501657,0.36285850250439927],[0.13681870811353805,0.36976448604811846]],&quot;rsize&quot;:0.4,&quot;rstr&quot;:0.4,&quot;style&quot;:0,&quot;fade&quot;:0.3529962546816479},{&quot;id&quot;:29,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:12,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.992012383900929,&quot;seed&quot;:0.3680553844383918,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.607361401098962,0.4551349503172345],[0.6175066269339364,0.4567358153914777],[0.6276804833057472,0.5445932671030259],[0.590394324674332,0.5534337716822552]],&quot;style&quot;:0,&quot;hex&quot;:&quot;#ff9a3c&quot;,&quot;fade&quot;:0.4996629213483149,&quot;transp&quot;:0.33205992509363325},{&quot;id&quot;:30,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:58,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.4699690402476779,&quot;bright&quot;:0.8014860681114554,&quot;seed&quot;:0.9546070622659018,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.3292501860785373,0.616245861328264],[0.4715068007099633,0.616245861328264],[0.4923364309634699,0.786491105000227],[0.3194051287351183,0.7568304816488483]],&quot;rsize&quot;:1,&quot;rstr&quot;:0.5,&quot;style&quot;:0,&quot;hex&quot;:&quot;#ffd59a&quot;,&quot;fade&quot;:1},{&quot;id&quot;:31,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:58,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.5,&quot;seed&quot;:0.4773811292071921,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.6569304491375533,0.7613169665323409],[0.8369304491375532,0.7613169665323409],[0.8369304491375532,0.9013169665323411],[0.6569304491375533,0.9013169665323411]],&quot;rsize&quot;:0.5,&quot;rstr&quot;:0.5,&quot;style&quot;:0,&quot;hex&quot;:&quot;#ffd59a&quot;},{&quot;id&quot;:32,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:14,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.5,&quot;seed&quot;:0.7661879856454132,&quot;mode&quot;:3,&quot;pic&quot;:0,&quot;pts&quot;:[[0.9176726436940237,0.6363178710903751],[0.9614463452566097,0.6560458306968868],[0.9609765483746733,0.8142728271665552],[0.9176726436940237,0.7971503753659727]],&quot;style&quot;:0,&quot;hex&quot;:&quot;#ff3b3b&quot;,&quot;fade&quot;:0.8438951310861421,&quot;transp&quot;:0.15546816479400746},{&quot;id&quot;:33,&quot;type&quot;:&quot;light&quot;,&quot;x&quot;:0.9832682953570271,&quot;y&quot;:0.34949100093726637,&quot;mode&quot;:3,&quot;color&quot;:0,&quot;size&quot;:0.3,&quot;speed&quot;:0.4,&quot;power&quot;:0.5,&quot;seed&quot;:0.5321849724982537,&quot;transp&quot;:0.5714981273408236},{&quot;id&quot;:34,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:23,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.5,&quot;seed&quot;:0.014375182827784716,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.5264440124416797,0.18883151892172112],[0.6640321201281134,0.17321603904444324],[0.7029284603421462,0.2849587005356834],[0.49910108864696734,0.34572801105927076]],&quot;style&quot;:0,&quot;rsize&quot;:0.6,&quot;rstr&quot;:0.5,&quot;fade&quot;:0.855880149812734,&quot;transp&quot;:0.8169662921348319},{&quot;id&quot;:35,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:56,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.5,&quot;seed&quot;:0.3301003062822687,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.294365836409573,0.36533127340579485],[0.32606829126933323,0.3615098769679051],[0.32606829126933323,0.4560903352859166],[0.2903360456691439,0.4489250675514999]],&quot;rsize&quot;:0.4,&quot;rstr&quot;:0.4,&quot;style&quot;:0,&quot;fade&quot;:0.3529962546816479},{&quot;id&quot;:36,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:56,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.5,&quot;seed&quot;:0.01681159639014007,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.401696675448095,0.34302316348022366],[0.46627165997132475,0.30292186913397995],[0.46689023133717017,0.49024452315447875],[0.40386167522855426,0.521556605693576]],&quot;rsize&quot;:0.4,&quot;rstr&quot;:0.4,&quot;style&quot;:0,&quot;fade&quot;:0.3529962546816479},{&quot;id&quot;:37,&quot;type&quot;:&quot;mask&quot;,&quot;pts&quot;:[[0.3558682762916213,0.2782128766689304],[0.3718448981639294,0.3450503845045949],[0.37513406431856255,0.39267214803624445],[0.36244660860088757,0.438622477354647],[0.32886578212876416,0.4348737660666591],[0.32967194198490407,0.310199063733399]],&quot;feather&quot;:0.2,&quot;invert&quot;:0,&quot;all&quot;:true,&quot;only&quot;:[],&quot;transp&quot;:0,&quot;seed&quot;:0.8324168474533831},{&quot;id&quot;:38,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:53,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:1,&quot;bright&quot;:0.5,&quot;seed&quot;:0.14679896022408045,&quot;mode&quot;:0,&quot;pic&quot;:1,&quot;pts&quot;:[[0.412819310474589,-0.00026531992867131864],[0.7222550189497897,-0.003206179942344865],[0.8124748356760875,0.12796220705896139],[0.412819310474589,0.13973468007132875]],&quot;rsize&quot;:1,&quot;rstr&quot;:0.8930340557275543,&quot;style&quot;:0},{&quot;id&quot;:39,&quot;type&quot;:&quot;board&quot;,&quot;fx&quot;:21,&quot;color&quot;:7,&quot;text&quot;:0,&quot;speed&quot;:0.35,&quot;bright&quot;:0.1013003095975233,&quot;seed&quot;:0.6620092650292415,&quot;mode&quot;:0,&quot;pic&quot;:0,&quot;pts&quot;:[[0.2876023540725455,0.004312660768027754],[0.8176431893584659,-0.005712808612367592],[0.8246930824929048,0.31928341034263974],[0.35902676763491703,0.3359935712763275]],&quot;rsize&quot;:0.5,&quot;rstr&quot;:0,&quot;style&quot;:2}],&quot;next&quot;:41,&quot;edit&quot;:true,&quot;sel&quot;:0,&quot;px&quot;:1264,&quot;py&quot;:16,&quot;lx&quot;:16,&quot;ly&quot;:16,&quot;lscroll&quot;:0,&quot;bg&quot;:&quot;C:\\Users\\Danny\\Downloads\\scene_mario.png&quot;,&quot;edges&quot;:false,&quot;efilter&quot;:0,&quot;esens&quot;:0.35,&quot;ewidth&quot;:0.3,&quot;snap&quot;:false,&quot;dock&quot;:true,&quot;openP&quot;:true,&quot;openL&quot;:true,&quot;dscroll&quot;:0,&quot;zoom&quot;:1,&quot;panX&quot;:0,&quot;panY&quot;:0,&quot;tlOpen&quot;:false,&quot;auOpen&quot;:false,&quot;ausens&quot;:0.5,&quot;palette&quot;:[],&quot;cmode&quot;:0,&quot;snd&quot;:{&quot;file&quot;:&quot;&quot;,&quot;loop&quot;:true,&quot;vol&quot;:0.85,&quot;playing&quot;:false},&quot;fxCat&quot;:4,&quot;fxCatFor&quot;:39}"/>
        </node>
        <node id="3" type="File" title="Background File" expanded="0" x="-1500.0"
              y="0.0" w="320.0" h="220.0">
          <state filePath="C:/Users/Danny/Downloads/scene_mario.png" pickMode="0"
                 triggerOnLoad="1" fileOut="0.0"/>
        </node>
        <node id="5" type="audio.in" title="Audio In" expanded="0" x="-700.0"
              y="1150.0" w="220.0" h="120.0">
          <state channels="2"/>
        </node>
        <node id="6" type="audio.out" title="Audio Out" expanded="0" x="-300.0"
              y="1150.0" w="220.0" h="120.0">
          <state channels="2"/>
        </node>
        <node id="7" type="cv.transport" title="Transport" expanded="0" x="-700.0"
              y="1400.0" w="260.0" h="422.0">
          <state syncMode="0" trPlay="0" trBpm="120.0" trTimeSigNum="4" trTimeSigDen="4"/>
        </node>
        <node id="8" type="audio.player" title="Sound Player" expanded="0"
              x="-700.0" y="1750.0" w="420.0" h="640.0">
          <state appearanceRow="0.0" loop="1" playAgain="0" jumpFade="0.0" start="0.0"
                 end="1.0" pitch="0.0" fine="0.0" speed="1.0" stretch="0" viewZoom="1.0"
                 viewOffset="0.0" visible="1" showRange="1" bodyAlpha="1.0" thumbCornerRadiusMode="0"
                 thumbCornerRadius="0.0" selectionCornerRadiusMode="0" selectionCornerRadius="0.0"
                 bodyBgColour="FF10161B" bodyWaveColour="FF87D6FF" bodySelectionColour="FFFFD86B"
                 bodyPlayheadColour="FFF7F4E9" bodyFrameColour="3359D4C8" volume="-0.8999999761581421"
                 cv_pos_row="0.0" out_l_row="0.0" out_r_row="0.0" out_phase_row="0.0"
                 panelX="0.0" panelY="0.0" panelW="0.0" panelH="0.0" start01="0.0"
                 end01="1.0" pitchSemis="0.0" volumeDb="-0.8999999761581421" fineCents="0.0"
                 playing="0" panel_visible="1"/>
        </node>
        <node id="4" type="widget.textinput" title="Colour Code" expanded="0"
              x="-1560.0" y="300.0" w="420.0" h="136.0">
          <state ioRow="0.0" exposeToDAW="0" textInRow="0.0" sendRow="0.0" setRow="0.0"
                 appearanceRow="0.0" text="" placeholder="#RRGGBBAA or 255, 128, 0"
                 emitOnChange="1" multiline="0" keepFocus="0" visible="1" backgroundMode="0"
                 backgroundColour="FF101517" backgroundFromColour="FF101517" backgroundToColour="FF101517"
                 backgroundAngle="0.0" backgroundStart="0.0" backgroundEnd="100.0"
                 backgroundCentreX="50.0" backgroundCentreY="50.0" backgroundRadius="100.0"
                 borderMode="0" borderColour="3359D4C8" borderFromColour="3359D4C8"
                 borderToColour="3359D4C8" borderPaintEnd="100.0" borderCentreX="50.0"
                 borderCentreY="50.0" borderPaintRadius="100.0" borderWidth="0.0"
                 cornerRadius="6.0" padding="8.0" textColour="FFEAF8F7" textSize="18.0"
                 fontStyle="0" justification="0" showSendButton="1" sendLabel="Apply"
                 buttonColour="00000000" buttonWidth="0.0" buttonTextSize="0.0"
                 tooltip="" tooltipVisible="1" tooltipBgColour="" tooltipTextColour=""
                 tooltipBorderColour="" tooltipRadius="-1" tooltipTextSize="-1"
                 labelShow="0" labelText="" labelPos="0" labelColour="00000000"
                 labelSize="12.0" labelGap="4.0" labelOffsetX="0.0" labelOffsetY="0.0"
                 panelX="0.0" panelY="0.0" panelW="0.0" panelH="0.0" backgroundPaint="{&#13;&#10;  &quot;mode&quot;: 0,&#13;&#10;  &quot;colour&quot;: &quot;FF101517&quot;,&#13;&#10;  &quot;from&quot;: &quot;FF101517&quot;,&#13;&#10;  &quot;to&quot;: &quot;FF101517&quot;,&#13;&#10;  &quot;angle&quot;: 0.0,&#13;&#10;  &quot;start&quot;: 0.0,&#13;&#10;  &quot;end&quot;: 100.0,&#13;&#10;  &quot;centreX&quot;: 50.0,&#13;&#10;  &quot;centreY&quot;: 50.0,&#13;&#10;  &quot;radius&quot;: 100.0&#13;&#10;}"
                 borderPaint="{&#13;&#10;  &quot;mode&quot;: 0,&#13;&#10;  &quot;colour&quot;: &quot;3359D4C8&quot;,&#13;&#10;  &quot;from&quot;: &quot;3359D4C8&quot;,&#13;&#10;  &quot;to&quot;: &quot;3359D4C8&quot;,&#13;&#10;  &quot;angle&quot;: 0.0,&#13;&#10;  &quot;start&quot;: 0.0,&#13;&#10;  &quot;end&quot;: 100.0,&#13;&#10;  &quot;centreX&quot;: 50.0,&#13;&#10;  &quot;centreY&quot;: 50.0,&#13;&#10;  &quot;radius&quot;: 100.0&#13;&#10;}"
                 fontFamily="" panel_visible="1"/>
        </node>
      </nodes>
      <ui>
        <selection primary="0"/>
        <edgeSelection hasPrimary="0"/>
      </ui>
      <edges>
        <e fn="2" fp="20" tn="1" tp="6"/>
        <e fn="2" fp="21" tn="3" tp="1"/>
        <e fn="3" fp="4" tn="2" tp="1"/>
        <e fn="4" fp="3" tn="2" tp="2"/>
        <e fn="5" fp="0" tn="1" tp="0"/>
        <e fn="5" fp="0" tn="6" tp="0"/>
        <e fn="5" fp="1" tn="6" tp="1"/>
        <e fn="7" fp="2" tn="1" tp="119"/>
        <e fn="7" fp="1" tn="1" tp="120"/>
        <e fn="7" fp="7" tn="1" tp="121"/>
        <e fn="2" fp="22" tn="8" tp="10"/>
        <e fn="2" fp="23" tn="8" tp="11"/>
        <e fn="2" fp="24" tn="8" tp="16"/>
        <e fn="2" fp="25" tn="8" tp="12"/>
        <e fn="2" fp="26" tn="8" tp="24"/>
        <e fn="8" fp="0" tn="1" tp="0"/>
        <e fn="8" fp="0" tn="6" tp="0"/>
        <e fn="8" fp="1" tn="6" tp="1"/>
      </edges>
      <panel width="1920" height="1080" locked="1" zoom="1.0" performScale="1.0"
             gridSize="5.0" gridEnabled="0" toolbarExpanded="1" toolbarX="-1"
             toolbarY="-1" toolbarW="0" toolbarH="0" panelBgColour="ff000000"
             gridColour="0" gridInFront="1">
        <entry nodeId="1" x="0.0" y="0.0" w="1920.0" h="1080.0" z="0" auto="0"
               locked="1"/>
      </panel>
      <audioPreview loop="0" autoplay="1" gain="1.0"/>
      <PanelLayout enabledPanels="11" leftWidth="370" rightWidth="300" topHeight="200"
                   bottomHeight="200" showLeft="0" showRight="1" showTop="0" showBottom="0"/>
    </marionietoworld.MNodes_State>
  </state>
</MNPreset>
