[{"data":1,"prerenderedAt":449,"buildId":450},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fcomponents\u002Fprismaticglass":3,"github-stars":357,"guide-nav":359},{"id":4,"title":5,"body":6,"category":348,"componentType":349,"description":16,"extension":350,"meta":351,"navigation":271,"path":352,"requiresChild":271,"seo":353,"sourceUrl":354,"stem":355,"__hash__":356},"components\u002Fdocs\u002Fcomponents\u002FPrismaticGlass.md","PrismaticGlass",{"type":7,"value":8,"toc":344},"minimark",[9,13,17,20,25,29,33,340],[10,11,5],"h1",{"id":12},"prismaticglass",[14,15,16],"p",{},"Physically traced prismatic glass: every colour refracts through the front and back faces on its own, light trapped inside escapes as spectral fire, a studio reflects in the surface under a shifting thin-film coat, and the glass can cast a colour-split caustic on what lies behind it",[18,19],"shader-preview",{"component":5},[21,22,24],"h2",{"id":23},"props","Props",[26,27],"props-table",{":props":28},"[{\"name\":\"origin\",\"type\":\"string\",\"default\":\"center\",\"description\":\"Reference edge the center position is measured from (center default). Lets you pin the shape relative to a corner or the canvas centre.\"},{\"name\":\"center\",\"type\":\"{x: number | string, y: number | string}\",\"default\":\"{\\\"x\\\":0.5,\\\"y\\\":0.5}\",\"description\":\"Center position of the glass shape. Accepts CSS units, see [Sizing and units](\u002Fdocs\u002Fguide\u002Fsizing-and-units).\"},{\"name\":\"scale\",\"type\":\"number\",\"default\":\"1\",\"description\":\"Scale of the glass shape (1 = default size)\"},{\"name\":\"rotation\",\"type\":\"number\",\"default\":\"0\",\"range\":\"0 to 360\",\"description\":\"Rotation of the glass shape in degrees\"},{\"name\":\"refraction\",\"type\":\"number\",\"default\":\"1.6\",\"description\":\"Index of refraction: 1.33 water, 1.5 window glass, 1.7 flint, 2.4 diamond. Higher bends the layers beneath more and traps more light inside as fire.\"},{\"name\":\"dispersion\",\"type\":\"number\",\"default\":\"0.75\",\"description\":\"How far the glass splits white light into a spectrum: rainbow fringes on every edge it bends, colour in the fire and the caustic. 0 is clear, colourless glass.\"},{\"name\":\"backdrop\",\"type\":\"number\",\"default\":\"0.3\",\"description\":\"How far behind the glass the layers beneath sit. Further bends and inverts them more, like a ball lens, and pushes the cast shadow further away.\"},{\"name\":\"bevel\",\"type\":\"number\",\"default\":\"0.12\",\"description\":\"Width of the rounded glass edge on flat shapes and logos (3D shapes use their real form)\"},{\"name\":\"edgeSoftness\",\"type\":\"number\",\"default\":\"0.25\",\"description\":\"How gently the glass fades into the layers beneath at its outline: 0 is a crisp, anti-aliased edge, higher melts the rim into the backdrop\"},{\"name\":\"tintColor\",\"type\":\"string\",\"default\":\"#ffffff\",\"description\":\"The colour the glass body absorbs toward, deeper where the glass is thicker. White is clear glass.\"},{\"name\":\"absorption\",\"type\":\"number\",\"default\":\"1\",\"description\":\"How strongly the tint colours the glass: 0 keeps it clear, higher reads as thick coloured glass (amber, emerald, smoke)\"},{\"name\":\"reflections\",\"type\":\"number\",\"default\":\"1\",\"description\":\"Brightness of the studio the glass reflects: the softbox and strip lights on its surface and in the light bouncing inside it\"},{\"name\":\"innerFire\",\"type\":\"number\",\"default\":\"1.2\",\"description\":\"Light the back faces reflect and send back out through the front: the spectral sparkle inside a gem\"},{\"name\":\"coating\",\"type\":\"number\",\"default\":\"0.3\",\"description\":\"A thin-film coat on the surface whose colour shifts with the viewing angle, like a lens coating or a soap skin\"},{\"name\":\"keyColor\",\"type\":\"string\",\"default\":\"#fff3e4\",\"description\":\"Colour of the key softbox the glass reflects and the light it casts\"},{\"name\":\"rimColor\",\"type\":\"string\",\"default\":\"#9ec2ff\",\"description\":\"Colour of the strip lights at the sides, which draw the glass rim\"},{\"name\":\"lightAngle\",\"type\":\"number\",\"default\":\"225\",\"description\":\"Where the key light comes from, in degrees clockwise from the right (225 = upper left). The cast shadow falls the other way.\"},{\"name\":\"caustics\",\"type\":\"number\",\"default\":\"0\",\"description\":\"The soft shadow and the focused, colour-split light the glass casts on the layers behind it. Reads best when those layers look like a lit surface: a wall, paper, a studio sweep. 0 is off and costs nothing.\"},{\"name\":\"speed\",\"type\":\"number\",\"default\":\"1\",\"range\":\"0 to 4\",\"description\":\"Speed of the slowly swaying key light and the flowing coat. 0 holds them still.\"},{\"name\":\"shape\",\"type\":\"ShapeConfig\",\"default\":\"sphere3D\",\"description\":\"Shape to render — choose from 11 built-in analytical shapes or supply a custom SDF. See the [Shape Effects guide](\u002Fdocs\u002Fguide\u002Fshape-effects) for all available shapes and their options.\"},{\"name\":\"shapeSdfUrl\",\"type\":\"string\",\"default\":\"\\\"\\\"\",\"description\":\"URL to a pre-generated SDF `.bin` file — when non-empty, activates SVG mode and triggers a shader recompile. See the [Shape Effects guide](\u002Fdocs\u002Fguide\u002Fshape-effects) for how to generate an SDF from an SVG.\"}]",[21,30,32],{"id":31},"usage","Usage",[34,35,37,105,152,198,244],"code-group",{":tabs":36},"[\"Vue\", \"React\", \"Svelte\", \"Solid\", \"JS\"]",[38,39,44],"pre",{"className":40,"code":41,"language":42,"meta":43,"style":43},"language-vue-html shiki shiki-themes github-dark","\u003CShader>\n  \u003CPrismaticGlass>\n    \u003CCircle \u002F>\n  \u003C\u002FPrismaticGlass>\n\u003C\u002FShader>\n","vue-html","",[45,46,47,63,73,85,95],"code",{"__ignoreMap":43},[48,49,52,56,60],"span",{"class":50,"line":51},"line",1,[48,53,55],{"class":54},"s95oV","\u003C",[48,57,59],{"class":58},"s4JwU","Shader",[48,61,62],{"class":54},">\n",[48,64,66,69,71],{"class":50,"line":65},2,[48,67,68],{"class":54},"  \u003C",[48,70,5],{"class":58},[48,72,62],{"class":54},[48,74,76,79,82],{"class":50,"line":75},3,[48,77,78],{"class":54},"    \u003C",[48,80,81],{"class":58},"Circle",[48,83,84],{"class":54}," \u002F>\n",[48,86,88,91,93],{"class":50,"line":87},4,[48,89,90],{"class":54},"  \u003C\u002F",[48,92,5],{"class":58},[48,94,62],{"class":54},[48,96,98,101,103],{"class":50,"line":97},5,[48,99,100],{"class":54},"\u003C\u002F",[48,102,59],{"class":58},[48,104,62],{"class":54},[38,106,109],{"className":107,"code":41,"language":108,"meta":43,"style":43},"language-jsx shiki shiki-themes github-dark","jsx",[45,110,111,120,128,136,144],{"__ignoreMap":43},[48,112,113,115,118],{"class":50,"line":51},[48,114,55],{"class":54},[48,116,59],{"class":117},"sDLfK",[48,119,62],{"class":54},[48,121,122,124,126],{"class":50,"line":65},[48,123,68],{"class":54},[48,125,5],{"class":117},[48,127,62],{"class":54},[48,129,130,132,134],{"class":50,"line":75},[48,131,78],{"class":54},[48,133,81],{"class":117},[48,135,84],{"class":54},[48,137,138,140,142],{"class":50,"line":87},[48,139,90],{"class":54},[48,141,5],{"class":117},[48,143,62],{"class":54},[48,145,146,148,150],{"class":50,"line":97},[48,147,100],{"class":54},[48,149,59],{"class":117},[48,151,62],{"class":54},[38,153,156],{"className":154,"code":41,"language":155,"meta":43,"style":43},"language-svelte shiki shiki-themes github-dark","svelte",[45,157,158,166,174,182,190],{"__ignoreMap":43},[48,159,160,162,164],{"class":50,"line":51},[48,161,55],{"class":54},[48,163,59],{"class":117},[48,165,62],{"class":54},[48,167,168,170,172],{"class":50,"line":65},[48,169,68],{"class":54},[48,171,5],{"class":117},[48,173,62],{"class":54},[48,175,176,178,180],{"class":50,"line":75},[48,177,78],{"class":54},[48,179,81],{"class":117},[48,181,84],{"class":54},[48,183,184,186,188],{"class":50,"line":87},[48,185,90],{"class":54},[48,187,5],{"class":117},[48,189,62],{"class":54},[48,191,192,194,196],{"class":50,"line":97},[48,193,100],{"class":54},[48,195,59],{"class":117},[48,197,62],{"class":54},[38,199,202],{"className":200,"code":41,"language":201,"meta":43,"style":43},"language-tsx shiki shiki-themes github-dark","tsx",[45,203,204,212,220,228,236],{"__ignoreMap":43},[48,205,206,208,210],{"class":50,"line":51},[48,207,55],{"class":54},[48,209,59],{"class":117},[48,211,62],{"class":54},[48,213,214,216,218],{"class":50,"line":65},[48,215,68],{"class":54},[48,217,5],{"class":117},[48,219,62],{"class":54},[48,221,222,224,226],{"class":50,"line":75},[48,223,78],{"class":54},[48,225,81],{"class":117},[48,227,84],{"class":54},[48,229,230,232,234],{"class":50,"line":87},[48,231,90],{"class":54},[48,233,5],{"class":117},[48,235,62],{"class":54},[48,237,238,240,242],{"class":50,"line":97},[48,239,100],{"class":54},[48,241,59],{"class":117},[48,243,62],{"class":54},[38,245,249],{"className":246,"code":247,"language":248,"meta":43,"style":43},"language-javascript shiki shiki-themes github-dark","import { createShader } from 'shaders\u002Fjs'\n\nconst shader = await createShader(canvas, {\n  components: [\n    { type: 'PrismaticGlass', props: {}, children: [\n      { type: 'Circle', props: {} }\n    ]}\n  ]\n})\n","javascript",[45,250,251,267,273,294,299,310,322,328,334],{"__ignoreMap":43},[48,252,253,257,260,263],{"class":50,"line":51},[48,254,256],{"class":255},"snl16","import",[48,258,259],{"class":54}," { createShader } ",[48,261,262],{"class":255},"from",[48,264,266],{"class":265},"sU2Wk"," 'shaders\u002Fjs'\n",[48,268,269],{"class":50,"line":65},[48,270,272],{"emptyLinePlaceholder":271},true,"\n",[48,274,275,278,281,284,287,291],{"class":50,"line":75},[48,276,277],{"class":255},"const",[48,279,280],{"class":117}," shader",[48,282,283],{"class":255}," =",[48,285,286],{"class":255}," await",[48,288,290],{"class":289},"svObZ"," createShader",[48,292,293],{"class":54},"(canvas, {\n",[48,295,296],{"class":50,"line":87},[48,297,298],{"class":54},"  components: [\n",[48,300,301,304,307],{"class":50,"line":97},[48,302,303],{"class":54},"    { type: ",[48,305,306],{"class":265},"'PrismaticGlass'",[48,308,309],{"class":54},", props: {}, children: [\n",[48,311,313,316,319],{"class":50,"line":312},6,[48,314,315],{"class":54},"      { type: ",[48,317,318],{"class":265},"'Circle'",[48,320,321],{"class":54},", props: {} }\n",[48,323,325],{"class":50,"line":324},7,[48,326,327],{"class":54},"    ]}\n",[48,329,331],{"class":50,"line":330},8,[48,332,333],{"class":54},"  ]\n",[48,335,337],{"class":50,"line":336},9,[48,338,339],{"class":54},"})\n",[341,342,343],"style",{},"html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .s4JwU, html code.shiki .s4JwU{--shiki-default:#85E89D}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}",{"title":43,"searchDepth":65,"depth":65,"links":345},[346,347],{"id":23,"depth":65,"text":24},{"id":31,"depth":65,"text":32},"Shape Effects","Filter\u002FEffect","md",{},"\u002Fdocs\u002Fcomponents\u002Fprismaticglass",{"title":5,"description":16},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fshaders\u002FPrismaticGlass\u002Findex.ts","docs\u002Fcomponents\u002FPrismaticGlass","UgMDn1bCfp8I3-UFXbhjzpJwQlAJqJahzaWZnvFUGsI",{"stars":358},6080,[360,364,368,372,376,380,384,388,392,396,400,404,408,412,416,420,424,429,433,437,441,445],{"path":361,"title":362,"description":363,"category":45},"\u002Fdocs\u002Fguide","Getting started","Shaders is a desktop app where your AI agent designs interactive effects on an infinite canvas, and you shape them by hand.",{"path":365,"title":366,"description":367,"category":45},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":369,"title":370,"description":371,"category":45},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":373,"title":374,"description":375,"category":45},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":377,"title":378,"description":379,"category":45},"\u002Fdocs\u002Fguide\u002Fprops-reactivity","Props and reactivity","Bind props to your framework's state so effects update when it changes, and animate props with an animation library.",{"path":381,"title":382,"description":383,"category":45},"\u002Fdocs\u002Fguide\u002Fanimation","Animating a shader","Tween a shader's props with Motion, GSAP or anything else that animates a number.",{"path":385,"title":386,"description":387,"category":45},"\u002Fdocs\u002Fguide\u002Fdynamic-props","Dynamic props","Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":389,"title":390,"description":391,"category":45},"\u002Fdocs\u002Fguide\u002Flayout-positioning","Layout and positioning","Size and place a shader in your page with CSS, as a background, a fill, or an inline block.",{"path":393,"title":394,"description":395,"category":45},"\u002Fdocs\u002Fguide\u002Fsizing-and-units","Sizing and units","Size and place layers in CSS units (px, %, vw, rem, and canvas units) that stay correct as the canvas and window resize.",{"path":397,"title":398,"description":399,"category":45},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":401,"title":402,"description":403,"category":45},"\u002Fdocs\u002Fguide\u002Fshape-effects","Shape effects","Pick the 2D, 3D or custom SVG shape that Glass, Neon, Emboss and other shape effects draw inside.",{"path":405,"title":406,"description":407,"category":45},"\u002Fdocs\u002Fguide\u002Fcolor-space","Color space","Match colors to your design tool with the output color space, and keep bright layers from clipping with tone mapping.",{"path":409,"title":410,"description":411,"category":45},"\u002Fdocs\u002Fguide\u002Fhooks-events","Hooks and events","Run code when an effect is ready to show, and show a fallback when the GPU can't run it.",{"path":413,"title":414,"description":415,"category":45},"\u002Fdocs\u002Fguide\u002Fperformance","Performance","Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":417,"title":418,"description":419,"category":45},"\u002Fdocs\u002Fguide\u002Fcustom-shaders","Custom components","Write your own component in TypeScript, use it like any component in the library, and write WGSL by hand when you need to.",{"path":421,"title":422,"description":423,"category":45},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":425,"title":426,"description":427,"category":428},"\u002Fdocs\u002Fguide\u002Fmcp","Working with your agent","The Shaders MCP connects your AI agent to the desktop app, so it can design shaders on your canvas and install them in your project.","workflows",{"path":430,"title":431,"description":432,"category":428},"\u002Fdocs\u002Fguide\u002Fcli","Working with the CLI","The Shaders CLI installs shaders from your projects and the Pro library into your codebase as component files, and keeps them in sync as you keep designing.",{"path":434,"title":435,"description":436,"category":428},"\u002Fdocs\u002Fguide\u002Fframeworks","Supported frameworks","Shaders runs in any web project that renders in a browser with WebGPU, with components for React, Vue, Svelte and Solid and a JavaScript API for everything else.",{"path":438,"title":439,"description":440,"category":45},"\u002Fdocs\u002Fguide\u002Fagent-skill","Agent skill for the engine","Teach your coding agent to write Shaders code with the open-source engine, for when it's working in your codebase instead of on the canvas.",{"path":442,"title":443,"description":444,"category":45},"\u002Fdocs\u002Fguide\u002Fvideo-rendering","Rendering to video","Render a shader effect to video frame by frame, from Remotion, Hyperframes or your own headless Chrome script.",{"path":446,"title":447,"description":448,"category":45},"\u002Fdocs\u002Fguide\u002Fssr","Server rendering","Render Shaders in Next.js, Nuxt, SvelteKit, SolidStart and other SSR apps by keeping each shader on the client.",1796051171084,"06e02370-81a6-4d74-9931-661d71414be1"]