[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"guide-nav":3,"doc-\u002Fdocs\u002Fprimitives\u002Ffilter":145},[4,10,16,20,24,28,32,36,40,44,48,52,56,60,64,69,73,78,82,86,90,94,98,102,106,110,114,117,120,124,127,131,134,138,141],{"path":5,"title":6,"description":7,"category":8,"exclude":9,"forceFramework":9},"\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",null,{"path":11,"title":12,"description":13,"category":8,"exclude":14,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",[15],"js",{"path":17,"title":18,"description":19,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":21,"title":22,"description":23,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":25,"title":26,"description":27,"category":8,"exclude":9,"forceFramework":9},"\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":29,"title":30,"description":31,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fdynamic-props","Dynamic props","Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":33,"title":34,"description":35,"category":8,"exclude":9,"forceFramework":9},"\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":37,"title":38,"description":39,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in % or px units.",{"path":41,"title":42,"description":43,"category":8,"exclude":9,"forceFramework":9},"\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":45,"title":46,"description":47,"category":8,"exclude":9,"forceFramework":9},"\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":49,"title":50,"description":51,"category":8,"exclude":9,"forceFramework":9},"\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":53,"title":54,"description":55,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fperformance","Performance","Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":57,"title":58,"description":59,"category":8,"exclude":9,"forceFramework":9},"\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":61,"title":62,"description":63,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":65,"title":66,"description":67,"category":68,"exclude":9,"forceFramework":9},"\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":70,"title":71,"description":72,"category":68,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fcli","Shaders CLI","Install shaders and presets into your codebase as component files, and keep them in sync with the design editor.",{"path":74,"title":75,"description":76,"category":77,"exclude":9,"forceFramework":9},"\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":79,"title":80,"description":81,"category":77,"exclude":9,"forceFramework":9},"\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":83,"title":84,"description":85,"category":77,"exclude":9,"forceFramework":9},"\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":87,"title":88,"description":89,"category":77,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fmasking-and-blending","Masking and blending","How blend modes and masks combine components in the design editor.",{"path":91,"title":92,"description":93,"category":77,"exclude":9,"forceFramework":9},"\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":95,"title":96,"description":97,"category":77,"exclude":9,"forceFramework":9},"\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":99,"title":100,"description":101,"category":77,"exclude":9,"forceFramework":9},"\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":103,"title":104,"description":105,"category":77,"exclude":9,"forceFramework":9},"\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":107,"title":108,"description":109,"category":77,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fglass-component-spotlight","Component spotlight: Glass","A short look at the Glass component and the liquid-glass look it creates.",{"path":111,"title":112,"description":113,"category":77,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fdigital-looks-component-spotlight","Component spotlight: Digital looks","A look at the digital stylization components for glitchy, futuristic, or technical effects.",{"path":115,"title":12,"description":116,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fjs\u002Fquickstart","Install Shaders without a framework, render your first effect on a canvas, and update props at runtime.",{"path":118,"title":12,"description":119,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Freact\u002Fquickstart","Install Shaders in a React app, render your first effect, and drive a prop from state.",{"path":121,"title":122,"description":123,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Freact\u002Fssr","Next.js and SSR","Render Shaders in Next.js and other React SSR apps by keeping each shader on the client.",{"path":125,"title":12,"description":126,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fsolid\u002Fquickstart","Install Shaders in a Solid app, render your first effect, and drive a prop from a signal.",{"path":128,"title":129,"description":130,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fsolid\u002Fssr","SolidStart and SSR","Render Shaders in SolidStart and other Solid SSR apps by keeping each shader on the client.",{"path":132,"title":12,"description":133,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fsvelte\u002Fquickstart","Install Shaders in a Svelte app, render your first effect, and drive a prop from state.",{"path":135,"title":136,"description":137,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fsvelte\u002Fssr","SvelteKit and SSR","Render Shaders in SvelteKit and other Svelte SSR apps, where each shader already waits for the browser.",{"path":139,"title":12,"description":140,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fvue\u002Fquickstart","Install Shaders in a Vue app, render your first effect, and drive a prop from a ref.",{"path":142,"title":143,"description":144,"category":8,"exclude":9,"forceFramework":9},"\u002Fdocs\u002Fguide\u002Fvue\u002Fssr","Nuxt and SSR","Render Shaders in Nuxt and other Vue SSR apps by keeping each shader on the client.",{"id":146,"title":147,"body":148,"categoryId":166,"categorySlug":166,"categoryTitle":9,"curated":353,"description":681,"editUrl":682,"extension":683,"group":684,"groupTitle":685,"kind":9,"meta":686,"navigation":353,"path":687,"seo":688,"sourceUrl":689,"stem":690,"wordCount":387,"__hash__":691},"primitives\u002Fdocs\u002Fprimitives\u002F25.filter\u002Findex.md","Filter effects",{"type":149,"value":150,"toc":675},"minimark",[151,155,171,219,248,253,328,332,576,580,624,628,671],[152,153,147],"h1",{"id":154},"filter-effects",[156,157,158,159,162,163,167,168,170],"p",{},"Words for the ",[8,160,161],{},"effect:"," field. A ",[164,165,166],"strong",{},"filter"," is a component that changes the layer inside it\n(the child). A definition with an ",[8,169,161],{}," is a filter, nothing else to declare.",[156,172,173,174,177,178,181,182,189,190,196,197,203,204,209,210,215,216,218],{},"There are two kinds of effect. A ",[164,175,176],{},"pointwise"," effect edits the child's color at this pixel\nand nothing else. It is cheap and keeps the child's alpha. A ",[164,179,180],{},"gather"," effect first draws\nthe child to a texture so it can read the child's other pixels: neighbours for a blur, a\nshifted position for a distortion. It costs one extra render of the child. ",[183,184,186],"a",{"href":185},"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Ftinttoward",[8,187,188],{},"tintToward"," and\n",[183,191,193],{"href":192},"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fpaintthrough",[8,194,195],{},"paintThrough"," are pointwise, ",[183,198,200],{"href":199},"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fdisplaceby",[8,201,202],{},"displaceBy"," is a gather, and ",[183,205,207],{"href":206},"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fpointwise",[8,208,176],{}," and ",[183,211,213],{"href":212},"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fgather",[8,214,180],{}," let you\nwrite your own. The many ready-made effects (blurs, color grades, stylize looks) live in the\ncategories after this one and drop into the same ",[8,217,161],{}," field.",[220,221,226],"pre",{"className":222,"code":223,"language":224,"meta":225,"style":225},"language-ts shiki shiki-themes github-dark","import {tintToward, paintThrough, displaceBy, …} from 'shaders\u002Fstd'\n","ts","",[8,227,228],{"__ignoreMap":225},[229,230,233,237,241,244],"span",{"class":231,"line":232},"line",1,[229,234,236],{"class":235},"snl16","import",[229,238,240],{"class":239},"s95oV"," {tintToward, paintThrough, displaceBy, …} ",[229,242,243],{"class":235},"from",[229,245,247],{"class":246},"sU2Wk"," 'shaders\u002Fstd'\n",[249,250,252],"h2",{"id":251},"reach-for-it-when","Reach for it when",[254,255,256,269],"table",{},[257,258,259],"thead",{},[260,261,262,266],"tr",{},[263,264,265],"th",{},"When you need",[263,267,268],{},"Use",[270,271,272,284,295,306,317],"tbody",{},[260,273,274,278],{},[275,276,277],"td",{},"tint or darken the child, by a mask or a slider",[275,279,280],{},[183,281,282],{"href":185},[8,283,188],{},[260,285,286,289],{},[275,287,288],{},"a gradient or pattern showing through text",[275,290,291],{},[183,292,293],{"href":192},[8,294,195],{},[260,296,297,300],{},[275,298,299],{},"a ripple or fluid distortion driven by a simulation",[275,301,302],{},[183,303,304],{"href":199},[8,305,202],{},[260,307,308,311],{},[275,309,310],{},"your own color math on the child's pixel",[275,312,313],{},[183,314,315],{"href":206},[8,316,176],{},[260,318,319,322],{},[275,320,321],{},"your own effect that reads the child's neighbours",[275,323,324],{},[183,325,326],{"href":212},[8,327,180],{},[249,329,331],{"id":330},"example","Example",[220,333,335],{"className":222,"code":334,"language":224,"meta":225,"style":225},"import {defineShader, p, tintToward, radialMask, isZero, transformColor, transformPosition} from 'shaders\u002Fstd'\n\n\u002F\u002F Vignette: tint the frame toward a color, more toward the edges, nothing at the center.\nexport const Vignette = defineShader({\n  name: 'Vignette',\n  props: {\n    color: {default: '#000000', transform: transformColor},\n    center: {default: {x: 0.5, y: 0.5}, transform: transformPosition},\n    radius: {default: 0.5},\n    falloff: {default: 0.5},\n    intensity: {default: 1},\n  },\n  effect: tintToward(p('color'), {\n    amount: radialMask({center: p('center'), radius: p('radius'), falloff: p('falloff')}).times(p('intensity')),\n  }),\n  identityWhen: isZero('intensity'),\n})\n",[8,336,337,348,355,362,385,397,403,415,432,443,453,464,470,491,548,554,570],{"__ignoreMap":225},[229,338,339,341,344,346],{"class":231,"line":232},[229,340,236],{"class":235},[229,342,343],{"class":239}," {defineShader, p, tintToward, radialMask, isZero, transformColor, transformPosition} ",[229,345,243],{"class":235},[229,347,247],{"class":246},[229,349,351],{"class":231,"line":350},2,[229,352,354],{"emptyLinePlaceholder":353},true,"\n",[229,356,358],{"class":231,"line":357},3,[229,359,361],{"class":360},"sAwPA","\u002F\u002F Vignette: tint the frame toward a color, more toward the edges, nothing at the center.\n",[229,363,365,368,371,375,378,382],{"class":231,"line":364},4,[229,366,367],{"class":235},"export",[229,369,370],{"class":235}," const",[229,372,374],{"class":373},"sDLfK"," Vignette",[229,376,377],{"class":235}," =",[229,379,381],{"class":380},"svObZ"," defineShader",[229,383,384],{"class":239},"({\n",[229,386,388,391,394],{"class":231,"line":387},5,[229,389,390],{"class":239},"  name: ",[229,392,393],{"class":246},"'Vignette'",[229,395,396],{"class":239},",\n",[229,398,400],{"class":231,"line":399},6,[229,401,402],{"class":239},"  props: {\n",[229,404,406,409,412],{"class":231,"line":405},7,[229,407,408],{"class":239},"    color: {default: ",[229,410,411],{"class":246},"'#000000'",[229,413,414],{"class":239},", transform: transformColor},\n",[229,416,418,421,424,427,429],{"class":231,"line":417},8,[229,419,420],{"class":239},"    center: {default: {x: ",[229,422,423],{"class":373},"0.5",[229,425,426],{"class":239},", y: ",[229,428,423],{"class":373},[229,430,431],{"class":239},"}, transform: transformPosition},\n",[229,433,435,438,440],{"class":231,"line":434},9,[229,436,437],{"class":239},"    radius: {default: ",[229,439,423],{"class":373},[229,441,442],{"class":239},"},\n",[229,444,446,449,451],{"class":231,"line":445},10,[229,447,448],{"class":239},"    falloff: {default: ",[229,450,423],{"class":373},[229,452,442],{"class":239},[229,454,456,459,462],{"class":231,"line":455},11,[229,457,458],{"class":239},"    intensity: {default: ",[229,460,461],{"class":373},"1",[229,463,442],{"class":239},[229,465,467],{"class":231,"line":466},12,[229,468,469],{"class":239},"  },\n",[229,471,473,476,478,481,483,485,488],{"class":231,"line":472},13,[229,474,475],{"class":239},"  effect: ",[229,477,188],{"class":380},[229,479,480],{"class":239},"(",[229,482,156],{"class":380},[229,484,480],{"class":239},[229,486,487],{"class":246},"'color'",[229,489,490],{"class":239},"), {\n",[229,492,494,497,500,503,505,507,510,513,515,517,520,523,525,527,530,533,536,538,540,542,545],{"class":231,"line":493},14,[229,495,496],{"class":239},"    amount: ",[229,498,499],{"class":380},"radialMask",[229,501,502],{"class":239},"({center: ",[229,504,156],{"class":380},[229,506,480],{"class":239},[229,508,509],{"class":246},"'center'",[229,511,512],{"class":239},"), radius: ",[229,514,156],{"class":380},[229,516,480],{"class":239},[229,518,519],{"class":246},"'radius'",[229,521,522],{"class":239},"), falloff: ",[229,524,156],{"class":380},[229,526,480],{"class":239},[229,528,529],{"class":246},"'falloff'",[229,531,532],{"class":239},")}).",[229,534,535],{"class":380},"times",[229,537,480],{"class":239},[229,539,156],{"class":380},[229,541,480],{"class":239},[229,543,544],{"class":246},"'intensity'",[229,546,547],{"class":239},")),\n",[229,549,551],{"class":231,"line":550},15,[229,552,553],{"class":239},"  }),\n",[229,555,557,560,563,565,567],{"class":231,"line":556},16,[229,558,559],{"class":239},"  identityWhen: ",[229,561,562],{"class":380},"isZero",[229,564,480],{"class":239},[229,566,544],{"class":246},[229,568,569],{"class":239},"),\n",[229,571,573],{"class":231,"line":572},17,[229,574,575],{"class":239},"})\n",[249,577,579],{"id":578},"types","Types",[254,581,582,592],{},[257,583,584],{},[260,585,586,589],{},[263,587,588],{},"Type",[263,590,591],{},"What it is",[270,593,594,610],{},[260,595,596,601],{},[275,597,598],{},[8,599,600],{},"DisplaceByEffect",[275,602,603,604,606,607,609],{},"What ",[8,605,202],{}," returns: the simulation field and the props it reads, ready for ",[8,608,161],{},".",[260,611,612,617],{},[275,613,614],{},[8,615,616],{},"TintTowardEffect",[275,618,603,619,621,622,609],{},[8,620,188],{}," returns: the color prop and the amount, ready for ",[8,623,161],{},[249,625,627],{"id":626},"words","Words",[629,630,632],"primitive-words",{":words":631},"[{\"name\":\"tintToward\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Ftinttoward\",\"summary\":\"Mix the child's color toward one color by an amount, leaving its alpha alone.\"},{\"name\":\"paintThrough\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fpaintthrough\",\"summary\":\"Show a paint through the child, so the child becomes the mask.\"},{\"name\":\"displaceBy\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fdisplaceby\",\"summary\":\"Push the child's pixels around by a vector field from one of your simulations.\"},{\"name\":\"pointwise\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fpointwise\",\"summary\":\"Write your own pointwise effect: a function of the child's color at this pixel.\"},{\"name\":\"gather\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fgather\",\"summary\":\"Write your own gather effect: a function that can read the child anywhere.\"}]",[633,634,635,643,650,657,664],"ul",{},[636,637,638,642],"li",{},[183,639,640],{"href":185},[8,641,188],{}," — Mix the child's color toward one color by an amount, leaving its alpha alone.",[636,644,645,649],{},[183,646,647],{"href":192},[8,648,195],{}," — Show a paint through the child, so the child becomes the mask.",[636,651,652,656],{},[183,653,654],{"href":199},[8,655,202],{}," — Push the child's pixels around by a vector field from one of your simulations.",[636,658,659,663],{},[183,660,661],{"href":206},[8,662,176],{}," — Write your own pointwise effect: a function of the child's color at this pixel.",[636,665,666,670],{},[183,667,668],{"href":212},[8,669,180],{}," — Write your own gather effect: a function that can read the child anywhere.",[672,673,674],"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 .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}",{"title":225,"searchDepth":350,"depth":350,"links":676},[677,678,679,680],{"id":251,"depth":350,"text":252},{"id":330,"depth":350,"text":331},{"id":578,"depth":350,"text":579},{"id":626,"depth":350,"text":627},"Words for the effect: field.","https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fedit\u002Fmain\u002Fpackages\u002Fcore\u002Fdocs\u002Fstd\u002Ffilter.md","md","effects","Filters & effects",{},"\u002Fdocs\u002Fprimitives\u002Ffilter",{"title":147,"description":681},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Ffilter.ts","docs\u002Fprimitives\u002F25.filter\u002Findex","VPMISEUFa1rSFuXSLpBgDxQI6UmlVWCJ3pPlGuQ7VZQ"]