{"version":3,"file":"Smooth_Scroll.CwloU9K1.mjs","names":[],"sources":["https:/framerusercontent.com/modules/VOxgG1C7bfs4Dv55YbJ6/0PbmZUBhyiZ2SM4z13yJ/Smooth_Scroll.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * SmoothScroll\n *\n * Drop this anywhere on every page. Zero visual output.\n * Intercepts wheel events and lerps the page toward the target\n * scroll position each rAF frame, creating natural deceleration.\n *\n * Yields completely to FerrisWheelVideo and ScrollAnchor via\n * window.__scrollLocked -- when either of those components is\n * active, this does nothing and lets them own the wheel event.\n */export default function SmoothScroll({friction,speedMultiplier}){React.useEffect(()=>{let targetY=window.scrollY;let currentY=window.scrollY;let rafId=null;let running=false;const lerp=(a,b,t)=>a+(b-a)*t;const f=friction??.1;const speed=speedMultiplier??1;const tick=()=>{currentY=lerp(currentY,targetY,f);window.scrollTo(0,currentY);if(Math.abs(targetY-currentY)>.5){rafId=requestAnimationFrame(tick);}else{window.scrollTo(0,targetY);currentY=targetY;running=false;}};const handleWheel=e=>{// Yield to FerrisWheelVideo and ScrollAnchor when active.\nif(window.__scrollLocked)return;e.preventDefault();const maxY=document.body.scrollHeight-window.innerHeight;targetY=Math.max(0,Math.min(maxY,targetY+e.deltaY*speed));if(!running){running=true;currentY=window.scrollY;rafId=requestAnimationFrame(tick);}};// Keep targetY in sync if something else scrolls the page\n// (e.g. anchor links, programmatic scrollTo calls).\nconst handleScroll=()=>{if(!running){targetY=window.scrollY;currentY=window.scrollY;}};window.addEventListener(\"wheel\",handleWheel,{capture:true,passive:false});window.addEventListener(\"scroll\",handleScroll,{passive:true});return()=>{window.removeEventListener(\"wheel\",handleWheel,true);window.removeEventListener(\"scroll\",handleScroll);if(rafId)cancelAnimationFrame(rafId);};},[friction,speedMultiplier]);return /*#__PURE__*/_jsx(\"div\",{style:{width:0,height:0,pointerEvents:\"none\"}});}addPropertyControls(SmoothScroll,{friction:{type:ControlType.Number,title:\"Friction\",defaultValue:.1,min:.01,max:.5,step:.01,displayStepper:true,description:\"Lower = more floaty/Locomotive-like. Higher = snappier, closer to native. 0.08–0.12 is the sweet spot.\"},speedMultiplier:{type:ControlType.Number,title:\"Speed\",defaultValue:1,min:.5,max:3,step:.1,displayStepper:true,description:\"Multiplies deltaY before adding to target. 1 = native scroll distance.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothScroll\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Smooth_Scroll.map"],"mappings":"mLAUG,SAAwB,EAAa,CAAC,WAAS,mBAAiB,CAGmV,OAHlV,MAAoB,CAAC,IAAI,EAAQ,EAAO,QAAY,EAAS,EAAO,QAAY,EAAM,KAAS,EAAQ,GAAY,GAAM,EAAE,EAAE,IAAI,GAAG,EAAE,GAAG,EAAQ,EAAE,GAAU,GAAS,EAAM,GAAiB,EAAQ,MAAS,CAAC,EAAS,EAAK,EAAS,EAAQ,CAAC,EAAE,EAAO,SAAS,EAAE,CAAQ,EAAK,KAAK,IAAI,EAAQ,CAAQ,EAAE,GAAI,EAAM,sBAAsB,CAAI,GAAQ,EAAO,SAAS,EAAE,CAAO,EAAE,EAAS,EAAQ,EAAQ,GAAO,EAAQ,EAAY,GAAG,CAC7e,GAAG,EAAO,eAAe,OAAO,EAAE,eAAe,EAAE,IAAM,EAAK,SAAS,KAAK,aAAa,EAAO,YAAY,EAAQ,KAAK,IAAI,EAAE,KAAK,IAAI,EAAK,EAAQ,EAAE,OAAO,CAAK,CAAC,EAAM,IAAS,EAAQ,GAAK,EAAS,EAAO,QAAQ,EAAM,sBAAsB,CAAI,EAAG,EAErP,MAAiB,CAAK,IAAS,EAAQ,EAAO,QAAQ,EAAS,EAAO,QAAS,EAA0I,OAAxI,EAAO,iBAAiB,QAAQ,EAAY,CAAC,QAAQ,GAAK,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