[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"github-stars":3,"guide-nav":5,"doc-\u002Fdocs\u002Fprimitives\u002Ffilter":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":150,"categorySlug":150,"categoryTitle":665,"curated":337,"description":666,"editUrl":667,"extension":668,"group":669,"groupTitle":670,"kind":665,"meta":671,"navigation":337,"path":672,"seo":673,"sourceUrl":674,"stem":675,"wordCount":371,"__hash__":676},"primitives\u002Fdocs\u002Fprimitives\u002F25.filter\u002Findex.md","Filter effects",{"type":133,"value":134,"toc":659},"minimark",[135,139,155,203,232,237,312,316,560,564,608,612,655],[136,137,131],"h1",{"id":138},"filter-effects",[140,141,142,143,146,147,151,152,154],"p",{},"Words for the ",[10,144,145],{},"effect:"," field. A ",[148,149,150],"strong",{},"filter"," is a component that changes the layer inside it\n(the child). A definition with an ",[10,153,145],{}," is a filter, nothing else to declare.",[140,156,157,158,161,162,165,166,173,174,180,181,187,188,193,194,199,200,202],{},"There are two kinds of effect. A ",[148,159,160],{},"pointwise"," effect edits the child's color at this pixel\nand nothing else. It is cheap and keeps the child's alpha. A ",[148,163,164],{},"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. ",[167,168,170],"a",{"href":169},"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Ftinttoward",[10,171,172],{},"tintToward"," and\n",[167,175,177],{"href":176},"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fpaintthrough",[10,178,179],{},"paintThrough"," are pointwise, ",[167,182,184],{"href":183},"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fdisplaceby",[10,185,186],{},"displaceBy"," is a gather, and ",[167,189,191],{"href":190},"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fpointwise",[10,192,160],{}," and ",[167,195,197],{"href":196},"\u002Fdocs\u002Fprimitives\u002Ffilter\u002Fgather",[10,198,164],{}," 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 ",[10,201,145],{}," field.",[204,205,210],"pre",{"className":206,"code":207,"language":208,"meta":209,"style":209},"language-ts shiki shiki-themes github-dark","import {tintToward, paintThrough, displaceBy, …} from 'shaders\u002Fstd'\n","ts","",[10,211,212],{"__ignoreMap":209},[213,214,217,221,225,228],"span",{"class":215,"line":216},"line",1,[213,218,220],{"class":219},"snl16","import",[213,222,224],{"class":223},"s95oV"," {tintToward, paintThrough, displaceBy, …} ",[213,226,227],{"class":219},"from",[213,229,231],{"class":230},"sU2Wk"," 'shaders\u002Fstd'\n",[233,234,236],"h2",{"id":235},"reach-for-it-when","Reach for it when",[238,239,240,253],"table",{},[241,242,243],"thead",{},[244,245,246,250],"tr",{},[247,248,249],"th",{},"When you need",[247,251,252],{},"Use",[254,255,256,268,279,290,301],"tbody",{},[244,257,258,262],{},[259,260,261],"td",{},"tint or darken the child, by a mask or a slider",[259,263,264],{},[167,265,266],{"href":169},[10,267,172],{},[244,269,270,273],{},[259,271,272],{},"a gradient or pattern showing through text",[259,274,275],{},[167,276,277],{"href":176},[10,278,179],{},[244,280,281,284],{},[259,282,283],{},"a ripple or fluid distortion driven by a simulation",[259,285,286],{},[167,287,288],{"href":183},[10,289,186],{},[244,291,292,295],{},[259,293,294],{},"your own color math on the child's pixel",[259,296,297],{},[167,298,299],{"href":190},[10,300,160],{},[244,302,303,306],{},[259,304,305],{},"your own effect that reads the child's neighbours",[259,307,308],{},[167,309,310],{"href":196},[10,311,164],{},[233,313,315],{"id":314},"example","Example",[204,317,319],{"className":206,"code":318,"language":208,"meta":209,"style":209},"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",[10,320,321,332,339,346,369,381,387,399,416,427,437,448,454,475,532,538,554],{"__ignoreMap":209},[213,322,323,325,328,330],{"class":215,"line":216},[213,324,220],{"class":219},[213,326,327],{"class":223}," {defineShader, p, tintToward, radialMask, isZero, transformColor, transformPosition} ",[213,329,227],{"class":219},[213,331,231],{"class":230},[213,333,335],{"class":215,"line":334},2,[213,336,338],{"emptyLinePlaceholder":337},true,"\n",[213,340,342],{"class":215,"line":341},3,[213,343,345],{"class":344},"sAwPA","\u002F\u002F Vignette: tint the frame toward a color, more toward the edges, nothing at the center.\n",[213,347,349,352,355,359,362,366],{"class":215,"line":348},4,[213,350,351],{"class":219},"export",[213,353,354],{"class":219}," const",[213,356,358],{"class":357},"sDLfK"," Vignette",[213,360,361],{"class":219}," =",[213,363,365],{"class":364},"svObZ"," defineShader",[213,367,368],{"class":223},"({\n",[213,370,372,375,378],{"class":215,"line":371},5,[213,373,374],{"class":223},"  name: ",[213,376,377],{"class":230},"'Vignette'",[213,379,380],{"class":223},",\n",[213,382,384],{"class":215,"line":383},6,[213,385,386],{"class":223},"  props: {\n",[213,388,390,393,396],{"class":215,"line":389},7,[213,391,392],{"class":223},"    color: {default: ",[213,394,395],{"class":230},"'#000000'",[213,397,398],{"class":223},", transform: transformColor},\n",[213,400,402,405,408,411,413],{"class":215,"line":401},8,[213,403,404],{"class":223},"    center: {default: {x: ",[213,406,407],{"class":357},"0.5",[213,409,410],{"class":223},", y: ",[213,412,407],{"class":357},[213,414,415],{"class":223},"}, transform: transformPosition},\n",[213,417,419,422,424],{"class":215,"line":418},9,[213,420,421],{"class":223},"    radius: {default: ",[213,423,407],{"class":357},[213,425,426],{"class":223},"},\n",[213,428,430,433,435],{"class":215,"line":429},10,[213,431,432],{"class":223},"    falloff: {default: ",[213,434,407],{"class":357},[213,436,426],{"class":223},[213,438,440,443,446],{"class":215,"line":439},11,[213,441,442],{"class":223},"    intensity: {default: ",[213,444,445],{"class":357},"1",[213,447,426],{"class":223},[213,449,451],{"class":215,"line":450},12,[213,452,453],{"class":223},"  },\n",[213,455,457,460,462,465,467,469,472],{"class":215,"line":456},13,[213,458,459],{"class":223},"  effect: ",[213,461,172],{"class":364},[213,463,464],{"class":223},"(",[213,466,140],{"class":364},[213,468,464],{"class":223},[213,470,471],{"class":230},"'color'",[213,473,474],{"class":223},"), {\n",[213,476,478,481,484,487,489,491,494,497,499,501,504,507,509,511,514,517,520,522,524,526,529],{"class":215,"line":477},14,[213,479,480],{"class":223},"    amount: ",[213,482,483],{"class":364},"radialMask",[213,485,486],{"class":223},"({center: ",[213,488,140],{"class":364},[213,490,464],{"class":223},[213,492,493],{"class":230},"'center'",[213,495,496],{"class":223},"), radius: ",[213,498,140],{"class":364},[213,500,464],{"class":223},[213,502,503],{"class":230},"'radius'",[213,505,506],{"class":223},"), falloff: ",[213,508,140],{"class":364},[213,510,464],{"class":223},[213,512,513],{"class":230},"'falloff'",[213,515,516],{"class":223},")}).",[213,518,519],{"class":364},"times",[213,521,464],{"class":223},[213,523,140],{"class":364},[213,525,464],{"class":223},[213,527,528],{"class":230},"'intensity'",[213,530,531],{"class":223},")),\n",[213,533,535],{"class":215,"line":534},15,[213,536,537],{"class":223},"  }),\n",[213,539,541,544,547,549,551],{"class":215,"line":540},16,[213,542,543],{"class":223},"  identityWhen: ",[213,545,546],{"class":364},"isZero",[213,548,464],{"class":223},[213,550,528],{"class":230},[213,552,553],{"class":223},"),\n",[213,555,557],{"class":215,"line":556},17,[213,558,559],{"class":223},"})\n",[233,561,563],{"id":562},"types","Types",[238,565,566,576],{},[241,567,568],{},[244,569,570,573],{},[247,571,572],{},"Type",[247,574,575],{},"What it is",[254,577,578,594],{},[244,579,580,585],{},[259,581,582],{},[10,583,584],{},"DisplaceByEffect",[259,586,587,588,590,591,593],{},"What ",[10,589,186],{}," returns: the simulation field and the props it reads, ready for ",[10,592,145],{},".",[244,595,596,601],{},[259,597,598],{},[10,599,600],{},"TintTowardEffect",[259,602,587,603,605,606,593],{},[10,604,172],{}," returns: the color prop and the amount, ready for ",[10,607,145],{},[233,609,611],{"id":610},"words","Words",[613,614,616],"primitive-words",{":words":615},"[{\"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.\"}]",[617,618,619,627,634,641,648],"ul",{},[620,621,622,626],"li",{},[167,623,624],{"href":169},[10,625,172],{}," — Mix the child's color toward one color by an amount, leaving its alpha alone.",[620,628,629,633],{},[167,630,631],{"href":176},[10,632,179],{}," — Show a paint through the child, so the child becomes the mask.",[620,635,636,640],{},[167,637,638],{"href":183},[10,639,186],{}," — Push the child's pixels around by a vector field from one of your simulations.",[620,642,643,647],{},[167,644,645],{"href":190},[10,646,160],{}," — Write your own pointwise effect: a function of the child's color at this pixel.",[620,649,650,654],{},[167,651,652],{"href":196},[10,653,164],{}," — Write your own gather effect: a function that can read the child anywhere.",[656,657,658],"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":209,"searchDepth":334,"depth":334,"links":660},[661,662,663,664],{"id":235,"depth":334,"text":236},{"id":314,"depth":334,"text":315},{"id":562,"depth":334,"text":563},{"id":610,"depth":334,"text":611},null,"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":131,"description":666},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Ffilter.ts","docs\u002Fprimitives\u002F25.filter\u002Findex","VPMISEUFa1rSFuXSLpBgDxQI6UmlVWCJ3pPlGuQ7VZQ"]