[{"data":1,"prerenderedAt":1337,"buildId":1338},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fguide\u002Fanimation":3,"github-stars":1254,"guide-nav":1256},{"id":4,"title":5,"body":6,"category":40,"description":16,"extension":1246,"icon":1247,"meta":1248,"navigation":97,"path":1250,"seo":1251,"stem":1252,"__hash__":1253},"guide\u002Fdocs\u002Fguide\u002F05.animation.md","Animating a shader",{"type":7,"value":8,"toc":1239},"minimark",[9,13,17,20,25,28,1029,1040,1044,1050,1148,1159,1163,1170,1174,1182,1203,1211,1215,1235],[10,11,5],"h1",{"id":12},"animating-a-shader",[14,15,16],"p",{},"Tween a shader's props with Motion, GSAP or anything else that animates a number.",[14,18,19],{},"A prop is a value the GPU reads every frame, so animating one is just changing it over time. Tween it the way you'd tween anything else and pass the result to the component.",[21,22,24],"h2",{"id":23},"tweening-a-prop-with-motion","Tweening a prop with Motion",[14,26,27],{},"This fades an Aurora's sheen in when the component mounts:",[29,30,32,335,545,700,892],"code-group",{":tabs":31},"[\"Vue\", \"React\", \"Svelte\", \"Solid\", \"JS\"]",[33,34,39],"pre",{"className":35,"code":36,"language":37,"meta":38,"style":38},"language-vue-html shiki shiki-themes github-dark","\u003Cscript setup>\nimport { ref, onMounted, onUnmounted } from 'vue'\nimport { animate } from 'motion'\n\nconst intensity = ref(0)\nlet controls\nonMounted(() => {\n  controls = animate(0, 0.5, { duration: 1.2, ease: [0.16, 1, 0.3, 1], onUpdate: v => { intensity.value = v } })\n})\nonUnmounted(() => controls?.stop())\n\u003C\u002Fscript>\n\n\u003Ctemplate>\n  \u003CShader class=\"w-full h-96\">\n    \u003CAurora :intensity=\"intensity\" \u002F>\n  \u003C\u002FShader>\n\u003C\u002Ftemplate>\n","vue-html","",[40,41,42,62,79,92,99,124,133,148,220,226,245,255,260,270,289,316,326],"code",{"__ignoreMap":38},[43,44,47,51,55,59],"span",{"class":45,"line":46},"line",1,[43,48,50],{"class":49},"s95oV","\u003C",[43,52,54],{"class":53},"s4JwU","script",[43,56,58],{"class":57},"svObZ"," setup",[43,60,61],{"class":49},">\n",[43,63,65,69,72,75],{"class":45,"line":64},2,[43,66,68],{"class":67},"snl16","import",[43,70,71],{"class":49}," { ref, onMounted, onUnmounted } ",[43,73,74],{"class":67},"from",[43,76,78],{"class":77},"sU2Wk"," 'vue'\n",[43,80,82,84,87,89],{"class":45,"line":81},3,[43,83,68],{"class":67},[43,85,86],{"class":49}," { animate } ",[43,88,74],{"class":67},[43,90,91],{"class":77}," 'motion'\n",[43,93,95],{"class":45,"line":94},4,[43,96,98],{"emptyLinePlaceholder":97},true,"\n",[43,100,102,105,109,112,115,118,121],{"class":45,"line":101},5,[43,103,104],{"class":67},"const",[43,106,108],{"class":107},"sDLfK"," intensity",[43,110,111],{"class":67}," =",[43,113,114],{"class":57}," ref",[43,116,117],{"class":49},"(",[43,119,120],{"class":107},"0",[43,122,123],{"class":49},")\n",[43,125,127,130],{"class":45,"line":126},6,[43,128,129],{"class":67},"let",[43,131,132],{"class":49}," controls\n",[43,134,136,139,142,145],{"class":45,"line":135},7,[43,137,138],{"class":57},"onMounted",[43,140,141],{"class":49},"(() ",[43,143,144],{"class":67},"=>",[43,146,147],{"class":49}," {\n",[43,149,151,154,157,160,162,164,167,170,173,176,179,182,184,187,189,192,194,196,199,202,205,209,212,215,217],{"class":45,"line":150},8,[43,152,153],{"class":49},"  controls ",[43,155,156],{"class":67},"=",[43,158,159],{"class":57}," animate",[43,161,117],{"class":49},[43,163,120],{"class":107},[43,165,166],{"class":49},", ",[43,168,169],{"class":107},"0.5",[43,171,172],{"class":49},", { duration: ",[43,174,175],{"class":107},"1.2",[43,177,178],{"class":49},", ease: [",[43,180,181],{"class":107},"0.16",[43,183,166],{"class":49},[43,185,186],{"class":107},"1",[43,188,166],{"class":49},[43,190,191],{"class":107},"0.3",[43,193,166],{"class":49},[43,195,186],{"class":107},[43,197,198],{"class":49},"], ",[43,200,201],{"class":57},"onUpdate",[43,203,204],{"class":49},": ",[43,206,208],{"class":207},"s9osk","v",[43,210,211],{"class":67}," =>",[43,213,214],{"class":49}," { intensity.value ",[43,216,156],{"class":67},[43,218,219],{"class":49}," v } })\n",[43,221,223],{"class":45,"line":222},9,[43,224,225],{"class":49},"})\n",[43,227,229,232,234,236,239,242],{"class":45,"line":228},10,[43,230,231],{"class":57},"onUnmounted",[43,233,141],{"class":49},[43,235,144],{"class":67},[43,237,238],{"class":49}," controls?.",[43,240,241],{"class":57},"stop",[43,243,244],{"class":49},"())\n",[43,246,248,251,253],{"class":45,"line":247},11,[43,249,250],{"class":49},"\u003C\u002F",[43,252,54],{"class":53},[43,254,61],{"class":49},[43,256,258],{"class":45,"line":257},12,[43,259,98],{"emptyLinePlaceholder":97},[43,261,263,265,268],{"class":45,"line":262},13,[43,264,50],{"class":49},[43,266,267],{"class":53},"template",[43,269,61],{"class":49},[43,271,273,276,279,282,284,287],{"class":45,"line":272},14,[43,274,275],{"class":49},"  \u003C",[43,277,278],{"class":53},"Shader",[43,280,281],{"class":57}," class",[43,283,156],{"class":49},[43,285,286],{"class":77},"\"w-full h-96\"",[43,288,61],{"class":49},[43,290,292,295,298,301,304,306,309,311,313],{"class":45,"line":291},15,[43,293,294],{"class":49},"    \u003C",[43,296,297],{"class":53},"Aurora",[43,299,300],{"class":49}," :",[43,302,303],{"class":57},"intensity",[43,305,156],{"class":49},[43,307,308],{"class":77},"\"",[43,310,303],{"class":49},[43,312,308],{"class":77},[43,314,315],{"class":49}," \u002F>\n",[43,317,319,322,324],{"class":45,"line":318},16,[43,320,321],{"class":49},"  \u003C\u002F",[43,323,278],{"class":53},[43,325,61],{"class":49},[43,327,329,331,333],{"class":45,"line":328},17,[43,330,250],{"class":49},[43,332,267],{"class":53},[43,334,61],{"class":49},[33,336,340],{"className":337,"code":338,"language":339,"meta":38,"style":38},"language-jsx shiki shiki-themes github-dark","import { useEffect, useState } from 'react'\nimport { animate } from 'motion'\n\nfunction Hero() {\n  const [intensity, setIntensity] = useState(0)\n  useEffect(() => {\n    const controls = animate(0, 0.5, { duration: 1.2, ease: [0.16, 1, 0.3, 1], onUpdate: setIntensity })\n    return () => controls.stop()\n  }, [])\n\n  return (\n    \u003CShader className=\"w-full h-96\">\n      \u003CAurora intensity={intensity} \u002F>\n    \u003C\u002FShader>\n  )\n}\n","jsx",[40,341,342,354,364,368,379,408,419,462,480,485,489,497,512,526,535,540],{"__ignoreMap":38},[43,343,344,346,349,351],{"class":45,"line":46},[43,345,68],{"class":67},[43,347,348],{"class":49}," { useEffect, useState } ",[43,350,74],{"class":67},[43,352,353],{"class":77}," 'react'\n",[43,355,356,358,360,362],{"class":45,"line":64},[43,357,68],{"class":67},[43,359,86],{"class":49},[43,361,74],{"class":67},[43,363,91],{"class":77},[43,365,366],{"class":45,"line":81},[43,367,98],{"emptyLinePlaceholder":97},[43,369,370,373,376],{"class":45,"line":94},[43,371,372],{"class":67},"function",[43,374,375],{"class":57}," Hero",[43,377,378],{"class":49},"() {\n",[43,380,381,384,387,389,391,394,397,399,402,404,406],{"class":45,"line":101},[43,382,383],{"class":67},"  const",[43,385,386],{"class":49}," [",[43,388,303],{"class":107},[43,390,166],{"class":49},[43,392,393],{"class":107},"setIntensity",[43,395,396],{"class":49},"] ",[43,398,156],{"class":67},[43,400,401],{"class":57}," useState",[43,403,117],{"class":49},[43,405,120],{"class":107},[43,407,123],{"class":49},[43,409,410,413,415,417],{"class":45,"line":126},[43,411,412],{"class":57},"  useEffect",[43,414,141],{"class":49},[43,416,144],{"class":67},[43,418,147],{"class":49},[43,420,421,424,427,429,431,433,435,437,439,441,443,445,447,449,451,453,455,457,459],{"class":45,"line":135},[43,422,423],{"class":67},"    const",[43,425,426],{"class":107}," controls",[43,428,111],{"class":67},[43,430,159],{"class":57},[43,432,117],{"class":49},[43,434,120],{"class":107},[43,436,166],{"class":49},[43,438,169],{"class":107},[43,440,172],{"class":49},[43,442,175],{"class":107},[43,444,178],{"class":49},[43,446,181],{"class":107},[43,448,166],{"class":49},[43,450,186],{"class":107},[43,452,166],{"class":49},[43,454,191],{"class":107},[43,456,166],{"class":49},[43,458,186],{"class":107},[43,460,461],{"class":49},"], onUpdate: setIntensity })\n",[43,463,464,467,470,472,475,477],{"class":45,"line":150},[43,465,466],{"class":67},"    return",[43,468,469],{"class":49}," () ",[43,471,144],{"class":67},[43,473,474],{"class":49}," controls.",[43,476,241],{"class":57},[43,478,479],{"class":49},"()\n",[43,481,482],{"class":45,"line":222},[43,483,484],{"class":49},"  }, [])\n",[43,486,487],{"class":45,"line":228},[43,488,98],{"emptyLinePlaceholder":97},[43,490,491,494],{"class":45,"line":247},[43,492,493],{"class":67},"  return",[43,495,496],{"class":49}," (\n",[43,498,499,501,503,506,508,510],{"class":45,"line":257},[43,500,294],{"class":49},[43,502,278],{"class":107},[43,504,505],{"class":57}," className",[43,507,156],{"class":67},[43,509,286],{"class":77},[43,511,61],{"class":49},[43,513,514,517,519,521,523],{"class":45,"line":262},[43,515,516],{"class":49},"      \u003C",[43,518,297],{"class":107},[43,520,108],{"class":57},[43,522,156],{"class":67},[43,524,525],{"class":49},"{intensity} \u002F>\n",[43,527,528,531,533],{"class":45,"line":272},[43,529,530],{"class":49},"    \u003C\u002F",[43,532,278],{"class":107},[43,534,61],{"class":49},[43,536,537],{"class":45,"line":291},[43,538,539],{"class":49},"  )\n",[43,541,542],{"class":45,"line":318},[43,543,544],{"class":49},"}\n",[33,546,550],{"className":547,"code":548,"language":549,"meta":38,"style":38},"language-tsx shiki shiki-themes github-dark","\u003Cscript>\n  import { onMount } from 'svelte'\n  import { animate } from 'motion'\n\n  let intensity = $state(0)\n  onMount(() => {\n    const controls = animate(0, 0.5, { duration: 1.2, ease: [0.16, 1, 0.3, 1], onUpdate: v => { intensity = v } })\n    return () => controls.stop()\n  })\n\u003C\u002Fscript>\n\n\u003CShader class=\"w-full h-96\">\n  \u003CAurora {intensity} \u002F>\n\u003C\u002FShader>\n","tsx",[40,551,552,560,565,570,574,579,584,638,652,657,665,669,683,692],{"__ignoreMap":38},[43,553,554,556,558],{"class":45,"line":46},[43,555,50],{"class":49},[43,557,54],{"class":53},[43,559,61],{"class":49},[43,561,562],{"class":45,"line":64},[43,563,564],{"class":49},"  import { onMount } from 'svelte'\n",[43,566,567],{"class":45,"line":81},[43,568,569],{"class":49},"  import { animate } from 'motion'\n",[43,571,572],{"class":45,"line":94},[43,573,98],{"emptyLinePlaceholder":97},[43,575,576],{"class":45,"line":101},[43,577,578],{"class":49},"  let intensity = $state(0)\n",[43,580,581],{"class":45,"line":126},[43,582,583],{"class":49},"  onMount(() => {\n",[43,585,586,589,591,593,595,597,599,601,603,605,607,609,611,613,615,617,619,621,623,625,627,629,631,634,636],{"class":45,"line":135},[43,587,588],{"class":49},"    const controls ",[43,590,156],{"class":67},[43,592,159],{"class":57},[43,594,117],{"class":49},[43,596,120],{"class":107},[43,598,166],{"class":49},[43,600,169],{"class":107},[43,602,172],{"class":49},[43,604,175],{"class":107},[43,606,178],{"class":49},[43,608,181],{"class":107},[43,610,166],{"class":49},[43,612,186],{"class":107},[43,614,166],{"class":49},[43,616,191],{"class":107},[43,618,166],{"class":49},[43,620,186],{"class":107},[43,622,198],{"class":49},[43,624,201],{"class":57},[43,626,204],{"class":49},[43,628,208],{"class":207},[43,630,211],{"class":67},[43,632,633],{"class":49}," { intensity ",[43,635,156],{"class":67},[43,637,219],{"class":49},[43,639,640,642,644,646,648,650],{"class":45,"line":150},[43,641,466],{"class":57},[43,643,469],{"class":49},[43,645,144],{"class":67},[43,647,474],{"class":49},[43,649,241],{"class":57},[43,651,479],{"class":49},[43,653,654],{"class":45,"line":222},[43,655,656],{"class":49},"  })\n",[43,658,659,661,663],{"class":45,"line":228},[43,660,250],{"class":49},[43,662,54],{"class":53},[43,664,61],{"class":49},[43,666,667],{"class":45,"line":247},[43,668,98],{"emptyLinePlaceholder":97},[43,670,671,673,675,677,679,681],{"class":45,"line":257},[43,672,50],{"class":49},[43,674,278],{"class":107},[43,676,281],{"class":57},[43,678,156],{"class":67},[43,680,286],{"class":77},[43,682,61],{"class":49},[43,684,685,687,689],{"class":45,"line":262},[43,686,275],{"class":49},[43,688,297],{"class":107},[43,690,691],{"class":49}," {intensity} \u002F>\n",[43,693,694,696,698],{"class":45,"line":272},[43,695,250],{"class":49},[43,697,278],{"class":107},[43,699,61],{"class":49},[33,701,703],{"className":337,"code":702,"language":339,"meta":38,"style":38},"import { createSignal, onMount, onCleanup } from 'solid-js'\nimport { animate } from 'motion'\n\nfunction Hero() {\n  const [intensity, setIntensity] = createSignal(0)\n  onMount(() => {\n    const controls = animate(0, 0.5, { duration: 1.2, ease: [0.16, 1, 0.3, 1], onUpdate: setIntensity })\n    onCleanup(() => controls.stop())\n  })\n\n  return (\n    \u003CShader class=\"w-full h-96\">\n      \u003CAurora intensity={intensity()} \u002F>\n    \u003C\u002FShader>\n  )\n}\n",[40,704,705,717,727,731,739,764,775,815,830,834,838,844,858,876,884,888],{"__ignoreMap":38},[43,706,707,709,712,714],{"class":45,"line":46},[43,708,68],{"class":67},[43,710,711],{"class":49}," { createSignal, onMount, onCleanup } ",[43,713,74],{"class":67},[43,715,716],{"class":77}," 'solid-js'\n",[43,718,719,721,723,725],{"class":45,"line":64},[43,720,68],{"class":67},[43,722,86],{"class":49},[43,724,74],{"class":67},[43,726,91],{"class":77},[43,728,729],{"class":45,"line":81},[43,730,98],{"emptyLinePlaceholder":97},[43,732,733,735,737],{"class":45,"line":94},[43,734,372],{"class":67},[43,736,375],{"class":57},[43,738,378],{"class":49},[43,740,741,743,745,747,749,751,753,755,758,760,762],{"class":45,"line":101},[43,742,383],{"class":67},[43,744,386],{"class":49},[43,746,303],{"class":107},[43,748,166],{"class":49},[43,750,393],{"class":107},[43,752,396],{"class":49},[43,754,156],{"class":67},[43,756,757],{"class":57}," createSignal",[43,759,117],{"class":49},[43,761,120],{"class":107},[43,763,123],{"class":49},[43,765,766,769,771,773],{"class":45,"line":126},[43,767,768],{"class":57},"  onMount",[43,770,141],{"class":49},[43,772,144],{"class":67},[43,774,147],{"class":49},[43,776,777,779,781,783,785,787,789,791,793,795,797,799,801,803,805,807,809,811,813],{"class":45,"line":135},[43,778,423],{"class":67},[43,780,426],{"class":107},[43,782,111],{"class":67},[43,784,159],{"class":57},[43,786,117],{"class":49},[43,788,120],{"class":107},[43,790,166],{"class":49},[43,792,169],{"class":107},[43,794,172],{"class":49},[43,796,175],{"class":107},[43,798,178],{"class":49},[43,800,181],{"class":107},[43,802,166],{"class":49},[43,804,186],{"class":107},[43,806,166],{"class":49},[43,808,191],{"class":107},[43,810,166],{"class":49},[43,812,186],{"class":107},[43,814,461],{"class":49},[43,816,817,820,822,824,826,828],{"class":45,"line":150},[43,818,819],{"class":57},"    onCleanup",[43,821,141],{"class":49},[43,823,144],{"class":67},[43,825,474],{"class":49},[43,827,241],{"class":57},[43,829,244],{"class":49},[43,831,832],{"class":45,"line":222},[43,833,656],{"class":49},[43,835,836],{"class":45,"line":228},[43,837,98],{"emptyLinePlaceholder":97},[43,839,840,842],{"class":45,"line":247},[43,841,493],{"class":67},[43,843,496],{"class":49},[43,845,846,848,850,852,854,856],{"class":45,"line":257},[43,847,294],{"class":49},[43,849,278],{"class":107},[43,851,281],{"class":57},[43,853,156],{"class":67},[43,855,286],{"class":77},[43,857,61],{"class":49},[43,859,860,862,864,866,868,871,873],{"class":45,"line":262},[43,861,516],{"class":49},[43,863,297],{"class":107},[43,865,108],{"class":57},[43,867,156],{"class":67},[43,869,870],{"class":49},"{",[43,872,303],{"class":57},[43,874,875],{"class":49},"()} \u002F>\n",[43,877,878,880,882],{"class":45,"line":272},[43,879,530],{"class":49},[43,881,278],{"class":107},[43,883,61],{"class":49},[43,885,886],{"class":45,"line":291},[43,887,539],{"class":49},[43,889,890],{"class":45,"line":318},[43,891,544],{"class":49},[33,893,897],{"className":894,"code":895,"language":896,"meta":38,"style":38},"language-javascript shiki shiki-themes github-dark","import { createShader } from 'shaders\u002Fjs'\nimport { animate } from 'motion'\n\nconst shader = await createShader(canvas, {\n  components: [{ type: 'Aurora', id: 'sheen', props: { intensity: 0 } }]\n})\n\nanimate(0, 0.5, { duration: 1.2, ease: [0.16, 1, 0.3, 1], onUpdate: v => shader.update('sheen', { intensity: v }) })\n","javascript",[40,898,899,911,921,925,943,965,969,973],{"__ignoreMap":38},[43,900,901,903,906,908],{"class":45,"line":46},[43,902,68],{"class":67},[43,904,905],{"class":49}," { createShader } ",[43,907,74],{"class":67},[43,909,910],{"class":77}," 'shaders\u002Fjs'\n",[43,912,913,915,917,919],{"class":45,"line":64},[43,914,68],{"class":67},[43,916,86],{"class":49},[43,918,74],{"class":67},[43,920,91],{"class":77},[43,922,923],{"class":45,"line":81},[43,924,98],{"emptyLinePlaceholder":97},[43,926,927,929,932,934,937,940],{"class":45,"line":94},[43,928,104],{"class":67},[43,930,931],{"class":107}," shader",[43,933,111],{"class":67},[43,935,936],{"class":67}," await",[43,938,939],{"class":57}," createShader",[43,941,942],{"class":49},"(canvas, {\n",[43,944,945,948,951,954,957,960,962],{"class":45,"line":101},[43,946,947],{"class":49},"  components: [{ type: ",[43,949,950],{"class":77},"'Aurora'",[43,952,953],{"class":49},", id: ",[43,955,956],{"class":77},"'sheen'",[43,958,959],{"class":49},", props: { intensity: ",[43,961,120],{"class":107},[43,963,964],{"class":49}," } }]\n",[43,966,967],{"class":45,"line":126},[43,968,225],{"class":49},[43,970,971],{"class":45,"line":135},[43,972,98],{"emptyLinePlaceholder":97},[43,974,975,978,980,982,984,986,988,990,992,994,996,998,1000,1002,1004,1006,1008,1010,1012,1014,1016,1019,1022,1024,1026],{"class":45,"line":150},[43,976,977],{"class":57},"animate",[43,979,117],{"class":49},[43,981,120],{"class":107},[43,983,166],{"class":49},[43,985,169],{"class":107},[43,987,172],{"class":49},[43,989,175],{"class":107},[43,991,178],{"class":49},[43,993,181],{"class":107},[43,995,166],{"class":49},[43,997,186],{"class":107},[43,999,166],{"class":49},[43,1001,191],{"class":107},[43,1003,166],{"class":49},[43,1005,186],{"class":107},[43,1007,198],{"class":49},[43,1009,201],{"class":57},[43,1011,204],{"class":49},[43,1013,208],{"class":207},[43,1015,211],{"class":67},[43,1017,1018],{"class":49}," shader.",[43,1020,1021],{"class":57},"update",[43,1023,117],{"class":49},[43,1025,956],{"class":77},[43,1027,1028],{"class":49},", { intensity: v }) })\n",[14,1030,1031,1032,1035,1036,1039],{},"Colours tween the same way (",[40,1033,1034],{},"animate('#7C3AED', '#F97316', …)","). For a position or a transform, tween each number and pass the object: ",[40,1037,1038],{},"transform={{ ...rest, rotation }}",".",[21,1041,1043],{"id":1042},"tweening-a-prop-with-gsap","Tweening a prop with GSAP",[14,1045,1046,1047,1049],{},"GSAP tweens a plain object. Read it in ",[40,1048,201],{},":",[33,1051,1053],{"className":894,"code":1052,"language":896,"meta":38,"style":38},"import gsap from 'gsap'\n\nconst state = { intensity: 0 }\ngsap.to(state, {\n  intensity: 0.5,\n  duration: 1.2,\n  ease: 'expo.out',\n  onUpdate: () => setIntensity(state.intensity)\n})\n",[40,1054,1055,1067,1071,1088,1099,1109,1118,1128,1144],{"__ignoreMap":38},[43,1056,1057,1059,1062,1064],{"class":45,"line":46},[43,1058,68],{"class":67},[43,1060,1061],{"class":49}," gsap ",[43,1063,74],{"class":67},[43,1065,1066],{"class":77}," 'gsap'\n",[43,1068,1069],{"class":45,"line":64},[43,1070,98],{"emptyLinePlaceholder":97},[43,1072,1073,1075,1078,1080,1083,1085],{"class":45,"line":81},[43,1074,104],{"class":67},[43,1076,1077],{"class":107}," state",[43,1079,111],{"class":67},[43,1081,1082],{"class":49}," { intensity: ",[43,1084,120],{"class":107},[43,1086,1087],{"class":49}," }\n",[43,1089,1090,1093,1096],{"class":45,"line":94},[43,1091,1092],{"class":49},"gsap.",[43,1094,1095],{"class":57},"to",[43,1097,1098],{"class":49},"(state, {\n",[43,1100,1101,1104,1106],{"class":45,"line":101},[43,1102,1103],{"class":49},"  intensity: ",[43,1105,169],{"class":107},[43,1107,1108],{"class":49},",\n",[43,1110,1111,1114,1116],{"class":45,"line":126},[43,1112,1113],{"class":49},"  duration: ",[43,1115,175],{"class":107},[43,1117,1108],{"class":49},[43,1119,1120,1123,1126],{"class":45,"line":135},[43,1121,1122],{"class":49},"  ease: ",[43,1124,1125],{"class":77},"'expo.out'",[43,1127,1108],{"class":49},[43,1129,1130,1133,1136,1138,1141],{"class":45,"line":150},[43,1131,1132],{"class":57},"  onUpdate",[43,1134,1135],{"class":49},": () ",[43,1137,144],{"class":67},[43,1139,1140],{"class":57}," setIntensity",[43,1142,1143],{"class":49},"(state.intensity)\n",[43,1145,1146],{"class":45,"line":222},[43,1147,225],{"class":49},[14,1149,1150,1151,1154,1155,1158],{},"Scroll works the same way: Motion's ",[40,1152,1153],{},"scroll()"," or a GSAP ScrollTrigger with ",[40,1156,1157],{},"scrub: true"," drives the tween from scroll position.",[21,1160,1162],{"id":1161},"animations-designed-in-the-editor","Animations designed in the editor",[14,1164,1165,1166,1169],{},"An entrance, hover or scroll animation designed in the Shaders editor comes with the shader when your agent installs it (",[40,1167,1168],{},"\u003CComponent>.animations.ts"," beside the component). The agent builds it with the motion library your project already uses. Tell it when each one should play: on load, on hover, as the section scrolls into view.",[21,1171,1173],{"id":1172},"keeping-animations-smooth","Keeping animations smooth",[14,1175,1176,1177,1181],{},"Changing an animated prop updates a ",[1178,1179,1180],"strong",{},"uniform",", so nothing recompiles. Two cases cost more:",[1183,1184,1185,1192],"ul",{},[1186,1187,1188,1191],"li",{},[1178,1189,1190],{},"Opacity reaching exactly 1",": a layer at opacity 1 takes a different path than one below 1, so the effect recompiles once when a fade gets there. That's fine at the end of a fade. Don't cross 1 on every frame.",[1186,1193,1194,1197,1198,1039],{},[1178,1195,1196],{},"Compile-time props"," recompile the effect whenever they change, so don't animate them. See ",[1199,1200,1202],"a",{"href":1201},"\u002Fdocs\u002Fguide\u002Fprops-reactivity","Props and reactivity",[14,1204,1205,1206,1210],{},"For motion that runs forever inside the shader (a breathing glow, a light that follows the mouse), use ",[1199,1207,1209],{"href":1208},"\u002Fdocs\u002Fguide\u002Fdynamic-props","dynamic props"," instead. They need no animation code.",[21,1212,1214],{"id":1213},"next-steps","Next steps",[1183,1216,1217,1222,1228],{},[1186,1218,1219,1221],{},[1199,1220,1202],{"href":1201},": how props update and which ones recompile.",[1186,1223,1224,1227],{},[1199,1225,1226],{"href":1208},"Dynamic props",": motion that runs inside the shader, with no animation code.",[1186,1229,1230,1234],{},[1199,1231,1233],{"href":1232},"\u002Fdocs\u002Fguide\u002Fperformance","Performance",": what each layer costs and how to keep effects fast.",[1236,1237,1238],"style",{},"html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .s4JwU, html code.shiki .s4JwU{--shiki-default:#85E89D}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}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);}",{"title":38,"searchDepth":64,"depth":64,"links":1240},[1241,1242,1243,1244,1245],{"id":23,"depth":64,"text":24},{"id":1042,"depth":64,"text":1043},{"id":1161,"depth":64,"text":1162},{"id":1172,"depth":64,"text":1173},{"id":1213,"depth":64,"text":1214},"md","film",{"type":1249},"guide","\u002Fdocs\u002Fguide\u002Fanimation",{"title":5,"description":16},"docs\u002Fguide\u002F05.animation","zfX_aZByup7pQDImTLTatNsNuz99BTNv_tejGy3sVmY",{"stars":1255},6080,[1257,1261,1265,1269,1273,1275,1276,1278,1282,1286,1290,1294,1298,1302,1304,1308,1312,1317,1321,1325,1329,1333],{"path":1258,"title":1259,"description":1260,"category":40},"\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":1262,"title":1263,"description":1264,"category":40},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":1266,"title":1267,"description":1268,"category":40},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":1270,"title":1271,"description":1272,"category":40},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":1201,"title":1202,"description":1274,"category":40},"Bind props to your framework's state so effects update when it changes, and animate props with an animation library.",{"path":1250,"title":5,"description":16,"category":40},{"path":1208,"title":1226,"description":1277,"category":40},"Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":1279,"title":1280,"description":1281,"category":40},"\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":1283,"title":1284,"description":1285,"category":40},"\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":1287,"title":1288,"description":1289,"category":40},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":1291,"title":1292,"description":1293,"category":40},"\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":1295,"title":1296,"description":1297,"category":40},"\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":1299,"title":1300,"description":1301,"category":40},"\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":1232,"title":1233,"description":1303,"category":40},"Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":1305,"title":1306,"description":1307,"category":40},"\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":1309,"title":1310,"description":1311,"category":40},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":1313,"title":1314,"description":1315,"category":1316},"\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":1318,"title":1319,"description":1320,"category":1316},"\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":1322,"title":1323,"description":1324,"category":1316},"\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":1326,"title":1327,"description":1328,"category":40},"\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":1330,"title":1331,"description":1332,"category":40},"\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":1334,"title":1335,"description":1336,"category":40},"\u002Fdocs\u002Fguide\u002Fssr","Server rendering","Render Shaders in Next.js, Nuxt, SvelteKit, SolidStart and other SSR apps by keeping each shader on the client.",1796051172329,"06e02370-81a6-4d74-9931-661d71414be1"]