[{"data":1,"prerenderedAt":2269,"buildId":2270},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fguide\u002Fframeworks":3,"github-stars":2191,"guide-nav":2193},{"id":4,"title":5,"body":6,"category":2182,"description":16,"extension":2183,"icon":2184,"meta":2185,"navigation":452,"path":2187,"seo":2188,"stem":2189,"__hash__":2190},"guide\u002Fdocs\u002Fguide\u002F16.frameworks.md","Supported frameworks",{"type":7,"value":8,"toc":2168},"minimark",[9,13,17,25,30,37,125,128,153,179,183,193,337,357,368,372,380,399,406,521,541,548,717,722,726,729,856,859,869,872,875,879,884,907,1154,1163,1167,1177,1180,1354,1357,1366,1370,1376,1664,1682,1746,1749,1752,1756,1771,2114,2117,2124,2128,2131,2139,2143,2165],[10,11,5],"h1",{"id":12},"supported-frameworks",[14,15,16],"p",{},"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.",[14,18,19,20,24],{},"When your agent installs a shader, it writes it for the framework your project already uses. The setups below matter when you want to check support, or when a project can't run ",[21,22,23],"code",{},"npm install",", like a Framer site or a WordPress theme.",[26,27,29],"h2",{"id":28},"choosing-the-import-for-your-framework","Choosing the import for your framework",[14,31,32,33,36],{},"The ",[21,34,35],{},"shaders"," package has one entry point per UI library. Every entry point has the same components and props:",[38,39,40,56],"table",{},[41,42,43],"thead",{},[44,45,46,50,53],"tr",{},[47,48,49],"th",{},"Library",[47,51,52],{},"Import from",[47,54,55],{},"Works with",[57,58,59,73,86,99,112],"tbody",{},[44,60,61,65,70],{},[62,63,64],"td",{},"React",[62,66,67],{},[21,68,69],{},"shaders\u002Freact",[62,71,72],{},"React 18 and 19",[44,74,75,78,83],{},[62,76,77],{},"Vue",[62,79,80],{},[21,81,82],{},"shaders\u002Fvue",[62,84,85],{},"Vue 3.5 and later",[44,87,88,91,96],{},[62,89,90],{},"Svelte",[62,92,93],{},[21,94,95],{},"shaders\u002Fsvelte",[62,97,98],{},"Svelte 5",[44,100,101,104,109],{},[62,102,103],{},"Solid",[62,105,106],{},[21,107,108],{},"shaders\u002Fsolid",[62,110,111],{},"Solid 1.8 and later",[44,113,114,117,122],{},[62,115,116],{},"No library",[62,118,119],{},[21,120,121],{},"shaders\u002Fjs",[62,123,124],{},"Any page that runs JavaScript",[14,126,127],{},"Install the package with your package manager:",[129,130,135],"pre",{"className":131,"code":132,"language":133,"meta":134,"style":134},"language-bash shiki shiki-themes github-dark","npm install shaders\n","bash","",[21,136,137],{"__ignoreMap":134},[138,139,142,146,150],"span",{"class":140,"line":141},"line",1,[138,143,145],{"class":144},"svObZ","npm",[138,147,149],{"class":148},"sU2Wk"," install",[138,151,152],{"class":148}," shaders\n",[14,154,155,156,158,159,161,162,165,166,168,169,172,173,178],{},"A meta-framework uses the entry point of the library it's built on, so a Next.js app imports from ",[21,157,69],{}," and a Nuxt app from ",[21,160,82],{},". Plain JavaScript uses ",[21,163,164],{},"createShader"," from ",[21,167,121],{},", which takes a ",[21,170,171],{},"\u003Ccanvas>"," and the same components as a list. The ",[174,175,177],"a",{"href":176},"\u002Fdocs\u002Fguide\u002Fquickstart","quickstart"," shows the same effect written in all five.",[26,180,182],{"id":181},"using-a-meta-framework","Using a meta-framework",[14,184,185,188,189,192],{},[21,186,187],{},"npx shaders connect"," reads your ",[21,190,191],{},"package.json",", recognizes the frameworks below, and writes components where that framework expects them:",[38,194,195,210],{},[41,196,197],{},[44,198,199,202,204,207],{},[47,200,201],{},"Framework",[47,203,49],{},[47,205,206],{},"Components land in",[47,208,209],{},"Server rendering",[57,211,212,231,246,259,277,291,308,323],{},[44,213,214,217,219,224],{},[62,215,216],{},"Next.js",[62,218,64],{},[62,220,221],{},[21,222,223],{},"src\u002Fcomponents\u002Fshaders",[62,225,226,227,230],{},"Add ",[21,228,229],{},"'use client'"," to the shader's file",[44,232,233,236,238,243],{},[62,234,235],{},"Remix, React Router",[62,237,64],{},[62,239,240],{},[21,241,242],{},"app\u002Fcomponents\u002Fshaders",[62,244,245],{},"Works as is",[44,247,248,251,253,257],{},[62,249,250],{},"TanStack Start, Gatsby",[62,252,64],{},[62,254,255],{},[21,256,223],{},[62,258,245],{},[44,260,261,264,266,271],{},[62,262,263],{},"Nuxt",[62,265,77],{},[62,267,268],{},[21,269,270],{},"components\u002Fshaders",[62,272,273,274],{},"Wrap the shader in ",[21,275,276],{},"\u003CClientOnly>",[44,278,279,282,284,289],{},[62,280,281],{},"SvelteKit",[62,283,90],{},[62,285,286],{},[21,287,288],{},"src\u002Flib\u002Fcomponents\u002Fshaders",[62,290,245],{},[44,292,293,296,298,302],{},[62,294,295],{},"SolidStart",[62,297,103],{},[62,299,300],{},[21,301,223],{},[62,303,304,305],{},"Load the shader with ",[21,306,307],{},"clientOnly",[44,309,310,313,316,320],{},[62,311,312],{},"Astro",[62,314,315],{},"Any of the four",[62,317,318],{},[21,319,223],{},[62,321,322],{},"Use a client directive (below)",[44,324,325,328,330,334],{},[62,326,327],{},"Vite",[62,329,315],{},[62,331,332],{},[21,333,223],{},[62,335,336],{},"No server rendering",[14,338,339,340,343,344,348,349,352,353,356],{},"In a project without a ",[21,341,342],{},"src\u002F"," directory the folder moves up a level, as ",[174,345,347],{"href":346},"\u002Fdocs\u002Fguide\u002Fcli#connecting-a-project","Working with the CLI"," describes. You can change it with ",[21,350,351],{},"outDir"," in ",[21,354,355],{},"shaders.config.ts",".",[14,358,359,360,363,364,367],{},"WebGPU only exists in the browser, so a shader can't draw during a server render. Where the table says \"works as is\", ",[21,361,362],{},"\u003CShader>"," renders an empty element on the server and starts the GPU once it mounts in the browser. ",[174,365,209],{"href":366},"\u002Fdocs\u002Fguide\u002Fssr"," has the setup for each framework in full, including how to keep the Shaders bundle off the server entirely.",[26,369,371],{"id":370},"using-astro","Using Astro",[14,373,374,375,379],{},"Astro renders components from React, Vue, Svelte and Solid as ",[376,377,378],"strong",{},"islands",": parts of the page that load JavaScript in the browser. Add the integration for the library you want if your project doesn't have one yet:",[129,381,383],{"className":131,"code":382,"language":133,"meta":134,"style":134},"npx astro add react\n",[21,384,385],{"__ignoreMap":134},[138,386,387,390,393,396],{"class":140,"line":141},[138,388,389],{"class":144},"npx",[138,391,392],{"class":148}," astro",[138,394,395],{"class":148}," add",[138,397,398],{"class":148}," react\n",[14,400,401,402,405],{},"Then render the installed shader with ",[21,403,404],{},"client:only",", which skips the server render and mounts it in the browser:",[129,407,411],{"className":408,"code":409,"language":410,"meta":134,"style":134},"language-astro shiki shiki-themes github-dark","---\n\u002F\u002F src\u002Fpages\u002Findex.astro\nimport HeroShader from '..\u002Fcomponents\u002Fshaders\u002FHeroShader'\n---\n\n\u003Csection class=\"hero\">\n  \u003CHeroShader client:only=\"react\" \u002F>\n  \u003Ch1>Your content\u003C\u002Fh1>\n\u003C\u002Fsection>\n","astro",[21,412,413,419,425,442,447,454,476,497,511],{"__ignoreMap":134},[138,414,415],{"class":140,"line":141},[138,416,418],{"class":417},"sAwPA","---\n",[138,420,422],{"class":140,"line":421},2,[138,423,424],{"class":417},"\u002F\u002F src\u002Fpages\u002Findex.astro\n",[138,426,428,432,436,439],{"class":140,"line":427},3,[138,429,431],{"class":430},"snl16","import",[138,433,435],{"class":434},"s95oV"," HeroShader ",[138,437,438],{"class":430},"from",[138,440,441],{"class":148}," '..\u002Fcomponents\u002Fshaders\u002FHeroShader'\n",[138,443,445],{"class":140,"line":444},4,[138,446,418],{"class":417},[138,448,450],{"class":140,"line":449},5,[138,451,453],{"emptyLinePlaceholder":452},true,"\n",[138,455,457,460,464,467,470,473],{"class":140,"line":456},6,[138,458,459],{"class":434},"\u003C",[138,461,463],{"class":462},"s4JwU","section",[138,465,466],{"class":144}," class",[138,468,469],{"class":434},"=",[138,471,472],{"class":148},"\"hero\"",[138,474,475],{"class":434},">\n",[138,477,479,482,486,489,491,494],{"class":140,"line":478},7,[138,480,481],{"class":434},"  \u003C",[138,483,485],{"class":484},"sDLfK","HeroShader",[138,487,488],{"class":144}," client:only",[138,490,469],{"class":434},[138,492,493],{"class":148},"\"react\"",[138,495,496],{"class":434}," \u002F>\n",[138,498,500,502,504,507,509],{"class":140,"line":499},8,[138,501,481],{"class":434},[138,503,10],{"class":462},[138,505,506],{"class":434},">Your content\u003C\u002F",[138,508,10],{"class":462},[138,510,475],{"class":434},[138,512,514,517,519],{"class":140,"line":513},9,[138,515,516],{"class":434},"\u003C\u002F",[138,518,463],{"class":462},[138,520,475],{"class":434},[14,522,523,524,526,527,529,530,529,533,536,537,540],{},"Pass the library's name to ",[21,525,404],{}," (",[21,528,493],{},", ",[21,531,532],{},"\"vue\"",[21,534,535],{},"\"svelte\""," or ",[21,538,539],{},"\"solid\"","). Without a client directive, Astro sends the component as static HTML with no JavaScript, and the canvas never draws.",[14,542,543,544,547],{},"An Astro project with no UI integration can use the JavaScript API from a ",[21,545,546],{},"\u003Cscript>"," tag. Astro bundles the script and runs it only in the browser:",[129,549,551],{"className":408,"code":550,"language":410,"meta":134,"style":134},"\u003Ccanvas id=\"hero\" style=\"width: 100%; height: 480px\">\u003C\u002Fcanvas>\n\n\u003Cscript>\n  import { createShader } from 'shaders\u002Fjs'\n\n  const canvas = document.getElementById('hero') as HTMLCanvasElement\n\n  createShader(canvas, {\n    components: [\n      { type: 'LinearGradient', props: { colorA: '#0f172a', colorB: '#7c3aed' } },\n      { type: 'CursorTrail', props: {} },\n    ],\n  })\n\u003C\u002Fscript>\n",[21,552,553,582,586,595,608,612,644,648,656,661,685,696,702,708],{"__ignoreMap":134},[138,554,555,557,560,563,565,567,570,572,575,578,580],{"class":140,"line":141},[138,556,459],{"class":434},[138,558,559],{"class":462},"canvas",[138,561,562],{"class":144}," id",[138,564,469],{"class":434},[138,566,472],{"class":148},[138,568,569],{"class":144}," style",[138,571,469],{"class":434},[138,573,574],{"class":148},"\"width: 100%; height: 480px\"",[138,576,577],{"class":434},">\u003C\u002F",[138,579,559],{"class":462},[138,581,475],{"class":434},[138,583,584],{"class":140,"line":421},[138,585,453],{"emptyLinePlaceholder":452},[138,587,588,590,593],{"class":140,"line":427},[138,589,459],{"class":434},[138,591,592],{"class":462},"script",[138,594,475],{"class":434},[138,596,597,600,603,605],{"class":140,"line":444},[138,598,599],{"class":430},"  import",[138,601,602],{"class":434}," { createShader } ",[138,604,438],{"class":430},[138,606,607],{"class":148}," 'shaders\u002Fjs'\n",[138,609,610],{"class":140,"line":449},[138,611,453],{"emptyLinePlaceholder":452},[138,613,614,617,620,623,626,629,632,635,638,641],{"class":140,"line":456},[138,615,616],{"class":430},"  const",[138,618,619],{"class":484}," canvas",[138,621,622],{"class":430}," =",[138,624,625],{"class":434}," document.",[138,627,628],{"class":144},"getElementById",[138,630,631],{"class":434},"(",[138,633,634],{"class":148},"'hero'",[138,636,637],{"class":434},") ",[138,639,640],{"class":430},"as",[138,642,643],{"class":144}," HTMLCanvasElement\n",[138,645,646],{"class":140,"line":478},[138,647,453],{"emptyLinePlaceholder":452},[138,649,650,653],{"class":140,"line":499},[138,651,652],{"class":144},"  createShader",[138,654,655],{"class":434},"(canvas, {\n",[138,657,658],{"class":140,"line":513},[138,659,660],{"class":434},"    components: [\n",[138,662,664,667,670,673,676,679,682],{"class":140,"line":663},10,[138,665,666],{"class":434},"      { type: ",[138,668,669],{"class":148},"'LinearGradient'",[138,671,672],{"class":434},", props: { colorA: ",[138,674,675],{"class":148},"'#0f172a'",[138,677,678],{"class":434},", colorB: ",[138,680,681],{"class":148},"'#7c3aed'",[138,683,684],{"class":434}," } },\n",[138,686,688,690,693],{"class":140,"line":687},11,[138,689,666],{"class":434},[138,691,692],{"class":148},"'CursorTrail'",[138,694,695],{"class":434},", props: {} },\n",[138,697,699],{"class":140,"line":698},12,[138,700,701],{"class":434},"    ],\n",[138,703,705],{"class":140,"line":704},13,[138,706,707],{"class":434},"  })\n",[138,709,711,713,715],{"class":140,"line":710},14,[138,712,516],{"class":434},[138,714,592],{"class":462},[138,716,475],{"class":434},[14,718,719,721],{},[21,720,187],{}," asks which library to use when it can't find one, so in this setup ask your agent for the JavaScript version of a shader instead.",[26,723,725],{"id":724},"adding-a-shader-to-any-web-page","Adding a shader to any web page",[14,727,728],{},"Sites without a build step, like a WordPress theme, a Shopify theme or a Webflow page, can load Shaders from a CDN. The package includes a single-file build of the JavaScript API for this:",[129,730,734],{"className":731,"code":732,"language":733,"meta":134,"style":134},"language-html shiki shiki-themes github-dark","\u003Ccanvas id=\"hero\" style=\"display: block; width: 100%; height: 480px\">\u003C\u002Fcanvas>\n\n\u003Cscript type=\"module\">\n  import { createShader } from 'https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fshaders@5\u002Fdist\u002Fjs\u002Fbundle.js'\n\n  createShader(document.getElementById('hero'), {\n    components: [\n      { type: 'LinearGradient', props: { colorA: '#0f172a', colorB: '#7c3aed' } },\n      { type: 'CursorTrail', props: {} },\n    ],\n  })\n\u003C\u002Fscript>\n","html",[21,735,736,761,765,781,792,796,812,816,832,840,844,848],{"__ignoreMap":134},[138,737,738,740,742,744,746,748,750,752,755,757,759],{"class":140,"line":141},[138,739,459],{"class":434},[138,741,559],{"class":462},[138,743,562],{"class":144},[138,745,469],{"class":434},[138,747,472],{"class":148},[138,749,569],{"class":144},[138,751,469],{"class":434},[138,753,754],{"class":148},"\"display: block; width: 100%; height: 480px\"",[138,756,577],{"class":434},[138,758,559],{"class":462},[138,760,475],{"class":434},[138,762,763],{"class":140,"line":421},[138,764,453],{"emptyLinePlaceholder":452},[138,766,767,769,771,774,776,779],{"class":140,"line":427},[138,768,459],{"class":434},[138,770,592],{"class":462},[138,772,773],{"class":144}," type",[138,775,469],{"class":434},[138,777,778],{"class":148},"\"module\"",[138,780,475],{"class":434},[138,782,783,785,787,789],{"class":140,"line":444},[138,784,599],{"class":430},[138,786,602],{"class":434},[138,788,438],{"class":430},[138,790,791],{"class":148}," 'https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fshaders@5\u002Fdist\u002Fjs\u002Fbundle.js'\n",[138,793,794],{"class":140,"line":449},[138,795,453],{"emptyLinePlaceholder":452},[138,797,798,800,803,805,807,809],{"class":140,"line":456},[138,799,652],{"class":144},[138,801,802],{"class":434},"(document.",[138,804,628],{"class":144},[138,806,631],{"class":434},[138,808,634],{"class":148},[138,810,811],{"class":434},"), {\n",[138,813,814],{"class":140,"line":478},[138,815,660],{"class":434},[138,817,818,820,822,824,826,828,830],{"class":140,"line":499},[138,819,666],{"class":434},[138,821,669],{"class":148},[138,823,672],{"class":434},[138,825,675],{"class":148},[138,827,678],{"class":434},[138,829,681],{"class":148},[138,831,684],{"class":434},[138,833,834,836,838],{"class":140,"line":513},[138,835,666],{"class":434},[138,837,692],{"class":148},[138,839,695],{"class":434},[138,841,842],{"class":140,"line":663},[138,843,701],{"class":434},[138,845,846],{"class":140,"line":687},[138,847,707],{"class":434},[138,849,850,852,854],{"class":140,"line":698},[138,851,516],{"class":434},[138,853,592],{"class":462},[138,855,475],{"class":434},[14,857,858],{},"The canvas needs a size from CSS. Without one it has nothing to fill and draws at the browser's default of 300×150px.",[14,860,861,864,865,868],{},[21,862,863],{},"shaders@5"," loads the newest 5.x release, so you get fixes without editing the page. To lock the version, pin it in full, as in ",[21,866,867],{},"shaders@5.0.0",". The file is about 3MB before compression, and the browser caches it after the first visit.",[14,870,871],{},"Put the snippet wherever your platform accepts custom HTML: a Custom HTML block in WordPress, a Custom Liquid section in Shopify, or a Code Embed element in Webflow. Some platforms only allow custom scripts on paid plans, so check yours first.",[14,873,874],{},"To get a shader you designed in this form, ask your agent:",[876,877],"agent-prompt",{"prompt":878},"Give me my hero shader as a plain HTML snippet I can paste into WordPress.",[880,881,883],"h3",{"id":882},"adding-a-custom-component-to-the-page","Adding a custom component to the page",[14,885,886,887,890,891,894,895,899,900,902,903,906],{},"The same file includes ",[21,888,889],{},"defineShader"," and ",[21,892,893],{},"wgsl",", so a ",[174,896,898],{"href":897},"\u002Fdocs\u002Fguide\u002Fcustom-shaders","custom component"," works on a plain page too. Define it in the script and pass it to ",[21,901,164],{}," as the third argument, so its name resolves in ",[21,904,905],{},"components",":",[129,908,910],{"className":731,"code":909,"language":733,"meta":134,"style":134},"\u003Ccanvas id=\"hero\" style=\"display: block; width: 100%; height: 480px\">\u003C\u002Fcanvas>\n\n\u003Cscript type=\"module\">\n  import { createShader, defineShader, wgsl, transformColor, transformPosition } from 'https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fshaders@5\u002Fdist\u002Fjs\u002Fbundle.js'\n\n  const Halo = defineShader({\n    name: 'Halo',\n    props: {\n      color: { default: '#ffd166', transform: transformColor },\n      center: { default: { x: 0.5, y: 0.5 }, transform: transformPosition },\n      radius: { default: 0.6 },\n    },\n    paint: wgsl`\n      let d = length((uv - center) * vec2f(aspect, 1.0)) \u002F radius;\n      return vec4f(color.rgb, 1.0 - smoothstep(0.8, 1.0, d));\n    `,\n  })\n\n  createShader(document.getElementById('hero'), {\n    components: [\n      { type: 'LinearGradient', props: { colorA: '#0f172a', colorB: '#7c3aed' } },\n      { type: 'Halo', props: { radius: 0.4 } },\n    ],\n  }, { components: [Halo] })\n\u003C\u002Fscript>\n",[21,911,912,936,940,954,965,969,984,995,1000,1011,1027,1038,1043,1053,1058,1064,1072,1077,1082,1097,1102,1119,1134,1139,1145],{"__ignoreMap":134},[138,913,914,916,918,920,922,924,926,928,930,932,934],{"class":140,"line":141},[138,915,459],{"class":434},[138,917,559],{"class":462},[138,919,562],{"class":144},[138,921,469],{"class":434},[138,923,472],{"class":148},[138,925,569],{"class":144},[138,927,469],{"class":434},[138,929,754],{"class":148},[138,931,577],{"class":434},[138,933,559],{"class":462},[138,935,475],{"class":434},[138,937,938],{"class":140,"line":421},[138,939,453],{"emptyLinePlaceholder":452},[138,941,942,944,946,948,950,952],{"class":140,"line":427},[138,943,459],{"class":434},[138,945,592],{"class":462},[138,947,773],{"class":144},[138,949,469],{"class":434},[138,951,778],{"class":148},[138,953,475],{"class":434},[138,955,956,958,961,963],{"class":140,"line":444},[138,957,599],{"class":430},[138,959,960],{"class":434}," { createShader, defineShader, wgsl, transformColor, transformPosition } ",[138,962,438],{"class":430},[138,964,791],{"class":148},[138,966,967],{"class":140,"line":449},[138,968,453],{"emptyLinePlaceholder":452},[138,970,971,973,976,978,981],{"class":140,"line":456},[138,972,616],{"class":430},[138,974,975],{"class":484}," Halo",[138,977,622],{"class":430},[138,979,980],{"class":144}," defineShader",[138,982,983],{"class":434},"({\n",[138,985,986,989,992],{"class":140,"line":478},[138,987,988],{"class":434},"    name: ",[138,990,991],{"class":148},"'Halo'",[138,993,994],{"class":434},",\n",[138,996,997],{"class":140,"line":499},[138,998,999],{"class":434},"    props: {\n",[138,1001,1002,1005,1008],{"class":140,"line":513},[138,1003,1004],{"class":434},"      color: { default: ",[138,1006,1007],{"class":148},"'#ffd166'",[138,1009,1010],{"class":434},", transform: transformColor },\n",[138,1012,1013,1016,1019,1022,1024],{"class":140,"line":663},[138,1014,1015],{"class":434},"      center: { default: { x: ",[138,1017,1018],{"class":484},"0.5",[138,1020,1021],{"class":434},", y: ",[138,1023,1018],{"class":484},[138,1025,1026],{"class":434}," }, transform: transformPosition },\n",[138,1028,1029,1032,1035],{"class":140,"line":687},[138,1030,1031],{"class":434},"      radius: { default: ",[138,1033,1034],{"class":484},"0.6",[138,1036,1037],{"class":434}," },\n",[138,1039,1040],{"class":140,"line":698},[138,1041,1042],{"class":434},"    },\n",[138,1044,1045,1048,1050],{"class":140,"line":704},[138,1046,1047],{"class":434},"    paint: ",[138,1049,893],{"class":144},[138,1051,1052],{"class":148},"`\n",[138,1054,1055],{"class":140,"line":710},[138,1056,1057],{"class":148},"      let d = length((uv - center) * vec2f(aspect, 1.0)) \u002F radius;\n",[138,1059,1061],{"class":140,"line":1060},15,[138,1062,1063],{"class":148},"      return vec4f(color.rgb, 1.0 - smoothstep(0.8, 1.0, d));\n",[138,1065,1067,1070],{"class":140,"line":1066},16,[138,1068,1069],{"class":148},"    `",[138,1071,994],{"class":434},[138,1073,1075],{"class":140,"line":1074},17,[138,1076,707],{"class":434},[138,1078,1080],{"class":140,"line":1079},18,[138,1081,453],{"emptyLinePlaceholder":452},[138,1083,1085,1087,1089,1091,1093,1095],{"class":140,"line":1084},19,[138,1086,652],{"class":144},[138,1088,802],{"class":434},[138,1090,628],{"class":144},[138,1092,631],{"class":434},[138,1094,634],{"class":148},[138,1096,811],{"class":434},[138,1098,1100],{"class":140,"line":1099},20,[138,1101,660],{"class":434},[138,1103,1105,1107,1109,1111,1113,1115,1117],{"class":140,"line":1104},21,[138,1106,666],{"class":434},[138,1108,669],{"class":148},[138,1110,672],{"class":434},[138,1112,675],{"class":148},[138,1114,678],{"class":434},[138,1116,681],{"class":148},[138,1118,684],{"class":434},[138,1120,1122,1124,1126,1129,1132],{"class":140,"line":1121},22,[138,1123,666],{"class":434},[138,1125,991],{"class":148},[138,1127,1128],{"class":434},", props: { radius: ",[138,1130,1131],{"class":484},"0.4",[138,1133,684],{"class":434},[138,1135,1137],{"class":140,"line":1136},23,[138,1138,701],{"class":434},[138,1140,1142],{"class":140,"line":1141},24,[138,1143,1144],{"class":434},"  }, { components: [Halo] })\n",[138,1146,1148,1150,1152],{"class":140,"line":1147},25,[138,1149,516],{"class":434},[138,1151,592],{"class":462},[138,1153,475],{"class":434},[14,1155,1156,1157,1159,1160,1162],{},"If you move the component into a separate script or file, import from exactly the same address in both. ",[21,1158,863],{}," in one and ",[21,1161,867],{}," in another load two copies of the engine, and the component won't render.",[26,1164,1166],{"id":1165},"using-framer","Using Framer",[14,1168,1169,1170,1173,1174,1176],{},"A Framer site can run a shader as a ",[376,1171,1172],{},"code component",": a React component written in a code file inside your Framer project. Framer can't install npm packages, so the file imports a single-file build of ",[21,1175,69],{}," from a CDN. Framer supplies React itself.",[14,1178,1179],{},"To add one, open the Assets panel in Framer, create a new code file, and replace its contents with the shader:",[129,1181,1185],{"className":1182,"code":1183,"language":1184,"meta":134,"style":134},"language-tsx shiki shiki-themes github-dark","import { Shader, LinearGradient, CursorTrail } from 'https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fshaders@5\u002Fdist\u002Freact\u002Fbundle.js'\n\n\u002F**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 1280\n * @framerIntrinsicHeight 720\n *\u002F\nexport default function HeroShader({ style }) {\n  return (\n    \u003CShader style={style}>\n      \u003CLinearGradient colorA=\"#0f172a\" colorB=\"#7c3aed\" \u002F>\n      \u003CCursorTrail \u002F>\n    \u003C\u002FShader>\n  )\n}\n","tsx",[21,1186,1187,1199,1203,1208,1219,1228,1238,1248,1253,1277,1285,1300,1326,1335,1344,1349],{"__ignoreMap":134},[138,1188,1189,1191,1194,1196],{"class":140,"line":141},[138,1190,431],{"class":430},[138,1192,1193],{"class":434}," { Shader, LinearGradient, CursorTrail } ",[138,1195,438],{"class":430},[138,1197,1198],{"class":148}," 'https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fshaders@5\u002Fdist\u002Freact\u002Fbundle.js'\n",[138,1200,1201],{"class":140,"line":421},[138,1202,453],{"emptyLinePlaceholder":452},[138,1204,1205],{"class":140,"line":427},[138,1206,1207],{"class":417},"\u002F**\n",[138,1209,1210,1213,1216],{"class":140,"line":444},[138,1211,1212],{"class":417}," * ",[138,1214,1215],{"class":430},"@framerSupportedLayoutWidth",[138,1217,1218],{"class":417}," any-prefer-fixed\n",[138,1220,1221,1223,1226],{"class":140,"line":449},[138,1222,1212],{"class":417},[138,1224,1225],{"class":430},"@framerSupportedLayoutHeight",[138,1227,1218],{"class":417},[138,1229,1230,1232,1235],{"class":140,"line":456},[138,1231,1212],{"class":417},[138,1233,1234],{"class":430},"@framerIntrinsicWidth",[138,1236,1237],{"class":417}," 1280\n",[138,1239,1240,1242,1245],{"class":140,"line":478},[138,1241,1212],{"class":417},[138,1243,1244],{"class":430},"@framerIntrinsicHeight",[138,1246,1247],{"class":417}," 720\n",[138,1249,1250],{"class":140,"line":499},[138,1251,1252],{"class":417}," *\u002F\n",[138,1254,1255,1258,1261,1264,1267,1270,1274],{"class":140,"line":513},[138,1256,1257],{"class":430},"export",[138,1259,1260],{"class":430}," default",[138,1262,1263],{"class":430}," function",[138,1265,1266],{"class":144}," HeroShader",[138,1268,1269],{"class":434},"({ ",[138,1271,1273],{"class":1272},"s9osk","style",[138,1275,1276],{"class":434}," }) {\n",[138,1278,1279,1282],{"class":140,"line":663},[138,1280,1281],{"class":430},"  return",[138,1283,1284],{"class":434}," (\n",[138,1286,1287,1290,1293,1295,1297],{"class":140,"line":687},[138,1288,1289],{"class":434},"    \u003C",[138,1291,1292],{"class":484},"Shader",[138,1294,569],{"class":144},[138,1296,469],{"class":430},[138,1298,1299],{"class":434},"{style}>\n",[138,1301,1302,1305,1308,1311,1313,1316,1319,1321,1324],{"class":140,"line":698},[138,1303,1304],{"class":434},"      \u003C",[138,1306,1307],{"class":484},"LinearGradient",[138,1309,1310],{"class":144}," colorA",[138,1312,469],{"class":430},[138,1314,1315],{"class":148},"\"#0f172a\"",[138,1317,1318],{"class":144}," colorB",[138,1320,469],{"class":430},[138,1322,1323],{"class":148},"\"#7c3aed\"",[138,1325,496],{"class":434},[138,1327,1328,1330,1333],{"class":140,"line":704},[138,1329,1304],{"class":434},[138,1331,1332],{"class":484},"CursorTrail",[138,1334,496],{"class":434},[138,1336,1337,1340,1342],{"class":140,"line":710},[138,1338,1339],{"class":434},"    \u003C\u002F",[138,1341,1292],{"class":484},[138,1343,475],{"class":434},[138,1345,1346],{"class":140,"line":1060},[138,1347,1348],{"class":434},"  )\n",[138,1350,1351],{"class":140,"line":1066},[138,1352,1353],{"class":434},"}\n",[14,1355,1356],{},"Drag the component from the Assets panel onto your canvas and size it like any other layer.",[14,1358,1359,1360,1362,1363,1365],{},"Framer passes every code component a ",[21,1361,1273],{}," with the size you give it on the canvas. Pass it to ",[21,1364,362],{},", or the canvas won't fill the layer. The comment block above the function sets how the layer can be sized and its size when you first drop it in. Here it starts at 1280×720 with a fixed size, like an image.",[880,1367,1369],{"id":1368},"adding-controls-to-the-framer-panel","Adding controls to the Framer panel",[14,1371,1372,1373,906],{},"To change a shader's colors or settings from Framer's properties panel, turn those values into props and describe them with ",[21,1374,1375],{},"addPropertyControls",[129,1377,1379],{"className":1182,"code":1378,"language":1184,"meta":134,"style":134},"import { Shader, LinearGradient, CursorTrail } from 'https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fshaders@5\u002Fdist\u002Freact\u002Fbundle.js'\nimport { addPropertyControls, ControlType } from 'framer'\n\n\u002F**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 1280\n * @framerIntrinsicHeight 720\n *\u002F\nexport default function HeroShader({ style, startColor, endColor, angle, trailSize }) {\n  return (\n    \u003CShader style={style}>\n      \u003CLinearGradient colorA={startColor} colorB={endColor} angle={angle} \u002F>\n      \u003CCursorTrail radius={trailSize} \u002F>\n    \u003C\u002FShader>\n  )\n}\n\naddPropertyControls(HeroShader, {\n  startColor: { type: ControlType.Color, title: 'Start color', defaultValue: '#0f172a' },\n  endColor: { type: ControlType.Color, title: 'End color', defaultValue: '#7c3aed' },\n  angle: { type: ControlType.Number, title: 'Angle', min: 0, max: 360, step: 1, defaultValue: 0 },\n  trailSize: { type: ControlType.Number, title: 'Trail size', min: 0.5, max: 2, step: 0.1, defaultValue: 0.5 },\n})\n",[21,1380,1381,1391,1403,1407,1411,1419,1427,1435,1443,1447,1483,1489,1501,1529,1543,1551,1555,1559,1563,1570,1585,1599,1631,1659],{"__ignoreMap":134},[138,1382,1383,1385,1387,1389],{"class":140,"line":141},[138,1384,431],{"class":430},[138,1386,1193],{"class":434},[138,1388,438],{"class":430},[138,1390,1198],{"class":148},[138,1392,1393,1395,1398,1400],{"class":140,"line":421},[138,1394,431],{"class":430},[138,1396,1397],{"class":434}," { addPropertyControls, ControlType } ",[138,1399,438],{"class":430},[138,1401,1402],{"class":148}," 'framer'\n",[138,1404,1405],{"class":140,"line":427},[138,1406,453],{"emptyLinePlaceholder":452},[138,1408,1409],{"class":140,"line":444},[138,1410,1207],{"class":417},[138,1412,1413,1415,1417],{"class":140,"line":449},[138,1414,1212],{"class":417},[138,1416,1215],{"class":430},[138,1418,1218],{"class":417},[138,1420,1421,1423,1425],{"class":140,"line":456},[138,1422,1212],{"class":417},[138,1424,1225],{"class":430},[138,1426,1218],{"class":417},[138,1428,1429,1431,1433],{"class":140,"line":478},[138,1430,1212],{"class":417},[138,1432,1234],{"class":430},[138,1434,1237],{"class":417},[138,1436,1437,1439,1441],{"class":140,"line":499},[138,1438,1212],{"class":417},[138,1440,1244],{"class":430},[138,1442,1247],{"class":417},[138,1444,1445],{"class":140,"line":513},[138,1446,1252],{"class":417},[138,1448,1449,1451,1453,1455,1457,1459,1461,1463,1466,1468,1471,1473,1476,1478,1481],{"class":140,"line":663},[138,1450,1257],{"class":430},[138,1452,1260],{"class":430},[138,1454,1263],{"class":430},[138,1456,1266],{"class":144},[138,1458,1269],{"class":434},[138,1460,1273],{"class":1272},[138,1462,529],{"class":434},[138,1464,1465],{"class":1272},"startColor",[138,1467,529],{"class":434},[138,1469,1470],{"class":1272},"endColor",[138,1472,529],{"class":434},[138,1474,1475],{"class":1272},"angle",[138,1477,529],{"class":434},[138,1479,1480],{"class":1272},"trailSize",[138,1482,1276],{"class":434},[138,1484,1485,1487],{"class":140,"line":687},[138,1486,1281],{"class":430},[138,1488,1284],{"class":434},[138,1490,1491,1493,1495,1497,1499],{"class":140,"line":698},[138,1492,1289],{"class":434},[138,1494,1292],{"class":484},[138,1496,569],{"class":144},[138,1498,469],{"class":430},[138,1500,1299],{"class":434},[138,1502,1503,1505,1507,1509,1511,1514,1517,1519,1522,1524,1526],{"class":140,"line":704},[138,1504,1304],{"class":434},[138,1506,1307],{"class":484},[138,1508,1310],{"class":144},[138,1510,469],{"class":430},[138,1512,1513],{"class":434},"{startColor} ",[138,1515,1516],{"class":144},"colorB",[138,1518,469],{"class":430},[138,1520,1521],{"class":434},"{endColor} ",[138,1523,1475],{"class":144},[138,1525,469],{"class":430},[138,1527,1528],{"class":434},"{angle} \u002F>\n",[138,1530,1531,1533,1535,1538,1540],{"class":140,"line":710},[138,1532,1304],{"class":434},[138,1534,1332],{"class":484},[138,1536,1537],{"class":144}," radius",[138,1539,469],{"class":430},[138,1541,1542],{"class":434},"{trailSize} \u002F>\n",[138,1544,1545,1547,1549],{"class":140,"line":1060},[138,1546,1339],{"class":434},[138,1548,1292],{"class":484},[138,1550,475],{"class":434},[138,1552,1553],{"class":140,"line":1066},[138,1554,1348],{"class":434},[138,1556,1557],{"class":140,"line":1074},[138,1558,1353],{"class":434},[138,1560,1561],{"class":140,"line":1079},[138,1562,453],{"emptyLinePlaceholder":452},[138,1564,1565,1567],{"class":140,"line":1084},[138,1566,1375],{"class":144},[138,1568,1569],{"class":434},"(HeroShader, {\n",[138,1571,1572,1575,1578,1581,1583],{"class":140,"line":1099},[138,1573,1574],{"class":434},"  startColor: { type: ControlType.Color, title: ",[138,1576,1577],{"class":148},"'Start color'",[138,1579,1580],{"class":434},", defaultValue: ",[138,1582,675],{"class":148},[138,1584,1037],{"class":434},[138,1586,1587,1590,1593,1595,1597],{"class":140,"line":1104},[138,1588,1589],{"class":434},"  endColor: { type: ControlType.Color, title: ",[138,1591,1592],{"class":148},"'End color'",[138,1594,1580],{"class":434},[138,1596,681],{"class":148},[138,1598,1037],{"class":434},[138,1600,1601,1604,1607,1610,1613,1616,1619,1622,1625,1627,1629],{"class":140,"line":1121},[138,1602,1603],{"class":434},"  angle: { type: ControlType.Number, title: ",[138,1605,1606],{"class":148},"'Angle'",[138,1608,1609],{"class":434},", min: ",[138,1611,1612],{"class":484},"0",[138,1614,1615],{"class":434},", max: ",[138,1617,1618],{"class":484},"360",[138,1620,1621],{"class":434},", step: ",[138,1623,1624],{"class":484},"1",[138,1626,1580],{"class":434},[138,1628,1612],{"class":484},[138,1630,1037],{"class":434},[138,1632,1633,1636,1639,1641,1643,1645,1648,1650,1653,1655,1657],{"class":140,"line":1136},[138,1634,1635],{"class":434},"  trailSize: { type: ControlType.Number, title: ",[138,1637,1638],{"class":148},"'Trail size'",[138,1640,1609],{"class":434},[138,1642,1018],{"class":484},[138,1644,1615],{"class":434},[138,1646,1647],{"class":484},"2",[138,1649,1621],{"class":434},[138,1651,1652],{"class":484},"0.1",[138,1654,1580],{"class":434},[138,1656,1018],{"class":484},[138,1658,1037],{"class":434},[138,1660,1661],{"class":140,"line":1141},[138,1662,1663],{"class":434},"})\n",[14,1665,1666,1667,1669,1670,529,1673,1676,1677,1681],{},"Each key in ",[21,1668,1375],{}," is a prop of your component, and each shows up as a field when the layer is selected. Take ",[21,1671,1672],{},"min",[21,1674,1675],{},"max"," and the default from the prop's table on its ",[174,1678,1680],{"href":1679},"\u002Fdocs\u002Fcomponents","component page",", so the panel can't send a value the component doesn't accept. Use these control types:",[1683,1684,1685,1696,1713,1734],"ul",{},[1686,1687,1688,1691,1692,1695],"li",{},[376,1689,1690],{},"Colors",": ",[21,1693,1694],{},"ControlType.Color",", for any color prop.",[1686,1697,1698,1691,1701,1704,1705,529,1707,890,1709,1712],{},[376,1699,1700],{},"Numbers",[21,1702,1703],{},"ControlType.Number"," with ",[21,1706,1672],{},[21,1708,1675],{},[21,1710,1711],{},"step",", for any range prop.",[1686,1714,1715,1691,1718,1721,1722,1725,1726,1729,1730,1733],{},[376,1716,1717],{},"Images",[21,1719,1720],{},"ControlType.Image",", which hands your component an image URL. Pass it to the ",[21,1723,1724],{},"url"," prop of ",[21,1727,1728],{},"ImageTexture",", with a fallback (",[21,1731,1732],{},"url={image ?? 'https:\u002F\u002F…'}","), since an image control has no default value.",[1686,1735,1736,1691,1739,1704,1742,1745],{},[376,1737,1738],{},"Options",[21,1740,1741],{},"ControlType.Enum",[21,1743,1744],{},"options",", for props that take one of a few strings, like a blend mode.",[14,1747,1748],{},"Your agent can write the file for you. Ask for the shader as a Framer code component and name the settings you want in the panel:",[876,1750],{"prompt":1751},"Turn my hero shader into a Framer code component with controls for the two gradient colors.",[880,1753,1755],{"id":1754},"adding-a-custom-component-in-framer","Adding a custom component in Framer",[14,1757,1758,1759,890,1761,1763,1764,1766,1767,1770],{},"The bundle also includes ",[21,1760,889],{},[21,1762,893],{},", so a shader that uses a ",[174,1765,898],{"href":897}," fits in the same code file. Define the component above your Framer component and mount it with ",[21,1768,1769],{},"\u003CCustomShader>",". Its props can take values from the properties panel like any other:",[129,1772,1774],{"className":1182,"code":1773,"language":1184,"meta":134,"style":134},"import { Shader, CustomShader, LinearGradient, defineShader, wgsl, transformColor, transformPosition } from 'https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fshaders@5\u002Fdist\u002Freact\u002Fbundle.js'\nimport { addPropertyControls, ControlType } from 'framer'\n\nconst Halo = defineShader({\n  name: 'Halo',\n  props: {\n    color: { default: '#ffd166', transform: transformColor },\n    center: { default: { x: 0.5, y: 0.5 }, transform: transformPosition },\n    radius: { default: 0.6 },\n  },\n  paint: wgsl`\n    let d = length((uv - center) * vec2f(aspect, 1.0)) \u002F radius;\n    return vec4f(color.rgb, 1.0 - smoothstep(0.8, 1.0, d));\n  `,\n})\n\n\u002F**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 1280\n * @framerIntrinsicHeight 720\n *\u002F\nexport default function HeroShader({ style, haloColor, haloSize }) {\n  return (\n    \u003CShader style={style}>\n      \u003CLinearGradient colorA=\"#0f172a\" colorB=\"#7c3aed\" \u002F>\n      \u003CCustomShader src={Halo} color={haloColor} radius={haloSize} \u002F>\n    \u003C\u002FShader>\n  )\n}\n\naddPropertyControls(HeroShader, {\n  haloColor: { type: ControlType.Color, title: 'Halo color', defaultValue: '#ffd166' },\n  haloSize: { type: ControlType.Number, title: 'Halo size', min: 0.1, max: 1, step: 0.05, defaultValue: 0.6 },\n})\n",[21,1775,1776,1787,1797,1801,1814,1823,1828,1837,1850,1859,1864,1873,1878,1883,1890,1894,1898,1902,1910,1918,1926,1934,1938,1964,1970,1982,2003,2035,2044,2049,2054,2059,2066,2081,2109],{"__ignoreMap":134},[138,1777,1778,1780,1783,1785],{"class":140,"line":141},[138,1779,431],{"class":430},[138,1781,1782],{"class":434}," { Shader, CustomShader, LinearGradient, defineShader, wgsl, transformColor, transformPosition } ",[138,1784,438],{"class":430},[138,1786,1198],{"class":148},[138,1788,1789,1791,1793,1795],{"class":140,"line":421},[138,1790,431],{"class":430},[138,1792,1397],{"class":434},[138,1794,438],{"class":430},[138,1796,1402],{"class":148},[138,1798,1799],{"class":140,"line":427},[138,1800,453],{"emptyLinePlaceholder":452},[138,1802,1803,1806,1808,1810,1812],{"class":140,"line":444},[138,1804,1805],{"class":430},"const",[138,1807,975],{"class":484},[138,1809,622],{"class":430},[138,1811,980],{"class":144},[138,1813,983],{"class":434},[138,1815,1816,1819,1821],{"class":140,"line":449},[138,1817,1818],{"class":434},"  name: ",[138,1820,991],{"class":148},[138,1822,994],{"class":434},[138,1824,1825],{"class":140,"line":456},[138,1826,1827],{"class":434},"  props: {\n",[138,1829,1830,1833,1835],{"class":140,"line":478},[138,1831,1832],{"class":434},"    color: { default: ",[138,1834,1007],{"class":148},[138,1836,1010],{"class":434},[138,1838,1839,1842,1844,1846,1848],{"class":140,"line":499},[138,1840,1841],{"class":434},"    center: { default: { x: ",[138,1843,1018],{"class":484},[138,1845,1021],{"class":434},[138,1847,1018],{"class":484},[138,1849,1026],{"class":434},[138,1851,1852,1855,1857],{"class":140,"line":513},[138,1853,1854],{"class":434},"    radius: { default: ",[138,1856,1034],{"class":484},[138,1858,1037],{"class":434},[138,1860,1861],{"class":140,"line":663},[138,1862,1863],{"class":434},"  },\n",[138,1865,1866,1869,1871],{"class":140,"line":687},[138,1867,1868],{"class":434},"  paint: ",[138,1870,893],{"class":144},[138,1872,1052],{"class":148},[138,1874,1875],{"class":140,"line":698},[138,1876,1877],{"class":148},"    let d = length((uv - center) * vec2f(aspect, 1.0)) \u002F radius;\n",[138,1879,1880],{"class":140,"line":704},[138,1881,1882],{"class":148},"    return vec4f(color.rgb, 1.0 - smoothstep(0.8, 1.0, d));\n",[138,1884,1885,1888],{"class":140,"line":710},[138,1886,1887],{"class":148},"  `",[138,1889,994],{"class":434},[138,1891,1892],{"class":140,"line":1060},[138,1893,1663],{"class":434},[138,1895,1896],{"class":140,"line":1066},[138,1897,453],{"emptyLinePlaceholder":452},[138,1899,1900],{"class":140,"line":1074},[138,1901,1207],{"class":417},[138,1903,1904,1906,1908],{"class":140,"line":1079},[138,1905,1212],{"class":417},[138,1907,1215],{"class":430},[138,1909,1218],{"class":417},[138,1911,1912,1914,1916],{"class":140,"line":1084},[138,1913,1212],{"class":417},[138,1915,1225],{"class":430},[138,1917,1218],{"class":417},[138,1919,1920,1922,1924],{"class":140,"line":1099},[138,1921,1212],{"class":417},[138,1923,1234],{"class":430},[138,1925,1237],{"class":417},[138,1927,1928,1930,1932],{"class":140,"line":1104},[138,1929,1212],{"class":417},[138,1931,1244],{"class":430},[138,1933,1247],{"class":417},[138,1935,1936],{"class":140,"line":1121},[138,1937,1252],{"class":417},[138,1939,1940,1942,1944,1946,1948,1950,1952,1954,1957,1959,1962],{"class":140,"line":1136},[138,1941,1257],{"class":430},[138,1943,1260],{"class":430},[138,1945,1263],{"class":430},[138,1947,1266],{"class":144},[138,1949,1269],{"class":434},[138,1951,1273],{"class":1272},[138,1953,529],{"class":434},[138,1955,1956],{"class":1272},"haloColor",[138,1958,529],{"class":434},[138,1960,1961],{"class":1272},"haloSize",[138,1963,1276],{"class":434},[138,1965,1966,1968],{"class":140,"line":1141},[138,1967,1281],{"class":430},[138,1969,1284],{"class":434},[138,1971,1972,1974,1976,1978,1980],{"class":140,"line":1147},[138,1973,1289],{"class":434},[138,1975,1292],{"class":484},[138,1977,569],{"class":144},[138,1979,469],{"class":430},[138,1981,1299],{"class":434},[138,1983,1985,1987,1989,1991,1993,1995,1997,1999,2001],{"class":140,"line":1984},26,[138,1986,1304],{"class":434},[138,1988,1307],{"class":484},[138,1990,1310],{"class":144},[138,1992,469],{"class":430},[138,1994,1315],{"class":148},[138,1996,1318],{"class":144},[138,1998,469],{"class":430},[138,2000,1323],{"class":148},[138,2002,496],{"class":434},[138,2004,2006,2008,2011,2014,2016,2019,2022,2024,2027,2030,2032],{"class":140,"line":2005},27,[138,2007,1304],{"class":434},[138,2009,2010],{"class":484},"CustomShader",[138,2012,2013],{"class":144}," src",[138,2015,469],{"class":430},[138,2017,2018],{"class":434},"{Halo} ",[138,2020,2021],{"class":144},"color",[138,2023,469],{"class":430},[138,2025,2026],{"class":434},"{haloColor} ",[138,2028,2029],{"class":144},"radius",[138,2031,469],{"class":430},[138,2033,2034],{"class":434},"{haloSize} \u002F>\n",[138,2036,2038,2040,2042],{"class":140,"line":2037},28,[138,2039,1339],{"class":434},[138,2041,1292],{"class":484},[138,2043,475],{"class":434},[138,2045,2047],{"class":140,"line":2046},29,[138,2048,1348],{"class":434},[138,2050,2052],{"class":140,"line":2051},30,[138,2053,1353],{"class":434},[138,2055,2057],{"class":140,"line":2056},31,[138,2058,453],{"emptyLinePlaceholder":452},[138,2060,2062,2064],{"class":140,"line":2061},32,[138,2063,1375],{"class":144},[138,2065,1569],{"class":434},[138,2067,2069,2072,2075,2077,2079],{"class":140,"line":2068},33,[138,2070,2071],{"class":434},"  haloColor: { type: ControlType.Color, title: ",[138,2073,2074],{"class":148},"'Halo color'",[138,2076,1580],{"class":434},[138,2078,1007],{"class":148},[138,2080,1037],{"class":434},[138,2082,2084,2087,2090,2092,2094,2096,2098,2100,2103,2105,2107],{"class":140,"line":2083},34,[138,2085,2086],{"class":434},"  haloSize: { type: ControlType.Number, title: ",[138,2088,2089],{"class":148},"'Halo size'",[138,2091,1609],{"class":434},[138,2093,1652],{"class":484},[138,2095,1615],{"class":434},[138,2097,1624],{"class":484},[138,2099,1621],{"class":434},[138,2101,2102],{"class":484},"0.05",[138,2104,1580],{"class":434},[138,2106,1034],{"class":484},[138,2108,1037],{"class":434},[138,2110,2112],{"class":140,"line":2111},35,[138,2113,1663],{"class":434},[14,2115,2116],{},"Define the component outside the function, so it's built once rather than on every render.",[14,2118,2119,2120,1159,2122,1162],{},"To share one custom component between several shaders, you can move it into its own code file. Every file then has to import exactly the same address: ",[21,2121,863],{},[21,2123,867],{},[26,2125,2127],{"id":2126},"checking-browser-support","Checking browser support",[14,2129,2130],{},"Shaders needs WebGPU, which current Chrome, Edge and Safari support. Where a browser can't provide a GPU device, the canvas stays transparent and the rest of the page works as normal. This is the same in every framework above.",[14,2132,2133,2134,2138],{},"To show something else in those browsers, check for support before you mount, or listen for the failure. ",[174,2135,2137],{"href":2136},"\u002Fdocs\u002Fguide\u002Fhooks-events","Hooks and events"," covers both.",[26,2140,2142],{"id":2141},"next-steps","Next steps",[1683,2144,2145,2152,2159],{},[1686,2146,2147,2151],{},[174,2148,2150],{"href":2149},"\u002Fdownload","Download Shaders",": the desktop app, free for Mac, Windows and Linux.",[1686,2153,2154,2158],{},[174,2155,2157],{"href":2156},"\u002Fdocs\u002Fguide\u002Fmcp","Working with your agent",": what your agent can design, edit and install for you.",[1686,2160,2161,2164],{},[174,2162,347],{"href":2163},"\u002Fdocs\u002Fguide\u002Fcli",": connect a codebase and install shaders into it.",[1273,2166,2167],{},"html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}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 .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}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 .s4JwU, html code.shiki .s4JwU{--shiki-default:#85E89D}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}",{"title":134,"searchDepth":421,"depth":421,"links":2169},[2170,2171,2172,2173,2176,2180,2181],{"id":28,"depth":421,"text":29},{"id":181,"depth":421,"text":182},{"id":370,"depth":421,"text":371},{"id":724,"depth":421,"text":725,"children":2174},[2175],{"id":882,"depth":427,"text":883},{"id":1165,"depth":421,"text":1166,"children":2177},[2178,2179],{"id":1368,"depth":427,"text":1369},{"id":1754,"depth":427,"text":1755},{"id":2126,"depth":421,"text":2127},{"id":2141,"depth":421,"text":2142},"workflows","md","cubes",{"type":2186},"guide","\u002Fdocs\u002Fguide\u002Fframeworks",{"title":5,"description":16},"docs\u002Fguide\u002F16.frameworks","eRwJHdEXA3cc6wRk7lQpGJkMR4OQoGUbRjcYwFrAcHI",{"stars":2192},6080,[2194,2198,2201,2205,2209,2213,2217,2221,2225,2229,2233,2237,2241,2243,2247,2250,2254,2256,2258,2259,2263,2267],{"path":2195,"title":2196,"description":2197,"category":21},"\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":176,"title":2199,"description":2200,"category":21},"Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":2202,"title":2203,"description":2204,"category":21},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":2206,"title":2207,"description":2208,"category":21},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":2210,"title":2211,"description":2212,"category":21},"\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":2214,"title":2215,"description":2216,"category":21},"\u002Fdocs\u002Fguide\u002Fanimation","Animating a shader","Tween a shader's props with Motion, GSAP or anything else that animates a number.",{"path":2218,"title":2219,"description":2220,"category":21},"\u002Fdocs\u002Fguide\u002Fdynamic-props","Dynamic props","Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":2222,"title":2223,"description":2224,"category":21},"\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":2226,"title":2227,"description":2228,"category":21},"\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":2230,"title":2231,"description":2232,"category":21},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":2234,"title":2235,"description":2236,"category":21},"\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":2238,"title":2239,"description":2240,"category":21},"\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":2136,"title":2137,"description":2242,"category":21},"Run code when an effect is ready to show, and show a fallback when the GPU can't run it.",{"path":2244,"title":2245,"description":2246,"category":21},"\u002Fdocs\u002Fguide\u002Fperformance","Performance","Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":897,"title":2248,"description":2249,"category":21},"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":2251,"title":2252,"description":2253,"category":21},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":2156,"title":2157,"description":2255,"category":2182},"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.",{"path":2163,"title":347,"description":2257,"category":2182},"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":2187,"title":5,"description":16,"category":2182},{"path":2260,"title":2261,"description":2262,"category":21},"\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":2264,"title":2265,"description":2266,"category":21},"\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":366,"title":209,"description":2268,"category":21},"Render Shaders in Next.js, Nuxt, SvelteKit, SolidStart and other SSR apps by keeping each shader on the client.",1796051172407,"06e02370-81a6-4d74-9931-661d71414be1"]