{
  "format": "field",
  "version": 1,
  "meta": {
    "name": "Analog CRT Electron Beam Raster Deflection",
    "author": "Infinite",
    "description": "High-voltage electron beam deflection oscilloscope rendering phosphor trace persistence, magnetic yoke sweep distortion, and calibrated raster graticule lines.",
    "domain": "pixel"
  },
  "device": {
    "code": "param float deflection = 0.85 [0.2, 1.8];\nparam float scanlines = 240.0 [80.0, 360.0];\nparam float rasterScale = 12.0 [6.0, 24.0];\nparam float bloom = 1.75 [0.5, 3.0];\nparam float contrast = 1.25 [0.8, 1.8];\n\np = (uv - 0.5) * 2.0;\nr2 = p.x * p.x + p.y * p.y;\ndistortedP = p * (1.0 + r2 * 0.14);\n\nbezelFade = 1.0 - smoothstep(0.92, 0.98, max(abs(distortedP.x), abs(distortedP.y)));\n\ntime = t * 0.35;\n\n# Triple-harmonic Lissajous deflection figure (magnetic X-Y deflection coils)\ntheta = atan2(distortedP.y, distortedP.x);\nrad = length(distortedP);\n\ndeflectedY = sin(distortedP.x * 3.0 * 3.14159 + time * 0.7) * 0.42 * deflection;\ndeflectedX = cos(distortedP.y * 2.0 * 3.14159 - time * 0.5) * 0.42 * deflection;\n\nbeam1 = abs(distortedP.y - deflectedY);\nbeam2 = abs(distortedP.x - deflectedX);\nbeamOrbit = abs(rad - (0.48 + 0.12 * sin(theta * 5.0 + time)));\n\ng1 = 1.0 / (1.0 + beam1 * 26.0);\nc1 = 1.0 / (1.0 + beam1 * 95.0);\n\ng2 = 1.0 / (1.0 + beam2 * 26.0);\nc2 = 1.0 / (1.0 + beam2 * 95.0);\n\ngOrbit = 1.0 / (1.0 + beamOrbit * 30.0);\ncOrbit = 1.0 / (1.0 + beamOrbit * 110.0);\n\n# Oscilloscope coordinate graticule grid\ngratX = abs(sin(distortedP.x * rasterScale * 3.14159));\ngratY = abs(sin(distortedP.y * rasterScale * 3.14159));\ngridLine = (1.0 - smoothstep(0.92, 0.98, gratX)) + (1.0 - smoothstep(0.92, 0.98, gratY));\ngraticule = clamp(gridLine * 0.20, 0.0, 0.35);\n\n# Horizontal raster scanline modulation\nscanlineMod = 0.82 + 0.18 * sin(distortedP.y * scanlines * 3.14159);\n\n# Amber/Gold high-persistence CRT phosphor palette (#FFB000 / #FF7700)\ncAmber = vec3(1.0, 0.68, 0.12);\ncGold = vec3(1.0, 0.88, 0.45);\ncCore = vec3(1.0, 0.98, 0.85);\ncDark = vec3(0.05, 0.035, 0.02);\n\ncol1 = mix(cDark, cAmber, g1 * bloom * 0.7) + cCore * c1 * 0.6;\ncol2 = mix(vec3(0.0), cGold, g2 * bloom * 0.7) + cCore * c2 * 0.6;\ncolOrbit = mix(vec3(0.0), cAmber, gOrbit * bloom * 0.8) + cCore * cOrbit * 0.7;\n\ncombined = col1 + col2 + colOrbit + vec3(0.24, 0.16, 0.06) * graticule;\nfinalCol = combined * scanlineMod * bezelFade;\n\ncol = clamp(finalCol * contrast, 0.0, 1.0);\n",
    "params": {
      "deflection": 0.85,
      "scanlines": 240.0,
      "rasterScale": 12.0,
      "bloom": 1.75,
      "contrast": 1.25
    },
    "nodeSettings": {
      "width": 1080.0,
      "height": 1080.0,
      "animate": 1.0
    }
  }
}