[{"data":1,"prerenderedAt":383,"buildId":384},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fprimitives\u002Fsim-grids\u002Fstage-settle":3,"github-stars":291,"guide-nav":293},{"id":4,"title":5,"body":6,"categoryId":274,"categorySlug":275,"categoryTitle":276,"curated":277,"description":278,"editUrl":279,"extension":280,"group":281,"groupTitle":282,"kind":283,"meta":284,"navigation":285,"path":286,"seo":287,"sourceUrl":288,"stem":289,"wordCount":279,"__hash__":290},"primitives\u002Fdocs\u002Fprimitives\u002F48.sim-grids\u002F11.stage-settle.md","stage.settle",{"type":7,"value":8,"toc":268},"minimark",[9,13,22,86,101,104,112,117,154,158,233,243,247,264],[10,11,5],"h1",{"id":12},"stagesettle",[14,15,16,17,21],"p",{},"Sleep the simulation once nothing has driven it for ",[18,19,20],"code",{},"settleMs"," of simulated time.",[23,24,29],"pre",{"className":25,"code":26,"language":27,"meta":28,"style":28},"language-ts shiki shiki-themes github-dark","stage.settle(opts: {activeWhen: (f: GridFrame) => boolean; settleMs: (f: GridFrame) => number}): GridStage\n","ts","",[18,30,31],{"__ignoreMap":28},[32,33,36,40,44,47,50,53,57,61,64,67,70,73,75,77,79,81,83],"span",{"class":34,"line":35},"line",1,[32,37,39],{"class":38},"s95oV","stage.",[32,41,43],{"class":42},"svObZ","settle",[32,45,46],{"class":38},"(opts: {",[32,48,49],{"class":42},"activeWhen",[32,51,52],{"class":38},": (",[32,54,56],{"class":55},"s9osk","f",[32,58,60],{"class":59},"snl16",":",[32,62,63],{"class":42}," GridFrame",[32,65,66],{"class":38},") ",[32,68,69],{"class":59},"=>",[32,71,72],{"class":38}," boolean; settleMs: (",[32,74,56],{"class":55},[32,76,60],{"class":59},[32,78,63],{"class":42},[32,80,66],{"class":38},[32,82,69],{"class":59},[32,84,85],{"class":38}," number}): GridStage\n",[14,87,88,89,92,93,96,97,100],{},"Import ",[18,90,91],{},"sim"," from ",[18,94,95],{},"shaders\u002Fstd"," and use ",[18,98,99],{},"sim.grids.stage.settle",".",[14,102,103],{},"Frames are skipped and the last published texture stays on screen, so a still field costs nothing.",[14,105,106,108,109,111],{},[18,107,49],{}," says whether something drove the field this frame. ",[18,110,20],{}," is how long the field takes to fade after the last activity, in milliseconds.",[113,114,116],"h2",{"id":115},"parameters","Parameters",[118,119,120,136],"table",{},[121,122,123],"thead",{},[124,125,126,130,133],"tr",{},[127,128,129],"th",{},"Name",[127,131,132],{},"Type",[127,134,135],{},"Notes",[137,138,139],"tbody",{},[124,140,141,147,152],{},[142,143,144],"td",{},[18,145,146],{},"opts",[142,148,149],{},[18,150,151],{},"{activeWhen: (f: GridFrame) => boolean; settleMs: (f: GridFrame) => number}",[142,153],{},[113,155,157],{"id":156},"example","Example",[23,159,161],{"className":25,"code":160,"language":27,"meta":28,"style":28},"stage.settle({activeWhen: () => moving, settleMs: (f) => 4000 \u002F Math.max(f.num('decay', 1), 0.1)})\n",[18,162,163],{"__ignoreMap":28},[32,164,165,167,169,172,174,177,179,182,184,186,188,190,192,196,199,202,205,208,211,214,218,221,224,227,230],{"class":34,"line":35},[32,166,39],{"class":38},[32,168,43],{"class":42},[32,170,171],{"class":38},"({",[32,173,49],{"class":42},[32,175,176],{"class":38},": () ",[32,178,69],{"class":59},[32,180,181],{"class":38}," moving, ",[32,183,20],{"class":42},[32,185,52],{"class":38},[32,187,56],{"class":55},[32,189,66],{"class":38},[32,191,69],{"class":59},[32,193,195],{"class":194},"sDLfK"," 4000",[32,197,198],{"class":59}," \u002F",[32,200,201],{"class":38}," Math.",[32,203,204],{"class":42},"max",[32,206,207],{"class":38},"(f.",[32,209,210],{"class":42},"num",[32,212,213],{"class":38},"(",[32,215,217],{"class":216},"sU2Wk","'decay'",[32,219,220],{"class":38},", ",[32,222,223],{"class":194},"1",[32,225,226],{"class":38},"), ",[32,228,229],{"class":194},"0.1",[32,231,232],{"class":38},")})\n",[234,235,236],"blockquote",{},[14,237,238,242],{},[239,240,241],"strong",{},"Tip."," Simulated time, not wall-clock: a hidden tab does not count, so the field is still fading when the user comes back.",[113,244,246],{"id":245},"see-also","See also",[248,249,250],"ul",{},[251,252,253,260,261,263],"li",{},[254,255,257],"a",{"href":256},"\u002Fdocs\u002Fprimitives\u002Fsim-grids\u002Fstage-host",[18,258,259],{},"stage.host"," — A named step that runs before any gate: pointer smoothing, activity flags, anything a later ",[18,262,43],{}," needs to know.",[265,266,267],"style",{},"html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}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 .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}",{"title":28,"searchDepth":269,"depth":269,"links":270},2,[271,272,273],{"id":115,"depth":269,"text":116},{"id":156,"depth":269,"text":157},{"id":245,"depth":269,"text":246},"sim.grids","sim-grids","Grid programs",false,"Sleep the simulation once nothing has driven it for `settleMs` of simulated time.",null,"md","simulation","Simulation","function",{},true,"\u002Fdocs\u002Fprimitives\u002Fsim-grids\u002Fstage-settle",{"title":5,"description":278},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Fsim\u002Fgrids.ts#L236","docs\u002Fprimitives\u002F48.sim-grids\u002F11.stage-settle","bb1p4hE-Z7qaEmCIkhGLLu-kS9ccNcb6KtVktWr1zbk",{"stars":292},6080,[294,298,302,306,310,314,318,322,326,330,334,338,342,346,350,354,358,363,367,371,375,379],{"path":295,"title":296,"description":297,"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":299,"title":300,"description":301,"category":18},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":303,"title":304,"description":305,"category":18},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":307,"title":308,"description":309,"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":311,"title":312,"description":313,"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":315,"title":316,"description":317,"category":18},"\u002Fdocs\u002Fguide\u002Fanimation","Animating a shader","Tween a shader's props with Motion, GSAP or anything else that animates a number.",{"path":319,"title":320,"description":321,"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":323,"title":324,"description":325,"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":327,"title":328,"description":329,"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":331,"title":332,"description":333,"category":18},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":335,"title":336,"description":337,"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":339,"title":340,"description":341,"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":343,"title":344,"description":345,"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":347,"title":348,"description":349,"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":351,"title":352,"description":353,"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":355,"title":356,"description":357,"category":18},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":359,"title":360,"description":361,"category":362},"\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":364,"title":365,"description":366,"category":362},"\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":368,"title":369,"description":370,"category":362},"\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":372,"title":373,"description":374,"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":376,"title":377,"description":378,"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":380,"title":381,"description":382,"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.",1796051186995,"06e02370-81a6-4d74-9931-661d71414be1"]