[{"data":1,"prerenderedAt":692,"buildId":693},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fprimitives\u002Fop":3,"github-stars":600,"guide-nav":602},{"id":4,"title":5,"body":6,"categoryId":585,"categorySlug":585,"categoryTitle":586,"curated":587,"description":588,"editUrl":589,"extension":590,"group":591,"groupTitle":592,"kind":586,"meta":593,"navigation":587,"path":594,"seo":595,"sourceUrl":596,"stem":597,"wordCount":598,"__hash__":599},"primitives\u002Fdocs\u002Fprimitives\u002F47.op\u002Findex.md","Grid steps",{"type":7,"value":8,"toc":579},"minimark",[9,13,34,63,68,209,213,441,445,575],[10,11,5],"h1",{"id":12},"grid-steps",[14,15,16,17,21,22,25,26,29,30,33],"p",{},"The steps a ",[18,19,20],"code",{},"grid"," runs every frame, and the outputs it derives. Every cell holds a\n",[18,23,24],{},"vec4f","; most steps work on ",[18,27,28],{},".x"," and leave the other channels for you. Steps run in the order you\nlist them. ",[18,31,32],{},"op.kernel"," is your own step in WGSL, for anything the others do not cover.",[35,36,41],"pre",{"className":37,"code":38,"language":39,"meta":40,"style":40},"language-ts shiki shiki-themes github-dark","import {op} from 'shaders\u002Fstd'\n","ts","",[18,42,43],{"__ignoreMap":40},[44,45,48,52,56,59],"span",{"class":46,"line":47},"line",1,[44,49,51],{"class":50},"snl16","import",[44,53,55],{"class":54},"s95oV"," {op} ",[44,57,58],{"class":50},"from",[44,60,62],{"class":61},"sU2Wk"," 'shaders\u002Fstd'\n",[64,65,67],"h2",{"id":66},"reach-for-it-when","Reach for it when",[69,70,71,84],"table",{},[72,73,74],"thead",{},[75,76,77,81],"tr",{},[78,79,80],"th",{},"When you need",[78,82,83],{},"Use",[85,86,87,116,136,149,170,183,196],"tbody",{},[75,88,89,93],{},[90,91,92],"td",{},"ripples from the cursor",[90,94,95,102,103,109,110],{},[96,97,99],"a",{"href":98},"\u002Fdocs\u002Fprimitives\u002Fop\u002Fwave",[18,100,101],{},"wave"," with ",[96,104,106],{"href":105},"\u002Fdocs\u002Fprimitives\u002Fop\u002Fsplat",[18,107,108],{},"splat",", derive ",[96,111,113],{"href":112},"\u002Fdocs\u002Fprimitives\u002Fop\u002Fgradient",[18,114,115],{},"gradient",[75,117,118,121],{},[90,119,120],{},"something spreads and fades",[90,122,123,129,130],{},[96,124,126],{"href":125},"\u002Fdocs\u002Fprimitives\u002Fop\u002Fdiffuse",[18,127,128],{},"diffuse",", ",[96,131,133],{"href":132},"\u002Fdocs\u002Fprimitives\u002Fop\u002Fdecay",[18,134,135],{},"decay",[75,137,138,141],{},[90,139,140],{},"organic spots, stripes, mazes",[90,142,143],{},[96,144,146],{"href":145},"\u002Fdocs\u002Fprimitives\u002Fop\u002Freactdiffuse",[18,147,148],{},"reactDiffuse",[75,150,151,154],{},[90,152,153],{},"a growing frost or crackle edge that can retreat",[90,155,156,162,163,169],{},[96,157,159],{"href":158},"\u002Fdocs\u002Fprimitives\u002Fop\u002Fgrowthfront",[18,160,161],{},"growthFront",", with ",[96,164,166],{"href":165},"\u002Fdocs\u002Fprimitives\u002Fop\u002Foccupancy",[18,167,168],{},"occupancy"," so fronts stop on contact",[75,171,172,175],{},[90,173,174],{},"a cellular automaton (Life)",[90,176,177],{},[96,178,180],{"href":179},"\u002Fdocs\u002Fprimitives\u002Fop\u002Fautomaton",[18,181,182],{},"automaton",[75,184,185,188],{},[90,186,187],{},"a temperature that spreads and cools",[90,189,190],{},[96,191,193],{"href":192},"\u002Fdocs\u002Fprimitives\u002Fop\u002Fheat",[18,194,195],{},"heat",[75,197,198,201],{},[90,199,200],{},"your own rule",[90,202,203],{},[96,204,206],{"href":205},"\u002Fdocs\u002Fprimitives\u002Fop\u002Fkernel",[18,207,208],{},"kernel",[64,210,212],{"id":211},"types","Types",[69,214,215,225],{},[72,216,217],{},[75,218,219,222],{},[78,220,221],{},"Type",[78,223,224],{},"What it is",[85,226,227,248,260,274,288,304,314,324,348,369,383,393,410,427],{},[75,228,229,234],{},[90,230,231],{},[18,232,233],{},"AutomatonOp",[90,235,236,237,239,240,243,244,247],{},"A cellular automaton on ",[18,238,28],{}," (0 or 1): born with ",[18,241,242],{},"birth"," live neighbours, survives with ",[18,245,246],{},"survive",".",[75,249,250,255],{},[90,251,252],{},[18,253,254],{},"CellKernelOp",[90,256,257,258,247],{},"Your own step: a WGSL body run per cell, returning the cell's new ",[18,259,24],{},[75,261,262,267],{},[90,263,264],{},[18,265,266],{},"DecayOp",[90,268,269,270,273],{},"Fade every channel toward 0, halving every ",[18,271,272],{},"halfLife"," seconds.",[75,275,276,281],{},[90,277,278],{},[18,279,280],{},"DiffuseOp",[90,282,283,284,287],{},"Spread every channel into the neighbours at ",[18,285,286],{},"rate"," per second (a blur, as a step).",[75,289,290,295],{},[90,291,292],{},[18,293,294],{},"GradientOp",[90,296,297,298,300,301,247],{},"The slope of ",[18,299,28],{}," at every cell, as ",[18,302,303],{},".xy",[75,305,306,311],{},[90,307,308],{},[18,309,310],{},"GridDeriveOp",[90,312,313],{},"Any output a grid can derive.",[75,315,316,321],{},[90,317,318],{},[18,319,320],{},"GridStepOp",[90,322,323],{},"Any step a grid can run.",[75,325,326,331],{},[90,327,328],{},[18,329,330],{},"GrowthFrontOp",[90,332,333,334,336,337,339,340,343,344,347],{},"A spreading boundary in ",[18,335,28],{}," (0 → 1) that creeps into neighbours at ",[18,338,286],{}," cells per second, ragged by ",[18,341,342],{},"roughness","; ",[18,345,346],{},"reverse"," makes it retreat.",[75,349,350,355],{},[90,351,352],{},[18,353,354],{},"HeatOp",[90,356,357,358,360,361,364,365,368],{},"A temperature in ",[18,359,28],{}," that spreads (",[18,362,363],{},"spread",") and cools (",[18,366,367],{},"cool"," per second).",[75,370,371,376],{},[90,372,373],{},[18,374,375],{},"OccupancyOp",[90,377,378,379,382],{},"First-come-wins claims in ",[18,380,381],{},".w",": an empty cell next to a claimed one takes its claim, so fronts from different seeds merge and stop instead of overwriting.",[75,384,385,390],{},[90,386,387],{},[18,388,389],{},"OpArg",[90,391,392],{},"A number, or a prop read live each frame.",[75,394,395,400],{},[90,396,397],{},[18,398,399],{},"ReactDiffuseOp",[90,401,402,403,405,406,409],{},"Gray-Scott reaction-diffusion on ",[18,404,28],{}," (A) and ",[18,407,408],{},".y"," (B).",[75,411,412,417],{},[90,413,414],{},[18,415,416],{},"SplatOp",[90,418,419,420,422,423,426],{},"Press a soft round brush into ",[18,421,28],{}," wherever the pointer moves (",[18,424,425],{},"radius"," 0.1–1, a fraction of the grid).",[75,428,429,434],{},[90,430,431],{},[18,432,433],{},"WaveOp",[90,435,436,437,440],{},"Ripple like a water surface, fading by ",[18,438,439],{},"damping"," (0 rings forever, 20 dies in a few frames).",[64,442,444],{"id":443},"words","Words",[446,447,449],"primitive-words",{":words":448},"[{\"name\":\"wave\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fop\u002Fwave\",\"summary\":\"A wave step: the grid ripples outward from any disturbance and fades by `damping` (a prop or number, 0–20).\"},{\"name\":\"splat\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fop\u002Fsplat\",\"summary\":\"A brush step: a soft round push into `.x` at the pointer, scaled by how fast it moves.\"},{\"name\":\"gradient\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fop\u002Fgradient\",\"summary\":\"A derived output: the slope of `.x` at every cell as `.xy`, ready for a displacement.\"},{\"name\":\"diffuse\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fop\u002Fdiffuse\",\"summary\":\"Spread every channel into its neighbours at `rate` per second.\"},{\"name\":\"decay\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fop\u002Fdecay\",\"summary\":\"Fade every channel toward 0, halving every `halfLife` seconds.\"},{\"name\":\"reactDiffuse\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fop\u002Freactdiffuse\",\"summary\":\"Gray-Scott reaction-diffusion on `.x` and `.y`.\"},{\"name\":\"growthFront\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fop\u002Fgrowthfront\",\"summary\":\"A spreading boundary in `.x` that creeps outward from seeded cells (`.x = 1` from `init` or a splat) at `rate` cells per second.\"},{\"name\":\"occupancy\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fop\u002Foccupancy\",\"summary\":\"First-come-wins claims in `.w`.\"},{\"name\":\"automaton\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fop\u002Fautomaton\",\"summary\":\"A cellular automaton on `.x`.\"},{\"name\":\"heat\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fop\u002Fheat\",\"summary\":\"A temperature in `.x` that spreads and cools.\"},{\"name\":\"kernel\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fop\u002Fkernel\",\"summary\":\"Your own grid step, run once per cell: return the cell's new `vec4f`.\"}]",[450,451,452,463,473,486,496,505,517,538,547,556,566],"ul",{},[453,454,455,459,460,462],"li",{},[96,456,457],{"href":98},[18,458,101],{}," — A wave step: the grid ripples outward from any disturbance and fades by ",[18,461,439],{}," (a prop or number, 0–20).",[453,464,465,469,470,472],{},[96,466,467],{"href":105},[18,468,108],{}," — A brush step: a soft round push into ",[18,471,28],{}," at the pointer, scaled by how fast it moves.",[453,474,475,479,480,482,483,485],{},[96,476,477],{"href":112},[18,478,115],{}," — A derived output: the slope of ",[18,481,28],{}," at every cell as ",[18,484,303],{},", ready for a displacement.",[453,487,488,492,493,495],{},[96,489,490],{"href":125},[18,491,128],{}," — Spread every channel into its neighbours at ",[18,494,286],{}," per second.",[453,497,498,502,503,273],{},[96,499,500],{"href":132},[18,501,135],{}," — Fade every channel toward 0, halving every ",[18,504,272],{},[453,506,507,511,512,514,515,247],{},[96,508,509],{"href":145},[18,510,148],{}," — Gray-Scott reaction-diffusion on ",[18,513,28],{}," and ",[18,516,408],{},[453,518,519,523,524,526,527,530,531,534,535,537],{},[96,520,521],{"href":158},[18,522,161],{}," — A spreading boundary in ",[18,525,28],{}," that creeps outward from seeded cells (",[18,528,529],{},".x = 1"," from ",[18,532,533],{},"init"," or a splat) at ",[18,536,286],{}," cells per second.",[453,539,540,544,545,247],{},[96,541,542],{"href":165},[18,543,168],{}," — First-come-wins claims in ",[18,546,381],{},[453,548,549,553,554,247],{},[96,550,551],{"href":179},[18,552,182],{}," — A cellular automaton on ",[18,555,28],{},[453,557,558,562,563,565],{},[96,559,560],{"href":192},[18,561,195],{}," — A temperature in ",[18,564,28],{}," that spreads and cools.",[453,567,568,572,573,247],{},[96,569,570],{"href":205},[18,571,208],{}," — Your own grid step, run once per cell: return the cell's new ",[18,574,24],{},[576,577,578],"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);}",{"title":40,"searchDepth":580,"depth":580,"links":581},2,[582,583,584],{"id":66,"depth":580,"text":67},{"id":211,"depth":580,"text":212},{"id":443,"depth":580,"text":444},"op",null,true,"The steps a grid runs every frame, and the outputs it derives.","https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fedit\u002Fmain\u002Fpackages\u002Fcore\u002Fdocs\u002Fstd\u002Fop.md","md","simulation","Simulation",{},"\u002Fdocs\u002Fprimitives\u002Fop",{"title":5,"description":588},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Fops.ts","docs\u002Fprimitives\u002F47.op\u002Findex",11,"p-s8GC97RvvvfRGVZ2ijZvLEHZ3kUEoIz1kiFlVjgPU",{"stars":601},6080,[603,607,611,615,619,623,627,631,635,639,643,647,651,655,659,663,667,672,676,680,684,688],{"path":604,"title":605,"description":606,"category":18},"\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":608,"title":609,"description":610,"category":18},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":612,"title":613,"description":614,"category":18},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":616,"title":617,"description":618,"category":18},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":620,"title":621,"description":622,"category":18},"\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":624,"title":625,"description":626,"category":18},"\u002Fdocs\u002Fguide\u002Fanimation","Animating a shader","Tween a shader's props with Motion, GSAP or anything else that animates a number.",{"path":628,"title":629,"description":630,"category":18},"\u002Fdocs\u002Fguide\u002Fdynamic-props","Dynamic props","Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":632,"title":633,"description":634,"category":18},"\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":636,"title":637,"description":638,"category":18},"\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":640,"title":641,"description":642,"category":18},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":644,"title":645,"description":646,"category":18},"\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":648,"title":649,"description":650,"category":18},"\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":652,"title":653,"description":654,"category":18},"\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":656,"title":657,"description":658,"category":18},"\u002Fdocs\u002Fguide\u002Fperformance","Performance","Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":660,"title":661,"description":662,"category":18},"\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":664,"title":665,"description":666,"category":18},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":668,"title":669,"description":670,"category":671},"\u002Fdocs\u002Fguide\u002Fmcp","Working with your agent","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.","workflows",{"path":673,"title":674,"description":675,"category":671},"\u002Fdocs\u002Fguide\u002Fcli","Working with the CLI","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":677,"title":678,"description":679,"category":671},"\u002Fdocs\u002Fguide\u002Fframeworks","Supported frameworks","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.",{"path":681,"title":682,"description":683,"category":18},"\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":685,"title":686,"description":687,"category":18},"\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":689,"title":690,"description":691,"category":18},"\u002Fdocs\u002Fguide\u002Fssr","Server rendering","Render Shaders in Next.js, Nuxt, SvelteKit, SolidStart and other SSR apps by keeping each shader on the client.",1796051186377,"06e02370-81a6-4d74-9931-661d71414be1"]