[{"data":1,"prerenderedAt":315,"buildId":316},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fprimitives\u002Finputs-history\u002Fpreviousframe":3,"github-stars":223,"guide-nav":225},{"id":4,"title":5,"body":6,"categoryId":208,"categorySlug":209,"categoryTitle":210,"curated":211,"description":16,"editUrl":212,"extension":213,"group":139,"groupTitle":214,"kind":215,"meta":216,"navigation":217,"path":218,"seo":219,"sourceUrl":220,"stem":221,"wordCount":212,"__hash__":222},"primitives\u002Fdocs\u002Fprimitives\u002F40.inputs-history\u002F1.previousframe.md","previousFrame",{"type":7,"value":8,"toc":204},"minimark",[9,13,17,52,62,73,80,85,126,130,190,200],[10,11,5],"h1",{"id":12},"previousframe",[14,15,16],"p",{},"This layer's own output from an earlier frame.",[18,19,24],"pre",{"className":20,"code":21,"language":22,"meta":23,"style":23},"language-ts shiki shiki-themes github-dark","previousFrame(opts: {frames?: number; scale?: number} = {}): PreviousFrameInput\n","ts","",[25,26,27],"code",{"__ignoreMap":23},[28,29,32,35,39,43,46,49],"span",{"class":30,"line":31},"line",1,[28,33,5],{"class":34},"svObZ",[28,36,38],{"class":37},"s95oV","(opts: {frames?: number; scale",[28,40,42],{"class":41},"snl16","?:",[28,44,45],{"class":37}," number} ",[28,47,48],{"class":41},"=",[28,50,51],{"class":37}," {}): PreviousFrameInput\n",[14,53,54,55,57,58,61],{},"Import ",[25,56,5],{}," from ",[25,59,60],{},"shaders\u002Fstd",".",[14,63,64,65,68,69,72],{},"With no options it is last frame's picture; ",[25,66,67],{},"frames: n"," reads the one from n frames ago (up to 8). ",[25,70,71],{},"scale"," keeps a smaller history, which is cheaper and blurs slightly with every frame (often what a trail wants).",[14,74,75,76,79],{},"Read it like any input: ",[25,77,78],{},"last(uv)"," gives straight-alpha colour. On the first frame it is transparent.",[81,82,84],"h2",{"id":83},"parameters","Parameters",[86,87,88,104],"table",{},[89,90,91],"thead",{},[92,93,94,98,101],"tr",{},[95,96,97],"th",{},"Name",[95,99,100],{},"Type",[95,102,103],{},"Notes",[105,106,107],"tbody",{},[92,108,109,115,120],{},[110,111,112],"td",{},[25,113,114],{},"opts",[110,116,117],{},[25,118,119],{},"{frames?: number; scale?: number}",[110,121,122,123,61],{},"Optional. Default ",[25,124,125],{},"{}",[81,127,129],{"id":128},"example","Example",[18,131,133],{"className":20,"code":132,"language":22,"meta":23,"style":23},"inputs: {last: previousFrame()},\npaint: wgsl`\n  let ink = 1.0 - smoothstep(0.0, 0.03, distance(uv, pointer));\n  return max(last(uv) * fade, vec4f(ink));\n`,\n",[25,134,135,154,169,175,181],{"__ignoreMap":23},[28,136,137,140,143,146,149,151],{"class":30,"line":31},[28,138,139],{"class":34},"inputs",[28,141,142],{"class":37},": {",[28,144,145],{"class":34},"last",[28,147,148],{"class":37},": ",[28,150,5],{"class":34},[28,152,153],{"class":37},"()},\n",[28,155,157,160,162,165],{"class":30,"line":156},2,[28,158,159],{"class":34},"paint",[28,161,148],{"class":37},[28,163,164],{"class":34},"wgsl",[28,166,168],{"class":167},"sU2Wk","`\n",[28,170,172],{"class":30,"line":171},3,[28,173,174],{"class":167},"  let ink = 1.0 - smoothstep(0.0, 0.03, distance(uv, pointer));\n",[28,176,178],{"class":30,"line":177},4,[28,179,180],{"class":167},"  return max(last(uv) * fade, vec4f(ink));\n",[28,182,184,187],{"class":30,"line":183},5,[28,185,186],{"class":167},"`",[28,188,189],{"class":37},",\n",[191,192,193],"blockquote",{},[14,194,195,199],{},[196,197,198],"strong",{},"Tip."," The whole body becomes one extra render pass, so a layer with a history costs a little more than one without.",[201,202,203],"style",{},"html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}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 .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}",{"title":23,"searchDepth":156,"depth":156,"links":205},[206,207],{"id":83,"depth":156,"text":84},{"id":128,"depth":156,"text":129},"inputs.history","inputs-history","Previous frame",false,null,"md","Inputs","function",{},true,"\u002Fdocs\u002Fprimitives\u002Finputs-history\u002Fpreviousframe",{"title":5,"description":16},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Finputs\u002Fhistory.ts#L39","docs\u002Fprimitives\u002F40.inputs-history\u002F1.previousframe","gzEGSrBR6BXudWgsF2f4h1QSwPO1QornyElqY_WVj6s",{"stars":224},6080,[226,230,234,238,242,246,250,254,258,262,266,270,274,278,282,286,290,295,299,303,307,311],{"path":227,"title":228,"description":229,"category":25},"\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":231,"title":232,"description":233,"category":25},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":235,"title":236,"description":237,"category":25},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":239,"title":240,"description":241,"category":25},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":243,"title":244,"description":245,"category":25},"\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":247,"title":248,"description":249,"category":25},"\u002Fdocs\u002Fguide\u002Fanimation","Animating a shader","Tween a shader's props with Motion, GSAP or anything else that animates a number.",{"path":251,"title":252,"description":253,"category":25},"\u002Fdocs\u002Fguide\u002Fdynamic-props","Dynamic props","Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":255,"title":256,"description":257,"category":25},"\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":259,"title":260,"description":261,"category":25},"\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":263,"title":264,"description":265,"category":25},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":267,"title":268,"description":269,"category":25},"\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":271,"title":272,"description":273,"category":25},"\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":275,"title":276,"description":277,"category":25},"\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":279,"title":280,"description":281,"category":25},"\u002Fdocs\u002Fguide\u002Fperformance","Performance","Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":283,"title":284,"description":285,"category":25},"\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":287,"title":288,"description":289,"category":25},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":291,"title":292,"description":293,"category":294},"\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":296,"title":297,"description":298,"category":294},"\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":300,"title":301,"description":302,"category":294},"\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":304,"title":305,"description":306,"category":25},"\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":308,"title":309,"description":310,"category":25},"\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":312,"title":313,"description":314,"category":25},"\u002Fdocs\u002Fguide\u002Fssr","Server rendering","Render Shaders in Next.js, Nuxt, SvelteKit, SolidStart and other SSR apps by keeping each shader on the client.",1796051186103,"06e02370-81a6-4d74-9931-661d71414be1"]