[{"data":1,"prerenderedAt":364,"buildId":365},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fprimitives\u002Fmaterials\u002Fthinfilmcolor":3,"github-stars":272,"guide-nav":274},{"id":4,"title":5,"body":6,"categoryId":51,"categorySlug":51,"categoryTitle":258,"curated":259,"description":16,"editUrl":260,"extension":261,"group":262,"groupTitle":263,"kind":264,"meta":265,"navigation":266,"path":267,"seo":268,"sourceUrl":269,"stem":270,"wordCount":260,"__hash__":271},"primitives\u002Fdocs\u002Fprimitives\u002F14.materials\u002F62.thinfilmcolor.md","thinFilmColor",{"type":7,"value":8,"toc":251},"minimark",[9,13,17,46,61,75,80,146,150,202,206,237,241,247],[10,11,5],"h1",{"id":12},"thinfilmcolor",[14,15,16],"p",{},"The colour a thin transparent film (a coating, a soap skin, oil on water) reflects.",[18,19,24],"pre",{"className":20,"code":21,"language":22,"meta":23,"style":23},"language-ts shiki shiki-themes github-dark","thinFilmColor(cosView: Expr, thickness: Expr, opts: {ior?: number} = {}): Expr\n","ts","",[25,26,27],"code",{"__ignoreMap":23},[28,29,32,35,39,43],"span",{"class":30,"line":31},"line",1,[28,33,5],{"class":34},"svObZ",[28,36,38],{"class":37},"s95oV","(cosView: Expr, thickness: Expr, opts: {ior?: number} ",[28,40,42],{"class":41},"snl16","=",[28,44,45],{"class":37}," {}): Expr\n",[14,47,48,49,52,53,56,57,60],{},"Import ",[25,50,51],{},"materials"," from ",[25,54,55],{},"shaders\u002Fstd"," and use ",[25,58,59],{},"materials.thinFilmColor",".",[14,62,63,66,67,70,71,74],{},[25,64,65],{},"cosView"," is how face-on the surface is (1 face-on), ",[25,68,69],{},"thickness"," the film's thickness in nanometres (250–600 gives the vivid orders). Returns rgb around 0.5 on average: multiply a reflection by ",[25,72,73],{},"mix(1, 2·film, amount)"," to coat it.",[76,77,79],"h2",{"id":78},"parameters","Parameters",[81,82,83,99],"table",{},[84,85,86],"thead",{},[87,88,89,93,96],"tr",{},[90,91,92],"th",{},"Name",[90,94,95],{},"Type",[90,97,98],{},"Notes",[100,101,102,116,128],"tbody",{},[87,103,104,109,114],{},[105,106,107],"td",{},[25,108,65],{},[105,110,111],{},[25,112,113],{},"Expr",[105,115],{},[87,117,118,122,126],{},[105,119,120],{},[25,121,69],{},[105,123,124],{},[25,125,113],{},[105,127],{},[87,129,130,135,140],{},[105,131,132],{},[25,133,134],{},"opts",[105,136,137],{},[25,138,139],{},"{ior?: number}",[105,141,142,143,60],{},"Optional. Default ",[25,144,145],{},"{}",[76,147,149],{"id":148},"example","Example",[18,151,153],{"className":20,"code":152,"language":22,"meta":23,"style":23},"const film = thinFilmColor(cosV, add(380, mul(sin(t), 120)))\n",[25,154,155],{"__ignoreMap":23},[28,156,157,160,164,167,170,173,176,179,182,185,188,190,193,196,199],{"class":30,"line":31},[28,158,159],{"class":41},"const",[28,161,163],{"class":162},"sDLfK"," film",[28,165,166],{"class":41}," =",[28,168,169],{"class":34}," thinFilmColor",[28,171,172],{"class":37},"(cosV, ",[28,174,175],{"class":34},"add",[28,177,178],{"class":37},"(",[28,180,181],{"class":162},"380",[28,183,184],{"class":37},", ",[28,186,187],{"class":34},"mul",[28,189,178],{"class":37},[28,191,192],{"class":34},"sin",[28,194,195],{"class":37},"(t), ",[28,197,198],{"class":162},"120",[28,200,201],{"class":37},")))\n",[76,203,205],{"id":204},"see-also","See also",[207,208,209,220],"ul",{},[210,211,212,219],"li",{},[213,214,216],"a",{"href":215},"\u002Fdocs\u002Fprimitives\u002Fmaterials\u002Fcosinerainbow",[25,217,218],{},"cosineRainbow"," — A smooth rainbow color from a value that wraps every 1.",[210,221,222,228,229,232,233,236],{},[213,223,225],{"href":224},"\u002Fdocs\u002Fprimitives\u002Fmaterials\u002Fschlickfresnel",[25,226,227],{},"schlickFresnel"," — How mirror-like a surface is at this pixel: ",[25,230,231],{},"r0"," face-on, rising to ",[25,234,235],{},"r0 + gain"," at the rim.",[76,238,240],{"id":239},"used-by","Used by",[14,242,243],{},[213,244,246],{"href":245},"\u002Fdocs\u002Fcomponents\u002Fprismaticglass","PrismaticGlass",[248,249,250],"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 .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}",{"title":23,"searchDepth":252,"depth":252,"links":253},2,[254,255,256,257],{"id":78,"depth":252,"text":79},{"id":148,"depth":252,"text":149},{"id":204,"depth":252,"text":205},{"id":239,"depth":252,"text":240},"Materials & surfaces",false,null,"md","light","Noise, light & materials","function",{},true,"\u002Fdocs\u002Fprimitives\u002Fmaterials\u002Fthinfilmcolor",{"title":5,"description":16},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Fpaint\u002Fmaterials.ts#L1598","docs\u002Fprimitives\u002F14.materials\u002F62.thinfilmcolor","ITJ8FrwrSIp8DsNTAtfoANP_3uwzxMywg2l1A37JTbE",{"stars":273},6080,[275,279,283,287,291,295,299,303,307,311,315,319,323,327,331,335,339,344,348,352,356,360],{"path":276,"title":277,"description":278,"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":280,"title":281,"description":282,"category":25},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":284,"title":285,"description":286,"category":25},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":288,"title":289,"description":290,"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":292,"title":293,"description":294,"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":296,"title":297,"description":298,"category":25},"\u002Fdocs\u002Fguide\u002Fanimation","Animating a shader","Tween a shader's props with Motion, GSAP or anything else that animates a number.",{"path":300,"title":301,"description":302,"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":304,"title":305,"description":306,"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":308,"title":309,"description":310,"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":312,"title":313,"description":314,"category":25},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":316,"title":317,"description":318,"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":320,"title":321,"description":322,"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":324,"title":325,"description":326,"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":328,"title":329,"description":330,"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":332,"title":333,"description":334,"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":336,"title":337,"description":338,"category":25},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":340,"title":341,"description":342,"category":343},"\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":345,"title":346,"description":347,"category":343},"\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":349,"title":350,"description":351,"category":343},"\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":353,"title":354,"description":355,"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":357,"title":358,"description":359,"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":361,"title":362,"description":363,"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.",1796051178793,"06e02370-81a6-4d74-9931-661d71414be1"]