up:creative_coding
// ---- Bocchi the Rock! ยท Pride / Bokita Edition (vanilla Hydra + webcam) ----

s0.initCam()          // webcam -> src(s0)
a.setBins(4)          // 0=bass 1=lowMid 2=highMid 3=treble
a.setSmooth(0.9)
a.setScale(6)         // turn this up/down if audio reaction is weak/wild

// --- knobs (edit live, they're just globals) ---
anxiety = 2           // 0-10  glitch
speed   = 2           // 0.2-3 energy
kal     = 6           // 1-12  rock spirit
pride   = 2           // 0-5   rainbow

// --- custom coord function: hash-noise glitch (no lygia needed) ---
setFunction({
  name: 'bocchiGlitch',
  type: 'coord',
  inputs: [
    { name: 'amount', type: 'float', default: 0.1 },
    { name: 'freq',   type: 'float', default: 10.0 }
  ],
  glsl: `
    vec2 p = floor(_st * freq);
    float n = fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453 + time * 0.7);
    n = n * 2.0 - 1.0;
    return _st + vec2(n * amount, n * amount * 0.35);
  `
})

osc(20, 0.05, 1.5)
  .color(1.0, 0.6, 0.8)                                   // Bocchi pink
  .mult(osc(10, 0.1, 0.5).color(1.0, 0.2, 0.4))           // Kita red
  .diff(osc(15, -0.05, 1.0).color(0.2, 0.5, 1.0))         // Ryo blue
  .blend(osc(5, 0.2).color(1.0, 0.9, 0.2), 0.3)           // Nijika yellow
  .modulate(src(s0), 0.25)                                // camera warps the field
  .bocchiGlitch(
    () => anxiety * 0.02 + a.fft[3] * 0.15,
    () => 5.0 + a.fft[2] * 30.0
  )
  .kaleid(() => kal)
  .scale(() => 1.0 + a.fft[0] * 0.5)
  .rotate(0, () => speed * 0.1)
  .modulateScale(noise(2, 0.1), () => a.fft[0])
  .pixelate(
    () => 1000 - a.fft[0] * 800 * (anxiety / 10),
    () => 1000 - a.fft[0] * 800 * (anxiety / 10)
  )
  .blend(src(s0).colorama(() => pride * 0.05), 0.35)       // you, in the mix
  .colorama(() => pride * 0.1)
  .hue(() => time * 0.01 * pride)
  .out(o0)

created on: Sat Jul 18 2026