[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"github-stars":3,"guide-nav":5,"doc-\u002Fdocs\u002Fprimitives\u002Fgradients":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":138,"categorySlug":138,"categoryTitle":731,"curated":305,"description":732,"editUrl":733,"extension":734,"group":735,"groupTitle":736,"kind":731,"meta":737,"navigation":305,"path":738,"seo":739,"sourceUrl":740,"stem":741,"wordCount":339,"__hash__":742},"primitives\u002Fdocs\u002Fprimitives\u002F7.gradients\u002Findex.md","Gradients",{"type":133,"value":134,"toc":725},"minimark",[135,139,151,166,195,200,280,284,636,640,667,671,721],[136,137,131],"h1",{"id":138},"gradients",[140,141,142,143,146,147,150],"p",{},"Finished gradient paints: a flat fill, a color wheel that cycles over time, a cloud of five\ncolored points, and a beam of light between two points. Each word binds your props and\nreturns a paint, so a definition is the props plus one line. They are complete looks rather\nthan building blocks. For a gradient of your own shape, compose a ",[10,144,145],{},"dist"," field with ",[10,148,149],{},"rampOver","\nfrom the fields words instead.",[140,152,153,154,157,158,161,162,165],{},"Colors mix in the color space you declare on a ",[10,155,156],{},"compileTime"," prop, and positions are props\nmade with ",[10,159,160],{},"transformPosition",". The result goes in the definition's ",[10,163,164],{},"paint:"," field.",[167,168,173],"pre",{"className":169,"code":170,"language":171,"meta":172,"style":172},"language-ts shiki shiki-themes github-dark","import {gradients} from 'shaders\u002Fstd'\n","ts","",[10,174,175],{"__ignoreMap":172},[176,177,180,184,188,191],"span",{"class":178,"line":179},"line",1,[176,181,183],{"class":182},"snl16","import",[176,185,187],{"class":186},"s95oV"," {gradients} ",[176,189,190],{"class":182},"from",[176,192,194],{"class":193},"sU2Wk"," 'shaders\u002Fstd'\n",[196,197,199],"h2",{"id":198},"reach-for-it-when","Reach for it when",[201,202,203,216],"table",{},[204,205,206],"thead",{},[207,208,209,213],"tr",{},[210,211,212],"th",{},"When you need",[210,214,215],{},"Use",[217,218,219,234,247,260],"tbody",{},[207,220,221,225],{},[222,223,224],"td",{},"a single color, possibly translucent",[222,226,227],{},[228,229,231],"a",{"href":230},"\u002Fdocs\u002Fprimitives\u002Fgradients\u002Fsolidcolor",[10,232,233],{},"solidColor",[207,235,236,239],{},[222,237,238],{},"a rainbow or three-color cycle that drifts across the canvas",[222,240,241],{},[228,242,244],{"href":243},"\u002Fdocs\u002Fprimitives\u002Fgradients\u002Fcolorwheel",[10,245,246],{},"colorWheel",[207,248,249,252],{},[222,250,251],{},"five draggable color points blended by nearness",[222,253,254],{},[228,255,257],{"href":256},"\u002Fdocs\u002Fprimitives\u002Fgradients\u002Fpointcloudgradient",[10,258,259],{},"pointCloudGradient",[207,261,262,265],{},[222,263,264],{},"a soft beam of light from one point to another",[222,266,267,273,274],{},[228,268,270],{"href":269},"\u002Fdocs\u002Fprimitives\u002Fgradients\u002Fbeam",[10,271,272],{},"beam"," with ",[228,275,277],{"href":276},"\u002Fdocs\u002Fprimitives\u002Fgradients\u002Fbeampreconvertedfields",[10,278,279],{},"beamPreconvertedFields",[196,281,283],{"id":282},"example","Example",[167,285,287],{"className":169,"code":286,"language":171,"meta":172,"style":172},"import {defineShader, p, gradients, transformColor, transformPosition, transformColorSpace, colorSpaceOptions} from 'shaders\u002Fstd'\n\n\u002F\u002F A tapered beam: wide and soft at the start, tight at the end, red core fading to blue.\nexport const Beam = defineShader({\n  name: 'Beam',\n  extraFields: gradients.beamPreconvertedFields,\n  props: {\n    startPosition: {default: {x: 0.2, y: 0.5}, transform: transformPosition},\n    endPosition: {default: {x: 0.8, y: 0.5}, transform: transformPosition},\n    startThickness: {default: 0.4},\n    endThickness: {default: 0.1},\n    startSoftness: {default: 1},\n    endSoftness: {default: 0.3},\n    insideColor: {default: '#ff3b30', transform: transformColor},\n    outsideColor: {default: '#1e40ff', transform: transformColor},\n    colorSpace: {default: 'oklab', transform: transformColorSpace, compileTime: true, ui: {type: 'select', options: colorSpaceOptions}},\n  },\n  paint: gradients.beam({\n    from: p('startPosition'),\n    to: p('endPosition'),\n    thickness: {start: p('startThickness'), end: p('endThickness')},\n    softness: {start: p('startSoftness'), end: p('endSoftness')},\n    colors: {inside: p('insideColor'), outside: p('outsideColor')},\n    space: p('colorSpace'),\n  }),\n})\n",[10,288,289,300,307,314,337,349,355,361,379,394,406,417,428,439,451,462,486,492,502,519,534,560,584,609,624,630],{"__ignoreMap":172},[176,290,291,293,296,298],{"class":178,"line":179},[176,292,183],{"class":182},[176,294,295],{"class":186}," {defineShader, p, gradients, transformColor, transformPosition, transformColorSpace, colorSpaceOptions} ",[176,297,190],{"class":182},[176,299,194],{"class":193},[176,301,303],{"class":178,"line":302},2,[176,304,306],{"emptyLinePlaceholder":305},true,"\n",[176,308,310],{"class":178,"line":309},3,[176,311,313],{"class":312},"sAwPA","\u002F\u002F A tapered beam: wide and soft at the start, tight at the end, red core fading to blue.\n",[176,315,317,320,323,327,330,334],{"class":178,"line":316},4,[176,318,319],{"class":182},"export",[176,321,322],{"class":182}," const",[176,324,326],{"class":325},"sDLfK"," Beam",[176,328,329],{"class":182}," =",[176,331,333],{"class":332},"svObZ"," defineShader",[176,335,336],{"class":186},"({\n",[176,338,340,343,346],{"class":178,"line":339},5,[176,341,342],{"class":186},"  name: ",[176,344,345],{"class":193},"'Beam'",[176,347,348],{"class":186},",\n",[176,350,352],{"class":178,"line":351},6,[176,353,354],{"class":186},"  extraFields: gradients.beamPreconvertedFields,\n",[176,356,358],{"class":178,"line":357},7,[176,359,360],{"class":186},"  props: {\n",[176,362,364,367,370,373,376],{"class":178,"line":363},8,[176,365,366],{"class":186},"    startPosition: {default: {x: ",[176,368,369],{"class":325},"0.2",[176,371,372],{"class":186},", y: ",[176,374,375],{"class":325},"0.5",[176,377,378],{"class":186},"}, transform: transformPosition},\n",[176,380,382,385,388,390,392],{"class":178,"line":381},9,[176,383,384],{"class":186},"    endPosition: {default: {x: ",[176,386,387],{"class":325},"0.8",[176,389,372],{"class":186},[176,391,375],{"class":325},[176,393,378],{"class":186},[176,395,397,400,403],{"class":178,"line":396},10,[176,398,399],{"class":186},"    startThickness: {default: ",[176,401,402],{"class":325},"0.4",[176,404,405],{"class":186},"},\n",[176,407,409,412,415],{"class":178,"line":408},11,[176,410,411],{"class":186},"    endThickness: {default: ",[176,413,414],{"class":325},"0.1",[176,416,405],{"class":186},[176,418,420,423,426],{"class":178,"line":419},12,[176,421,422],{"class":186},"    startSoftness: {default: ",[176,424,425],{"class":325},"1",[176,427,405],{"class":186},[176,429,431,434,437],{"class":178,"line":430},13,[176,432,433],{"class":186},"    endSoftness: {default: ",[176,435,436],{"class":325},"0.3",[176,438,405],{"class":186},[176,440,442,445,448],{"class":178,"line":441},14,[176,443,444],{"class":186},"    insideColor: {default: ",[176,446,447],{"class":193},"'#ff3b30'",[176,449,450],{"class":186},", transform: transformColor},\n",[176,452,454,457,460],{"class":178,"line":453},15,[176,455,456],{"class":186},"    outsideColor: {default: ",[176,458,459],{"class":193},"'#1e40ff'",[176,461,450],{"class":186},[176,463,465,468,471,474,477,480,483],{"class":178,"line":464},16,[176,466,467],{"class":186},"    colorSpace: {default: ",[176,469,470],{"class":193},"'oklab'",[176,472,473],{"class":186},", transform: transformColorSpace, compileTime: ",[176,475,476],{"class":325},"true",[176,478,479],{"class":186},", ui: {type: ",[176,481,482],{"class":193},"'select'",[176,484,485],{"class":186},", options: colorSpaceOptions}},\n",[176,487,489],{"class":178,"line":488},17,[176,490,491],{"class":186},"  },\n",[176,493,495,498,500],{"class":178,"line":494},18,[176,496,497],{"class":186},"  paint: gradients.",[176,499,272],{"class":332},[176,501,336],{"class":186},[176,503,505,508,510,513,516],{"class":178,"line":504},19,[176,506,507],{"class":186},"    from: ",[176,509,140],{"class":332},[176,511,512],{"class":186},"(",[176,514,515],{"class":193},"'startPosition'",[176,517,518],{"class":186},"),\n",[176,520,522,525,527,529,532],{"class":178,"line":521},20,[176,523,524],{"class":186},"    to: ",[176,526,140],{"class":332},[176,528,512],{"class":186},[176,530,531],{"class":193},"'endPosition'",[176,533,518],{"class":186},[176,535,537,540,542,544,547,550,552,554,557],{"class":178,"line":536},21,[176,538,539],{"class":186},"    thickness: {start: ",[176,541,140],{"class":332},[176,543,512],{"class":186},[176,545,546],{"class":193},"'startThickness'",[176,548,549],{"class":186},"), end: ",[176,551,140],{"class":332},[176,553,512],{"class":186},[176,555,556],{"class":193},"'endThickness'",[176,558,559],{"class":186},")},\n",[176,561,563,566,568,570,573,575,577,579,582],{"class":178,"line":562},22,[176,564,565],{"class":186},"    softness: {start: ",[176,567,140],{"class":332},[176,569,512],{"class":186},[176,571,572],{"class":193},"'startSoftness'",[176,574,549],{"class":186},[176,576,140],{"class":332},[176,578,512],{"class":186},[176,580,581],{"class":193},"'endSoftness'",[176,583,559],{"class":186},[176,585,587,590,592,594,597,600,602,604,607],{"class":178,"line":586},23,[176,588,589],{"class":186},"    colors: {inside: ",[176,591,140],{"class":332},[176,593,512],{"class":186},[176,595,596],{"class":193},"'insideColor'",[176,598,599],{"class":186},"), outside: ",[176,601,140],{"class":332},[176,603,512],{"class":186},[176,605,606],{"class":193},"'outsideColor'",[176,608,559],{"class":186},[176,610,612,615,617,619,622],{"class":178,"line":611},24,[176,613,614],{"class":186},"    space: ",[176,616,140],{"class":332},[176,618,512],{"class":186},[176,620,621],{"class":193},"'colorSpace'",[176,623,518],{"class":186},[176,625,627],{"class":178,"line":626},25,[176,628,629],{"class":186},"  }),\n",[176,631,633],{"class":178,"line":632},26,[176,634,635],{"class":186},"})\n",[196,637,639],{"id":638},"types","Types",[201,641,642,652],{},[204,643,644],{},[207,645,646,649],{},[210,647,648],{},"Type",[210,650,651],{},"What it is",[217,653,654],{},[207,655,656,661],{},[222,657,658],{},[10,659,660],{},"Paint",[222,662,663,664,666],{},"What a generator's ",[10,665,164],{}," field takes: a function that returns the color at this pixel.",[196,668,670],{"id":669},"words","Words",[672,673,675],"primitive-words",{":words":674},"[{\"name\":\"solidColor\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fgradients\u002Fsolidcolor\",\"summary\":\"A flat fill in one color prop.\"},{\"name\":\"beam\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fgradients\u002Fbeam\",\"summary\":\"A glowing beam of light between two points.\"},{\"name\":\"beamPreconvertedFields\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fgradients\u002Fbeampreconvertedfields\",\"summary\":\"The `extraFields` a `beam` definition must declare.\"},{\"name\":\"colorWheel\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fgradients\u002Fcolorwheel\",\"summary\":\"A striped gradient that slides across the canvas, cycling through its colors over time.\"},{\"name\":\"pointCloudGradient\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fgradients\u002Fpointcloudgradient\",\"summary\":\"Five colored points placed anywhere on the canvas, each pixel taking the colors of the points nearest it.\"}]",[676,677,678,686,693,707,714],"ul",{},[679,680,681,685],"li",{},[228,682,683],{"href":230},[10,684,233],{}," — A flat fill in one color prop.",[679,687,688,692],{},[228,689,690],{"href":269},[10,691,272],{}," — A glowing beam of light between two points.",[679,694,695,699,700,703,704,706],{},[228,696,697],{"href":276},[10,698,279],{}," — The ",[10,701,702],{},"extraFields"," a ",[10,705,272],{}," definition must declare.",[679,708,709,713],{},[228,710,711],{"href":243},[10,712,246],{}," — A striped gradient that slides across the canvas, cycling through its colors over time.",[679,715,716,720],{},[228,717,718],{"href":256},[10,719,259],{}," — Five colored points placed anywhere on the canvas, each pixel taking the colors of the points nearest it.",[722,723,724],"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":172,"searchDepth":302,"depth":302,"links":726},[727,728,729,730],{"id":198,"depth":302,"text":199},{"id":282,"depth":302,"text":283},{"id":638,"depth":302,"text":639},{"id":669,"depth":302,"text":670},null,"Finished gradient paints: a flat fill, a color wheel that cycles over time, a cloud of five colored points, and a beam of light between two points.","https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fedit\u002Fmain\u002Fpackages\u002Fcore\u002Fdocs\u002Fstd\u002Fgradients.md","md","paint","Painting",{},"\u002Fdocs\u002Fprimitives\u002Fgradients",{"title":131,"description":732},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Fpaint\u002Fgradients.ts","docs\u002Fprimitives\u002F7.gradients\u002Findex","b-LBhopLJ07mP1M9fLFPhM-ocy0Bqk6ASZZJVqCcvmM"]