[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"github-stars":3,"guide-nav":5,"doc-\u002Fdocs\u002Fprimitives\u002Fmedia":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":704,"curated":316,"description":705,"editUrl":706,"extension":707,"group":708,"groupTitle":709,"kind":704,"meta":710,"navigation":316,"path":711,"seo":712,"sourceUrl":713,"stem":714,"wordCount":320,"__hash__":715},"primitives\u002Fdocs\u002Fprimitives\u002F11.media\u002Findex.md","Media",{"type":133,"value":134,"toc":698},"minimark",[135,139,159,197,226,231,291,295,633,637,661,665,694],[136,137,131],"h1",{"id":138},"media",[140,141,142,143,146,147,150,151,154,155,158],"p",{},"Pixels that come from an image, a video or the user's camera instead of from math. Each word\nloads its source, fits it into the layer the way CSS ",[10,144,145],{},"object-fit"," fits an image into a box,\nand returns the GPU half of a definition. Spread it into ",[10,148,149],{},"defineShader({...})"," next to your\nprops, with ",[10,152,153],{},"role: 'media'"," and ",[10,156,157],{},"species: 'custom'",".",[140,160,161,162,165,166,169,170,169,173,176,177,180,181,184,185,188,189,192,193,196],{},"Every media word takes a ",[10,163,164],{},"fit"," prop (",[10,167,168],{},"'cover'",", ",[10,171,172],{},"'contain'",[10,174,175],{},"'fill'"," or ",[10,178,179],{},"'scale-down'",",\nmarked ",[10,182,183],{},"compileTime",") and ",[10,186,187],{},"decode: 'srgb-linear-alpha-cut'",", which reads the source as sRGB\nand makes the letterbox around a contained image transparent. Set ",[10,190,191],{},"naturalSizeKey"," on the\ndefinition so layout can measure the media. Each word takes an ",[10,194,195],{},"onError"," callback so you can\nphrase failures in your own words.",[198,199,204],"pre",{"className":200,"code":201,"language":202,"meta":203,"style":203},"language-ts shiki shiki-themes github-dark","import {media} from 'shaders\u002Fstd'\n","ts","",[10,205,206],{"__ignoreMap":203},[207,208,211,215,219,222],"span",{"class":209,"line":210},"line",1,[207,212,214],{"class":213},"snl16","import",[207,216,218],{"class":217},"s95oV"," {media} ",[207,220,221],{"class":213},"from",[207,223,225],{"class":224},"sU2Wk"," 'shaders\u002Fstd'\n",[227,228,230],"h2",{"id":229},"reach-for-it-when","Reach for it when",[232,233,234,247],"table",{},[235,236,237],"thead",{},[238,239,240,244],"tr",{},[241,242,243],"th",{},"When you need",[241,245,246],{},"Use",[248,249,250,265,278],"tbody",{},[238,251,252,256],{},[253,254,255],"td",{},"a photo or logo from a URL",[253,257,258],{},[259,260,262],"a",{"href":261},"\u002Fdocs\u002Fprimitives\u002Fmedia\u002Fimagemedia",[10,263,264],{},"imageMedia",[238,266,267,270],{},[253,268,269],{},"a looping video from a URL",[253,271,272],{},[259,273,275],{"href":274},"\u002Fdocs\u002Fprimitives\u002Fmedia\u002Fvideomedia",[10,276,277],{},"videoMedia",[238,279,280,283],{},[253,281,282],{},"the user's camera, with a selfie mirror",[253,284,285],{},[259,286,288],{"href":287},"\u002Fdocs\u002Fprimitives\u002Fmedia\u002Fwebcammedia",[10,289,290],{},"webcamMedia",[227,292,294],{"id":293},"example","Example",[198,296,298],{"className":200,"code":297,"language":202,"meta":203,"style":203},"import {defineShader, p, media} from 'shaders\u002Fstd'\n\n\u002F\u002F An image from a URL, fitted like CSS object-fit. The fit prop is a plain string.\nexport const Photo = defineShader({\n  name: 'Photo',\n  role: 'media',\n  species: 'custom',\n  naturalSizeKey: {fromProp: 'url'},\n  props: {\n    url: {default: 'https:\u002F\u002Fshaders.com\u002Fsample.jpg', ui: {type: 'image-upload', label: 'Image'}},\n    objectFit: {\n      default: 'cover',\n      compileTime: true,\n      ui: {type: 'select', options: [{label: 'Cover', value: 'cover'}, {label: 'Contain', value: 'contain'}, {label: 'Fill', value: 'fill'}, {label: 'Scale down', value: 'scale-down'}]},\n    },\n  },\n  ...media.imageMedia({\n    src: p('url'),\n    fit: p('objectFit'),\n    decode: 'srgb-linear-alpha-cut',\n    label: 'Photo',\n    onError: (error, url) => console.error(`Photo: could not load ${url}`, error),\n  }),\n})\n",[10,299,300,311,318,325,348,360,371,382,394,400,424,430,440,451,502,508,514,527,543,558,569,579,621,627],{"__ignoreMap":203},[207,301,302,304,307,309],{"class":209,"line":210},[207,303,214],{"class":213},[207,305,306],{"class":217}," {defineShader, p, media} ",[207,308,221],{"class":213},[207,310,225],{"class":224},[207,312,314],{"class":209,"line":313},2,[207,315,317],{"emptyLinePlaceholder":316},true,"\n",[207,319,321],{"class":209,"line":320},3,[207,322,324],{"class":323},"sAwPA","\u002F\u002F An image from a URL, fitted like CSS object-fit. The fit prop is a plain string.\n",[207,326,328,331,334,338,341,345],{"class":209,"line":327},4,[207,329,330],{"class":213},"export",[207,332,333],{"class":213}," const",[207,335,337],{"class":336},"sDLfK"," Photo",[207,339,340],{"class":213}," =",[207,342,344],{"class":343},"svObZ"," defineShader",[207,346,347],{"class":217},"({\n",[207,349,351,354,357],{"class":209,"line":350},5,[207,352,353],{"class":217},"  name: ",[207,355,356],{"class":224},"'Photo'",[207,358,359],{"class":217},",\n",[207,361,363,366,369],{"class":209,"line":362},6,[207,364,365],{"class":217},"  role: ",[207,367,368],{"class":224},"'media'",[207,370,359],{"class":217},[207,372,374,377,380],{"class":209,"line":373},7,[207,375,376],{"class":217},"  species: ",[207,378,379],{"class":224},"'custom'",[207,381,359],{"class":217},[207,383,385,388,391],{"class":209,"line":384},8,[207,386,387],{"class":217},"  naturalSizeKey: {fromProp: ",[207,389,390],{"class":224},"'url'",[207,392,393],{"class":217},"},\n",[207,395,397],{"class":209,"line":396},9,[207,398,399],{"class":217},"  props: {\n",[207,401,403,406,409,412,415,418,421],{"class":209,"line":402},10,[207,404,405],{"class":217},"    url: {default: ",[207,407,408],{"class":224},"'https:\u002F\u002Fshaders.com\u002Fsample.jpg'",[207,410,411],{"class":217},", ui: {type: ",[207,413,414],{"class":224},"'image-upload'",[207,416,417],{"class":217},", label: ",[207,419,420],{"class":224},"'Image'",[207,422,423],{"class":217},"}},\n",[207,425,427],{"class":209,"line":426},11,[207,428,429],{"class":217},"    objectFit: {\n",[207,431,433,436,438],{"class":209,"line":432},12,[207,434,435],{"class":217},"      default: ",[207,437,168],{"class":224},[207,439,359],{"class":217},[207,441,443,446,449],{"class":209,"line":442},13,[207,444,445],{"class":217},"      compileTime: ",[207,447,448],{"class":336},"true",[207,450,359],{"class":217},[207,452,454,457,460,463,466,469,471,474,477,479,481,483,486,488,490,492,495,497,499],{"class":209,"line":453},14,[207,455,456],{"class":217},"      ui: {type: ",[207,458,459],{"class":224},"'select'",[207,461,462],{"class":217},", options: [{label: ",[207,464,465],{"class":224},"'Cover'",[207,467,468],{"class":217},", value: ",[207,470,168],{"class":224},[207,472,473],{"class":217},"}, {label: ",[207,475,476],{"class":224},"'Contain'",[207,478,468],{"class":217},[207,480,172],{"class":224},[207,482,473],{"class":217},[207,484,485],{"class":224},"'Fill'",[207,487,468],{"class":217},[207,489,175],{"class":224},[207,491,473],{"class":217},[207,493,494],{"class":224},"'Scale down'",[207,496,468],{"class":217},[207,498,179],{"class":224},[207,500,501],{"class":217},"}]},\n",[207,503,505],{"class":209,"line":504},15,[207,506,507],{"class":217},"    },\n",[207,509,511],{"class":209,"line":510},16,[207,512,513],{"class":217},"  },\n",[207,515,517,520,523,525],{"class":209,"line":516},17,[207,518,519],{"class":213},"  ...",[207,521,522],{"class":217},"media.",[207,524,264],{"class":343},[207,526,347],{"class":217},[207,528,530,533,535,538,540],{"class":209,"line":529},18,[207,531,532],{"class":217},"    src: ",[207,534,140],{"class":343},[207,536,537],{"class":217},"(",[207,539,390],{"class":224},[207,541,542],{"class":217},"),\n",[207,544,546,549,551,553,556],{"class":209,"line":545},19,[207,547,548],{"class":217},"    fit: ",[207,550,140],{"class":343},[207,552,537],{"class":217},[207,554,555],{"class":224},"'objectFit'",[207,557,542],{"class":217},[207,559,561,564,567],{"class":209,"line":560},20,[207,562,563],{"class":217},"    decode: ",[207,565,566],{"class":224},"'srgb-linear-alpha-cut'",[207,568,359],{"class":217},[207,570,572,575,577],{"class":209,"line":571},21,[207,573,574],{"class":217},"    label: ",[207,576,356],{"class":224},[207,578,359],{"class":217},[207,580,582,585,588,592,594,597,600,603,606,608,610,613,615,618],{"class":209,"line":581},22,[207,583,584],{"class":343},"    onError",[207,586,587],{"class":217},": (",[207,589,591],{"class":590},"s9osk","error",[207,593,169],{"class":217},[207,595,596],{"class":590},"url",[207,598,599],{"class":217},") ",[207,601,602],{"class":213},"=>",[207,604,605],{"class":217}," console.",[207,607,591],{"class":343},[207,609,537],{"class":217},[207,611,612],{"class":224},"`Photo: could not load ${",[207,614,596],{"class":217},[207,616,617],{"class":224},"}`",[207,619,620],{"class":217},", error),\n",[207,622,624],{"class":209,"line":623},23,[207,625,626],{"class":217},"  }),\n",[207,628,630],{"class":209,"line":629},24,[207,631,632],{"class":217},"})\n",[227,634,636],{"id":635},"types","Types",[232,638,639,649],{},[235,640,641],{},[238,642,643,646],{},[241,644,645],{},"Type",[241,647,648],{},"What it is",[248,650,651],{},[238,652,653,658],{},[253,654,655],{},[10,656,657],{},"MediaSurfaceHalf",[253,659,660],{},"What a media word returns: the GPU half of a definition.",[227,662,664],{"id":663},"words","Words",[666,667,669],"primitive-words",{":words":668},"[{\"name\":\"imageMedia\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fmedia\u002Fimagemedia\",\"summary\":\"An image from a URL prop, fitted into the layer.\"},{\"name\":\"videoMedia\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fmedia\u002Fvideomedia\",\"summary\":\"A video from a URL prop, playing in the layer.\"},{\"name\":\"webcamMedia\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fmedia\u002Fwebcammedia\",\"summary\":\"The user's camera, live in the layer.\"}]",[670,671,672,680,687],"ul",{},[673,674,675,679],"li",{},[259,676,677],{"href":261},[10,678,264],{}," — An image from a URL prop, fitted into the layer.",[673,681,682,686],{},[259,683,684],{"href":274},[10,685,277],{}," — A video from a URL prop, playing in the layer.",[673,688,689,693],{},[259,690,691],{"href":287},[10,692,290],{}," — The user's camera, live in the layer.",[695,696,697],"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}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}",{"title":203,"searchDepth":313,"depth":313,"links":699},[700,701,702,703],{"id":229,"depth":313,"text":230},{"id":293,"depth":313,"text":294},{"id":635,"depth":313,"text":636},{"id":663,"depth":313,"text":664},null,"Pixels that come from an image, a video or the user's camera instead of from math.","https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fedit\u002Fmain\u002Fpackages\u002Fcore\u002Fdocs\u002Fstd\u002Fmedia.md","md","paint","Painting",{},"\u002Fdocs\u002Fprimitives\u002Fmedia",{"title":131,"description":705},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Fpaint\u002Fmedia.ts","docs\u002Fprimitives\u002F11.media\u002Findex","2WxjtKvWSbps9W2ThZoxQAdwPkFsCtWvYDRGD5GtA9U"]