[{"data":1,"prerenderedAt":373,"buildId":374},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fprimitives\u002Finputs-events\u002Fevents":3,"github-stars":281,"guide-nav":283},{"id":4,"title":5,"body":6,"categoryId":265,"categorySlug":266,"categoryTitle":267,"curated":268,"description":269,"editUrl":270,"extension":271,"group":159,"groupTitle":272,"kind":273,"meta":274,"navigation":275,"path":276,"seo":277,"sourceUrl":278,"stem":279,"wordCount":270,"__hash__":280},"primitives\u002Fdocs\u002Fprimitives\u002F43.inputs-events\u002F1.events.md","events",{"type":7,"value":8,"toc":261},"minimark",[9,12,33,74,84,87,92,146,150,257],[10,11,5],"h1",{"id":5},[13,14,15,16,20,21,24,25,28,29,32],"p",{},"The last ",[17,18,19],"code",{},"max"," presses (up to 32) on the canvas within ",[17,22,23],{},"maxAge"," seconds, read by slot: ",[17,26,27],{},"clicks(i)"," is a ",[17,30,31],{},"vec4f"," of (x, y in uv, age in seconds, seed 0–1).",[34,35,40],"pre",{"className":36,"code":37,"language":38,"meta":39,"style":39},"language-ts shiki shiki-themes github-dark","events(source: 'click', opts: {max?: number; maxAge?: number} = {}): EventsInput\n","ts","",[17,41,42],{"__ignoreMap":39},[43,44,47,50,54,58,61,65,68,71],"span",{"class":45,"line":46},"line",1,[43,48,5],{"class":49},"svObZ",[43,51,53],{"class":52},"s95oV","(source: ",[43,55,57],{"class":56},"sU2Wk","'click'",[43,59,60],{"class":52},", opts: {max?: number; maxAge",[43,62,64],{"class":63},"snl16","?:",[43,66,67],{"class":52}," number} ",[43,69,70],{"class":63},"=",[43,72,73],{"class":52}," {}): EventsInput\n",[13,75,76,77,79,80,83],{},"Import ",[17,78,5],{}," from ",[17,81,82],{},"shaders\u002Fstd",".",[13,85,86],{},"Empty slots have age -1. Slot 0 is the newest.",[88,89,91],"h2",{"id":90},"parameters","Parameters",[93,94,95,111],"table",{},[96,97,98],"thead",{},[99,100,101,105,108],"tr",{},[102,103,104],"th",{},"Name",[102,106,107],{},"Type",[102,109,110],{},"Notes",[112,113,114,128],"tbody",{},[99,115,116,122,126],{},[117,118,119],"td",{},[17,120,121],{},"source",[117,123,124],{},[17,125,57],{},[117,127],{},[99,129,130,135,140],{},[117,131,132],{},[17,133,134],{},"opts",[117,136,137],{},[17,138,139],{},"{max?: number; maxAge?: number}",[117,141,142,143,83],{},"Optional. Default ",[17,144,145],{},"{}",[88,147,149],{"id":148},"example","Example",[34,151,153],{"className":36,"code":152,"language":38,"meta":39,"style":39},"inputs: {clicks: events('click', {max: 8})},\npaint: wgsl`\n  var c = 0.0;\n  for (var i = 0; i \u003C 8; i++) {\n    let e = clicks(i);\n    if (e.z \u003C 0.0) { continue; }\n    let ring = abs(distance(uv, e.xy) - e.z * 0.4);\n    c += (1.0 - smoothstep(0.0, 0.01, ring)) * exp(-e.z * 2.0);\n  }\n  return vec4f(vec3f(c), 1.0);\n`,\n",[17,154,155,186,200,206,212,218,224,230,236,242,248],{"__ignoreMap":39},[43,156,157,160,163,166,169,171,174,176,179,183],{"class":45,"line":46},[43,158,159],{"class":49},"inputs",[43,161,162],{"class":52},": {",[43,164,165],{"class":49},"clicks",[43,167,168],{"class":52},": ",[43,170,5],{"class":49},[43,172,173],{"class":52},"(",[43,175,57],{"class":56},[43,177,178],{"class":52},", {max: ",[43,180,182],{"class":181},"sDLfK","8",[43,184,185],{"class":52},"})},\n",[43,187,189,192,194,197],{"class":45,"line":188},2,[43,190,191],{"class":49},"paint",[43,193,168],{"class":52},[43,195,196],{"class":49},"wgsl",[43,198,199],{"class":56},"`\n",[43,201,203],{"class":45,"line":202},3,[43,204,205],{"class":56},"  var c = 0.0;\n",[43,207,209],{"class":45,"line":208},4,[43,210,211],{"class":56},"  for (var i = 0; i \u003C 8; i++) {\n",[43,213,215],{"class":45,"line":214},5,[43,216,217],{"class":56},"    let e = clicks(i);\n",[43,219,221],{"class":45,"line":220},6,[43,222,223],{"class":56},"    if (e.z \u003C 0.0) { continue; }\n",[43,225,227],{"class":45,"line":226},7,[43,228,229],{"class":56},"    let ring = abs(distance(uv, e.xy) - e.z * 0.4);\n",[43,231,233],{"class":45,"line":232},8,[43,234,235],{"class":56},"    c += (1.0 - smoothstep(0.0, 0.01, ring)) * exp(-e.z * 2.0);\n",[43,237,239],{"class":45,"line":238},9,[43,240,241],{"class":56},"  }\n",[43,243,245],{"class":45,"line":244},10,[43,246,247],{"class":56},"  return vec4f(vec3f(c), 1.0);\n",[43,249,251,254],{"class":45,"line":250},11,[43,252,253],{"class":56},"`",[43,255,256],{"class":52},",\n",[258,259,260],"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 .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}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}",{"title":39,"searchDepth":188,"depth":188,"links":262},[263,264],{"id":90,"depth":188,"text":91},{"id":148,"depth":188,"text":149},"inputs.events","inputs-events","Events",false,"The last `max` presses (up to 32) on the canvas within `maxAge` seconds, read by slot: `clicks(i)` is a `vec4f` of (x, y in uv, age in seconds, seed 0–1).",null,"md","Inputs","function",{},true,"\u002Fdocs\u002Fprimitives\u002Finputs-events\u002Fevents",{"title":5,"description":269},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Finputs\u002Fevents.ts#L55","docs\u002Fprimitives\u002F43.inputs-events\u002F1.events","YAZHbrIQqLLJnkkR9Ef_HIxVHTXVvYrBjAvlkKx_0K4",{"stars":282},6080,[284,288,292,296,300,304,308,312,316,320,324,328,332,336,340,344,348,353,357,361,365,369],{"path":285,"title":286,"description":287,"category":17},"\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":289,"title":290,"description":291,"category":17},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":293,"title":294,"description":295,"category":17},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":297,"title":298,"description":299,"category":17},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":301,"title":302,"description":303,"category":17},"\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":305,"title":306,"description":307,"category":17},"\u002Fdocs\u002Fguide\u002Fanimation","Animating a shader","Tween a shader's props with Motion, GSAP or anything else that animates a number.",{"path":309,"title":310,"description":311,"category":17},"\u002Fdocs\u002Fguide\u002Fdynamic-props","Dynamic props","Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":313,"title":314,"description":315,"category":17},"\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":317,"title":318,"description":319,"category":17},"\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":321,"title":322,"description":323,"category":17},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":325,"title":326,"description":327,"category":17},"\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":329,"title":330,"description":331,"category":17},"\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":333,"title":334,"description":335,"category":17},"\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":337,"title":338,"description":339,"category":17},"\u002Fdocs\u002Fguide\u002Fperformance","Performance","Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":341,"title":342,"description":343,"category":17},"\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":345,"title":346,"description":347,"category":17},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":349,"title":350,"description":351,"category":352},"\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":354,"title":355,"description":356,"category":352},"\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":358,"title":359,"description":360,"category":352},"\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":362,"title":363,"description":364,"category":17},"\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":366,"title":367,"description":368,"category":17},"\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":370,"title":371,"description":372,"category":17},"\u002Fdocs\u002Fguide\u002Fssr","Server rendering","Render Shaders in Next.js, Nuxt, SvelteKit, SolidStart and other SSR apps by keeping each shader on the client.",1796051186145,"06e02370-81a6-4d74-9931-661d71414be1"]