[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"github-stars":3,"guide-nav":5,"doc-\u002Fdocs\u002Fprimitives\u002Fcompose":129},{"stars":4},5505,[6,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,72,76,80,84,88,93,97,101,105,109,113,117,121,125],{"path":7,"title":8,"description":9,"category":10},"\u002Fdocs\u002Fguide","Getting started","Shaders is a library of GPU effect components for Vue, React, Svelte, Solid, JavaScript and Framer, with a design editor for building with them.","code",{"path":12,"title":13,"description":14,"category":10},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":16,"title":17,"description":18,"category":10},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":20,"title":21,"description":22,"category":10},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":24,"title":25,"description":26,"category":10},"\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":28,"title":29,"description":30,"category":10},"\u002Fdocs\u002Fguide\u002Fdynamic-props","Dynamic props","Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":32,"title":33,"description":34,"category":10},"\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":36,"title":37,"description":38,"category":10},"\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":40,"title":41,"description":42,"category":10},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":44,"title":45,"description":46,"category":10},"\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":48,"title":49,"description":50,"category":10},"\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":52,"title":53,"description":54,"category":10},"\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":56,"title":57,"description":58,"category":10},"\u002Fdocs\u002Fguide\u002Fperformance","Performance","Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":60,"title":61,"description":62,"category":10},"\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":64,"title":65,"description":66,"category":10},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":68,"title":69,"description":70,"category":71},"\u002Fdocs\u002Fguide\u002Fmcp","Shaders MCP","Connect your AI coding agent to Shaders so it can find, install and edit effects in your codebase.","workflows",{"path":73,"title":74,"description":75,"category":71},"\u002Fdocs\u002Fguide\u002Fcli","Shaders CLI","Install your own shaders and Pro shaders into your codebase as component files, and keep them in sync with the design editor.",{"path":77,"title":78,"description":79,"category":71},"\u002Fdocs\u002Fguide\u002Fagent-skill","Agent skill","Give your coding agent a skill that teaches it to build with Shaders components, the CLI and Pro shaders.",{"path":81,"title":82,"description":83,"category":10},"\u002Fdocs\u002Fguide\u002Fvideo-rendering","Rendering to video","Turn a shader effect into a video file, from the design editor or from a frame-by-frame pipeline such as Remotion, Hyperframes or Puppeteer.",{"path":85,"title":86,"description":87,"category":10},"\u002Fdocs\u002Fguide\u002Fssr","Server rendering","Render Shaders in Next.js, Nuxt, SvelteKit, SolidStart and other SSR apps by keeping each shader on the client.",{"path":89,"title":90,"description":91,"category":92},"\u002Fdocs\u002Fguide\u002Fquick-tour-of-the-design-editor","Quick tour of the design editor","A short walkthrough of the full Shaders workflow, from designing on the infinite canvas to exporting code.","editor",{"path":94,"title":95,"description":96,"category":92},"\u002Fdocs\u002Fguide\u002Fintro-to-the-interface","Intro to the interface","A tour of the design editor interface: the canvas, layers, the Properties panel, and the ways to share and export.",{"path":98,"title":99,"description":100,"category":92},"\u002Fdocs\u002Fguide\u002Fcomposing-your-first-shader-effect","Composing your first shader effect","Building a first shader effect in the design editor by stacking and nesting components as layers.",{"path":102,"title":103,"description":104,"category":92},"\u002Fdocs\u002Fguide\u002Fmasking-and-blending","Masking and blending","How blend modes and masks combine components in the design editor.",{"path":106,"title":107,"description":108,"category":92},"\u002Fdocs\u002Fguide\u002Fdynamic-prop-mapping","Dynamic prop mapping","Turning static props into dynamic ones in the design editor: mapping one layer's output into another's prop, following the cursor, or animating automatically.",{"path":110,"title":111,"description":112,"category":92},"\u002Fdocs\u002Fguide\u002Fcustom-media-and-transformations","Custom media and transformations","Uploading images, videos, and SVG files to the media gallery, adding them to a composition, and placing them with transformations.",{"path":114,"title":115,"description":116,"category":92},"\u002Fdocs\u002Fguide\u002Finstalling-a-shader-via-mcp","Installing a shader via MCP","Installing a shader from the design editor into a hero section with the Shaders MCP.",{"path":118,"title":119,"description":120,"category":92},"\u002Fdocs\u002Fguide\u002Fexploring-shape-effects","Exploring shape effects","Applying shape effects such as liquid glass, liquid metal, and glowing edges to built-in shapes and your own SVG.",{"path":122,"title":123,"description":124,"category":92},"\u002Fdocs\u002Fguide\u002Fglass-component-spotlight","Component spotlight: Glass","A short look at the Glass component and the liquid-glass look it creates.",{"path":126,"title":127,"description":128,"category":92},"\u002Fdocs\u002Fguide\u002Fdigital-looks-component-spotlight","Component spotlight: Digital looks","A look at the digital stylization components for glitchy, futuristic, or technical effects.",{"id":130,"title":131,"body":132,"categoryId":824,"categorySlug":824,"categoryTitle":825,"curated":322,"description":826,"editUrl":827,"extension":828,"group":829,"groupTitle":830,"kind":825,"meta":831,"navigation":322,"path":832,"seo":833,"sourceUrl":834,"stem":835,"wordCount":359,"__hash__":836},"primitives\u002Fdocs\u002Fprimitives\u002F10.compose\u002Findex.md","Layering & output",{"type":133,"value":134,"toc":818},"minimark",[135,139,162,199,228,233,297,301,743,747,774,778,814],[136,137,131],"h1",{"id":138},"layering-output",[140,141,142,143,146,147,154,155,161],"p",{},"The words that finish a ",[10,144,145],{},"paint:"," function. ",[148,149,151],"a",{"href":150},"\u002Fdocs\u002Fprimitives\u002Fcompose\u002Flayers",[10,152,153],{},"layers"," stacks several colors into one, back to\nfront, each with an optional opacity and an optional factor it is seen through. ",[148,156,158],{"href":157},"\u002Fdocs\u002Fprimitives\u002Fcompose\u002Flayered",[10,159,160],{},"layered","\nbuilds N variations of one recipe from a data list and sums them, which is how curtains,\ncloud banks and echo trails get their depth cheaply.",[140,163,164,165,169,170,176,177,183,184,188,189,193,194,198],{},"Light is emitted, so it should composite ",[166,167,168],"em",{},"over"," what is behind the layer rather than replace\nit. ",[148,171,173],{"href":172},"\u002Fdocs\u002Fprimitives\u002Fcompose\u002Femissivealpha",[10,174,175],{},"emissiveAlpha"," turns an rgb light value into a color with alpha that does exactly that.\n",[148,178,180],{"href":179},"\u002Fdocs\u002Fprimitives\u002Fcompose\u002Fdithered",[10,181,182],{},"dithered"," adds a trace of noise to the final color so long soft ramps show no banding. Use\nthem last: stack with ",[148,185,186],{"href":150},[10,187,153],{},", close with ",[148,190,191],{"href":172},[10,192,175],{},", then ",[148,195,196],{"href":179},[10,197,182],{},".",[200,201,206],"pre",{"className":202,"code":203,"language":204,"meta":205,"style":205},"language-ts shiki shiki-themes github-dark","import {compose} from 'shaders\u002Fstd'\n","ts","",[10,207,208],{"__ignoreMap":205},[209,210,213,217,221,224],"span",{"class":211,"line":212},"line",1,[209,214,216],{"class":215},"snl16","import",[209,218,220],{"class":219},"s95oV"," {compose} ",[209,222,223],{"class":215},"from",[209,225,227],{"class":226},"sU2Wk"," 'shaders\u002Fstd'\n",[229,230,232],"h2",{"id":231},"reach-for-it-when","Reach for it when",[234,235,236,249],"table",{},[237,238,239],"thead",{},[240,241,242,246],"tr",{},[243,244,245],"th",{},"When you need",[243,247,248],{},"Use",[250,251,252,264,275,286],"tbody",{},[240,253,254,258],{},[255,256,257],"td",{},"several glows or paints stacked into one image",[255,259,260],{},[148,261,262],{"href":150},[10,263,153],{},[240,265,266,269],{},[255,267,268],{},"the same recipe repeated with different offsets and weights",[255,270,271],{},[148,272,273],{"href":157},[10,274,160],{},[240,276,277,280],{},[255,278,279],{},"a glow that should composite over transparency",[255,281,282],{},[148,283,284],{"href":172},[10,285,175],{},[240,287,288,291],{},[255,289,290],{},"visible steps in a long soft gradient",[255,292,293],{},[148,294,295],{"href":179},[10,296,182],{},[229,298,300],{"id":299},"example","Example",[200,302,304],{"className":202,"code":303,"language":204,"meta":205,"style":205},"import {defineShader, p, light, compose, math, transformColor, transformPosition} from 'shaders\u002Fstd'\n\nconst {radialFrame, withFrame, glowPoint} = light\nconst {layers, emissiveAlpha, dithered} = compose\n\n\u002F\u002F Two soft glows, the second screened over the first, drawn as emitted light and dithered.\nexport const TwinGlow = defineShader({\n  name: 'TwinGlow',\n  animatedTime: {speed: 'speed'},\n  props: {\n    centerA: {default: {x: 0.35, y: 0.5}, transform: transformPosition},\n    centerB: {default: {x: 0.65, y: 0.5}, transform: transformPosition},\n    colorA: {default: '#ff7a18', transform: transformColor},\n    colorB: {default: '#3b82f6', transform: transformColor},\n    sharpness: {default: 6},\n    speed: {default: 0},\n  },\n  paint: (params) => {\n    const glowA = withFrame(radialFrame(p('centerA')), glowPoint({sharpness: p('sharpness')}), 'glowA')(params)\n    const glowB = withFrame(radialFrame(p('centerB')), glowPoint({sharpness: p('sharpness')}), 'glowB')(params)\n    const rgb = layers([\n      {paint: math.mul(params.uniforms.colorA.member('rgb'), glowA)},\n      {paint: math.mul(params.uniforms.colorB.member('rgb'), glowB), blend: 'screen'},\n    ])\n    return dithered(emissiveAlpha(rgb), params)\n  },\n})\n",[10,305,306,317,324,357,381,386,393,415,427,439,445,463,478,490,501,512,523,529,551,603,647,663,686,710,716,732,737],{"__ignoreMap":205},[209,307,308,310,313,315],{"class":211,"line":212},[209,309,216],{"class":215},[209,311,312],{"class":219}," {defineShader, p, light, compose, math, transformColor, transformPosition} ",[209,314,223],{"class":215},[209,316,227],{"class":226},[209,318,320],{"class":211,"line":319},2,[209,321,323],{"emptyLinePlaceholder":322},true,"\n",[209,325,327,330,333,337,340,343,345,348,351,354],{"class":211,"line":326},3,[209,328,329],{"class":215},"const",[209,331,332],{"class":219}," {",[209,334,336],{"class":335},"sDLfK","radialFrame",[209,338,339],{"class":219},", ",[209,341,342],{"class":335},"withFrame",[209,344,339],{"class":219},[209,346,347],{"class":335},"glowPoint",[209,349,350],{"class":219},"} ",[209,352,353],{"class":215},"=",[209,355,356],{"class":219}," light\n",[209,358,360,362,364,366,368,370,372,374,376,378],{"class":211,"line":359},4,[209,361,329],{"class":215},[209,363,332],{"class":219},[209,365,153],{"class":335},[209,367,339],{"class":219},[209,369,175],{"class":335},[209,371,339],{"class":219},[209,373,182],{"class":335},[209,375,350],{"class":219},[209,377,353],{"class":215},[209,379,380],{"class":219}," compose\n",[209,382,384],{"class":211,"line":383},5,[209,385,323],{"emptyLinePlaceholder":322},[209,387,389],{"class":211,"line":388},6,[209,390,392],{"class":391},"sAwPA","\u002F\u002F Two soft glows, the second screened over the first, drawn as emitted light and dithered.\n",[209,394,396,399,402,405,408,412],{"class":211,"line":395},7,[209,397,398],{"class":215},"export",[209,400,401],{"class":215}," const",[209,403,404],{"class":335}," TwinGlow",[209,406,407],{"class":215}," =",[209,409,411],{"class":410},"svObZ"," defineShader",[209,413,414],{"class":219},"({\n",[209,416,418,421,424],{"class":211,"line":417},8,[209,419,420],{"class":219},"  name: ",[209,422,423],{"class":226},"'TwinGlow'",[209,425,426],{"class":219},",\n",[209,428,430,433,436],{"class":211,"line":429},9,[209,431,432],{"class":219},"  animatedTime: {speed: ",[209,434,435],{"class":226},"'speed'",[209,437,438],{"class":219},"},\n",[209,440,442],{"class":211,"line":441},10,[209,443,444],{"class":219},"  props: {\n",[209,446,448,451,454,457,460],{"class":211,"line":447},11,[209,449,450],{"class":219},"    centerA: {default: {x: ",[209,452,453],{"class":335},"0.35",[209,455,456],{"class":219},", y: ",[209,458,459],{"class":335},"0.5",[209,461,462],{"class":219},"}, transform: transformPosition},\n",[209,464,466,469,472,474,476],{"class":211,"line":465},12,[209,467,468],{"class":219},"    centerB: {default: {x: ",[209,470,471],{"class":335},"0.65",[209,473,456],{"class":219},[209,475,459],{"class":335},[209,477,462],{"class":219},[209,479,481,484,487],{"class":211,"line":480},13,[209,482,483],{"class":219},"    colorA: {default: ",[209,485,486],{"class":226},"'#ff7a18'",[209,488,489],{"class":219},", transform: transformColor},\n",[209,491,493,496,499],{"class":211,"line":492},14,[209,494,495],{"class":219},"    colorB: {default: ",[209,497,498],{"class":226},"'#3b82f6'",[209,500,489],{"class":219},[209,502,504,507,510],{"class":211,"line":503},15,[209,505,506],{"class":219},"    sharpness: {default: ",[209,508,509],{"class":335},"6",[209,511,438],{"class":219},[209,513,515,518,521],{"class":211,"line":514},16,[209,516,517],{"class":219},"    speed: {default: ",[209,519,520],{"class":335},"0",[209,522,438],{"class":219},[209,524,526],{"class":211,"line":525},17,[209,527,528],{"class":219},"  },\n",[209,530,532,535,538,542,545,548],{"class":211,"line":531},18,[209,533,534],{"class":410},"  paint",[209,536,537],{"class":219},": (",[209,539,541],{"class":540},"s9osk","params",[209,543,544],{"class":219},") ",[209,546,547],{"class":215},"=>",[209,549,550],{"class":219}," {\n",[209,552,554,557,560,562,565,568,570,572,574,576,579,582,584,587,589,591,594,597,600],{"class":211,"line":553},19,[209,555,556],{"class":215},"    const",[209,558,559],{"class":335}," glowA",[209,561,407],{"class":215},[209,563,564],{"class":410}," withFrame",[209,566,567],{"class":219},"(",[209,569,336],{"class":410},[209,571,567],{"class":219},[209,573,140],{"class":410},[209,575,567],{"class":219},[209,577,578],{"class":226},"'centerA'",[209,580,581],{"class":219},")), ",[209,583,347],{"class":410},[209,585,586],{"class":219},"({sharpness: ",[209,588,140],{"class":410},[209,590,567],{"class":219},[209,592,593],{"class":226},"'sharpness'",[209,595,596],{"class":219},")}), ",[209,598,599],{"class":226},"'glowA'",[209,601,602],{"class":219},")(params)\n",[209,604,606,608,611,613,615,617,619,621,623,625,628,630,632,634,636,638,640,642,645],{"class":211,"line":605},20,[209,607,556],{"class":215},[209,609,610],{"class":335}," glowB",[209,612,407],{"class":215},[209,614,564],{"class":410},[209,616,567],{"class":219},[209,618,336],{"class":410},[209,620,567],{"class":219},[209,622,140],{"class":410},[209,624,567],{"class":219},[209,626,627],{"class":226},"'centerB'",[209,629,581],{"class":219},[209,631,347],{"class":410},[209,633,586],{"class":219},[209,635,140],{"class":410},[209,637,567],{"class":219},[209,639,593],{"class":226},[209,641,596],{"class":219},[209,643,644],{"class":226},"'glowB'",[209,646,602],{"class":219},[209,648,650,652,655,657,660],{"class":211,"line":649},21,[209,651,556],{"class":215},[209,653,654],{"class":335}," rgb",[209,656,407],{"class":215},[209,658,659],{"class":410}," layers",[209,661,662],{"class":219},"([\n",[209,664,666,669,672,675,678,680,683],{"class":211,"line":665},22,[209,667,668],{"class":219},"      {paint: math.",[209,670,671],{"class":410},"mul",[209,673,674],{"class":219},"(params.uniforms.colorA.",[209,676,677],{"class":410},"member",[209,679,567],{"class":219},[209,681,682],{"class":226},"'rgb'",[209,684,685],{"class":219},"), glowA)},\n",[209,687,689,691,693,696,698,700,702,705,708],{"class":211,"line":688},23,[209,690,668],{"class":219},[209,692,671],{"class":410},[209,694,695],{"class":219},"(params.uniforms.colorB.",[209,697,677],{"class":410},[209,699,567],{"class":219},[209,701,682],{"class":226},[209,703,704],{"class":219},"), glowB), blend: ",[209,706,707],{"class":226},"'screen'",[209,709,438],{"class":219},[209,711,713],{"class":211,"line":712},24,[209,714,715],{"class":219},"    ])\n",[209,717,719,722,725,727,729],{"class":211,"line":718},25,[209,720,721],{"class":215},"    return",[209,723,724],{"class":410}," dithered",[209,726,567],{"class":219},[209,728,175],{"class":410},[209,730,731],{"class":219},"(rgb), params)\n",[209,733,735],{"class":211,"line":734},26,[209,736,528],{"class":219},[209,738,740],{"class":211,"line":739},27,[209,741,742],{"class":219},"})\n",[229,744,746],{"id":745},"types","Types",[234,748,749,759],{},[237,750,751],{},[240,752,753,756],{},[243,754,755],{},"Type",[243,757,758],{},"What it is",[250,760,761],{},[240,762,763,768],{},[255,764,765],{},[10,766,767],{},"Layer",[255,769,770,771,773],{},"One entry in ",[10,772,153],{},": a color, or a color with options.",[229,775,777],{"id":776},"words","Words",[779,780,782],"primitive-words",{":words":781},"[{\"name\":\"layers\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fcompose\u002Flayers\",\"summary\":\"Stacks colors into one, first entry at the back.\"},{\"name\":\"emissiveAlpha\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fcompose\u002Femissivealpha\",\"summary\":\"Turns an rgb light value into a color with alpha, so glows composite over transparency.\"},{\"name\":\"dithered\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fcompose\u002Fdithered\",\"summary\":\"Adds a tiny amount of noise to a final color so long soft gradients show no banding.\"},{\"name\":\"layered\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fcompose\u002Flayered\",\"summary\":\"Builds N variations of one thing from a data list and sums them with weights.\"}]",[783,784,785,793,800,807],"ul",{},[786,787,788,792],"li",{},[148,789,790],{"href":150},[10,791,153],{}," — Stacks colors into one, first entry at the back.",[786,794,795,799],{},[148,796,797],{"href":172},[10,798,175],{}," — Turns an rgb light value into a color with alpha, so glows composite over transparency.",[786,801,802,806],{},[148,803,804],{"href":179},[10,805,182],{}," — Adds a tiny amount of noise to a final color so long soft gradients show no banding.",[786,808,809,813],{},[148,810,811],{"href":157},[10,812,160],{}," — Builds N variations of one thing from a data list and sums them with weights.",[815,816,817],"style",{},"html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}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 .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}",{"title":205,"searchDepth":319,"depth":319,"links":819},[820,821,822,823],{"id":231,"depth":319,"text":232},{"id":299,"depth":319,"text":300},{"id":745,"depth":319,"text":746},{"id":776,"depth":319,"text":777},"compose",null,"The words that finish a paint: function. layers stacks several colors into one, back to front, each with an optional opacity and an optional factor it is seen through. layered builds N variations of one recipe from a data list and sums them, which is how curtains, cloud banks and echo trails get their depth cheaply.","https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fedit\u002Fmain\u002Fpackages\u002Fcore\u002Fdocs\u002Fstd\u002Fcompose.md","md","paint","Painting",{},"\u002Fdocs\u002Fprimitives\u002Fcompose",{"title":131,"description":826},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Fpaint\u002Fcompose.ts","docs\u002Fprimitives\u002F10.compose\u002Findex","bibwR532OkuwZb-HFeG_KMPoy263OgDZKtUJQSJ1IWY"]