{
  "schemaVersion": 1,
  "id": "kaleidoscope-tunnel",
  "version": "1.0.0",
  "status": "published",
  "kind": "background",
  "title": "Kaleidoscope Tunnel",
  "summary": "A tunnel lined with kaleidoscope mirrors: petals bloom in mirrored wedges and race towards you in rainbow colours. Loops perfectly.",
  "description": "A tunnel lined with kaleidoscope mirrors. Round the tunnel the picture is folded into mirrored wedges, down it the pattern repeats in rings that race towards you, and in every cell of the pattern a bloom of petals opens in colours that slide through the rainbow. The wedges turn by whole wedges, the rings pass in whole numbers and the colours make whole trips per loop. Choose the number of wedges, the colours (rainbow, neon, fire or ocean), the swirl, the rush, the colour cycle and the number of rings.",
  "role": "Shader background (three.js): a high-energy kaleidoscope for music, party and psychedelic content.",
  "collections": [
    "backgrounds",
    "hypnotic-loops"
  ],
  "tags": [
    "kaleidoscope",
    "tunnel",
    "mirror",
    "symmetry",
    "mandala",
    "rainbow",
    "psychedelic",
    "petals",
    "glow",
    "loop"
  ],
  "synonyms": [
    "kaleidoscopic tunnel",
    "mirror tunnel",
    "symmetry tunnel",
    "mandala tunnel",
    "vj loop",
    "psychedelic tunnel"
  ],
  "useCases": [
    "A music, VJ or party visual",
    "A psychedelic or meditative backdrop",
    "A transition with mirrored symmetry"
  ],
  "featured": null,
  "publishedAt": "2026-10-06",
  "implementation": {
    "target": "three",
    "runtime": "browser",
    "language": "javascript",
    "module": "esm",
    "entry": "src/kaleidoscope-tunnel.js",
    "exports": [
      {
        "name": "createKaleidoscopeTunnel",
        "signature": "createKaleidoscopeTunnel({ segments?, palette?, swirl?, rush?, cycle?, density? }) => { scene, camera, setSize(width, height), update(time, loopSeconds), dispose() }",
        "description": "The tunnel as one full-screen shader; render its scene with its camera, ideally through createBloomPass."
      },
      {
        "name": "createBloomPass",
        "signature": "createBloomPass(renderer, { width, height, glow?, exposure?, grain? }) => { render(scene, camera, output?), dispose() }",
        "description": "A small bloom with tone mapping and a fixed grain."
      },
      {
        "name": "PALETTES",
        "signature": "PALETTES: { rainbow, neon, fire, ocean }",
        "description": "Four-colour ramps cycled through the petals."
      }
    ],
    "reusable": [
      "src/kaleidoscope-tunnel.js"
    ],
    "demo": "demo.js",
    "harness": "index.html"
  },
  "dependencies": [
    {
      "id": "three",
      "version": "0.185.1",
      "reason": "Renderer and a full-screen shader material."
    },
    {
      "id": "apw-runtime",
      "version": "1.0.0",
      "scope": "demo",
      "reason": "Demo harness."
    }
  ],
  "params": [
    {
      "key": "segments",
      "label": "Mirrored wedges",
      "type": "integer",
      "min": 4,
      "max": 16,
      "step": 2,
      "default": 8
    },
    {
      "key": "palette",
      "label": "Colours",
      "type": "select",
      "default": "rainbow",
      "options": [
        {
          "value": "rainbow",
          "label": "Rainbow"
        },
        {
          "value": "neon",
          "label": "Neon"
        },
        {
          "value": "fire",
          "label": "Fire"
        },
        {
          "value": "ocean",
          "label": "Ocean"
        }
      ]
    },
    {
      "key": "swirl",
      "label": "Swirl",
      "help": "Whole wedges the pattern turns per loop; negative reverses it.",
      "type": "integer",
      "min": -3,
      "max": 3,
      "step": 1,
      "default": 1
    },
    {
      "key": "rush",
      "label": "Rush",
      "help": "Rings passing per loop.",
      "type": "integer",
      "min": 1,
      "max": 6,
      "step": 1,
      "default": 3
    },
    {
      "key": "cycle",
      "label": "Colour cycle",
      "help": "Whole trips round the colour ramp per loop.",
      "type": "integer",
      "min": 0,
      "max": 3,
      "step": 1,
      "default": 1
    },
    {
      "key": "density",
      "label": "Ring density",
      "type": "number",
      "min": 0.5,
      "max": 2,
      "step": 0.1,
      "default": 1
    }
  ],
  "presets": [
    {
      "id": "default",
      "label": "Rainbow, eight wedges",
      "params": {}
    },
    {
      "id": "neon",
      "label": "Neon, twelve wedges",
      "params": {
        "palette": "neon",
        "segments": 12,
        "swirl": 2
      }
    },
    {
      "id": "fire",
      "label": "Fire, slow",
      "params": {
        "palette": "fire",
        "rush": 1,
        "cycle": 0,
        "segments": 6
      }
    },
    {
      "id": "ocean",
      "label": "Ocean, dense",
      "params": {
        "palette": "ocean",
        "density": 1.8,
        "segments": 10,
        "swirl": -1
      }
    }
  ],
  "output": {
    "width": 1080,
    "height": 1080,
    "fps": 30,
    "durationSeconds": 12,
    "posterSeconds": 3,
    "alpha": false,
    "motion": "procedural",
    "loop": {
      "seamless": true,
      "cycleSeconds": 12,
      "method": "The pattern turns by whole wedges, the rings pass in whole numbers, the colours make whole trips round their ramp and the wedge count is even, so the last frame meets the first."
    },
    "seed": null
  },
  "composition": {
    "inputs": "Time within the loop; the wedges, colours, swirl, rush, colour cycle and ring density.",
    "outputs": "A full-frame shader image through a bloom pass.",
    "coordinates": "Screen-centred, ±1 vertically; the tunnel's axis points into the screen at the centre; distance down it is 0.42 / radius.",
    "lighting": "Self-lit; the bloom gives the glow.",
    "timing": "update(time, loopSeconds) sets the loop phase; frames render in any order.",
    "compatibleWith": [
      "kinetic-title",
      "number-reveal"
    ],
    "notes": [
      "Each cell is mirrored across the wedge so neighbouring wedges are reflections of one another."
    ]
  },
  "reuse": [
    "Party visual: Rainbow, eight wedges.",
    "Club: Neon, twelve wedges.",
    "Calmer: Fire, slow."
  ],
  "integration": {
    "newProject": "Create a WebGLRenderer, createKaleidoscopeTunnel() and createBloomPass(renderer, { width, height }); call tunnel.setSize(w, h) and each frame tunnel.update(time, loopSeconds) then bloom.render(tunnel.scene, tunnel.camera).",
    "existingProject": "Copy src/kaleidoscope-tunnel.js and render tunnel.scene with tunnel.camera into your own target."
  },
  "performance": {
    "notes": "One full-screen fragment shader with a few trigonometric calls and two pattern layers, plus the bloom: about 2 ms a frame at 1080² on an integrated Intel GPU.",
    "limits": "Software WebGL renders in about two seconds a frame."
  },
  "limitations": [
    "Fast kaleidoscopic motion can be uncomfortable for some viewers; keep the rush low for sensitive audiences.",
    "The centre is darkened rather than resolving into a point."
  ],
  "license": {
    "spdx": "MIT",
    "notice": "Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder.",
    "thirdParty": []
  },
  "provenance": "Adapted from the owner's threejs-sketches/shaders-backgrounds/kaleidoscope-tunnel (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original shader: mirrored wedges with petal cells repeating down a perspective tunnel, whole-wedge swirl, whole-ring rush and whole-trip colour cycle, on an exact loop.",
  "changelog": [
    {
      "version": "1.0.0",
      "date": "2026-10-05",
      "notes": "Initial release."
    }
  ]
}
