{"version":3,"file":"Reveal_Text_Scroll.CQO2pdWK.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/TcGVFCXqzWC18L3Egn6v/vbfWfw7rWSJa2lZjPbZh/Reveal_Text_Scroll.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useScroll,useSpring,useTransform,useMotionTemplate}from\"framer-motion\";import{useRef,useLayoutEffect,useState,useEffect}from\"react\";export default function Reveal_Text_Scroll(props){const{text,fontFamily,fontSize,lineHeight,letterSpacing,textAlign,color,revealStart,revealEnd,edgePct,directionPreset,repeatReveal}=props;const rootRef=useRef(null);const pRef=useRef(null);const[measuredH,setMeasuredH]=useState(undefined);useLayoutEffect(()=>{const el=pRef.current;if(!el)return;const read=()=>{setMeasuredH(el.scrollHeight);};const ro=new ResizeObserver(read);ro.observe(el);read();return()=>ro.disconnect();},[text,fontSize,lineHeight,letterSpacing,fontFamily?.fontFamily,fontFamily?.fontWeight]);const{scrollYProgress}=useScroll({target:rootRef,offset:[`start ${revealStart}`,`start ${revealEnd}`]});const smooth=useSpring(scrollYProgress,{stiffness:120,damping:30,mass:.25});const visiblePct=useTransform(smooth,[0,1],[0,100]);const[locked,setLocked]=useState(false);useEffect(()=>{if(repeatReveal){setLocked(false);return;}const unsub=smooth.on(\"change\",v=>{if(v>=1&&!locked)setLocked(true);});return()=>unsub();},[smooth,repeatReveal,locked]);const progressForMask=!repeatReveal&&locked?100:visiblePct;let globalMask;switch(directionPreset){case\"Top → Bottom\":globalMask=useMotionTemplate`\n        linear-gradient(\n          180deg,\n          rgba(0,0,0,1) 0%,\n          rgba(0,0,0,1) ${progressForMask}%,\n          rgba(0,0,0,0) calc(${progressForMask}% + ${edgePct}%),\n          rgba(0,0,0,0) 100%\n        )\n      `;break;case\"Left → Right\":globalMask=useMotionTemplate`\n        linear-gradient(\n          90deg,\n          rgba(0,0,0,1) 0%,\n          rgba(0,0,0,1) ${progressForMask}%,\n          rgba(0,0,0,0) calc(${progressForMask}% + ${edgePct}%),\n          rgba(0,0,0,0) 100%\n        )\n      `;break;case\"Right → Left\":globalMask=useMotionTemplate`\n        linear-gradient(\n          270deg,\n          rgba(0,0,0,1) 0%,\n          rgba(0,0,0,1) ${progressForMask}%,\n          rgba(0,0,0,0) calc(${progressForMask}% + ${edgePct}%),\n          rgba(0,0,0,0) 100%\n        )\n      `;break;case\"Bottom → Top\":default:globalMask=useMotionTemplate`\n        linear-gradient(\n          180deg,\n          rgba(0,0,0,0) 0%,\n          rgba(0,0,0,0) calc(100% - ${progressForMask}% - ${edgePct}%),\n          rgba(0,0,0,1) calc(100% - ${progressForMask}%),\n          rgba(0,0,0,1) 100%\n        )\n      `;break;}return /*#__PURE__*/_jsx(motion.div,{ref:rootRef,style:{minWidth:\"0px\",WebkitMaskImage:globalMask,maskImage:globalMask,WebkitMaskRepeat:\"no-repeat\",maskRepeat:\"no-repeat\",WebkitMaskSize:\"100% 100%\",maskSize:\"100% 100%\",overflow:\"visible\",height:measuredH!==undefined?`${measuredH+2}px`:\"auto\"},children:/*#__PURE__*/_jsx(\"p\",{ref:pRef,style:{fontFamily:fontFamily?.fontFamily||\"system-ui, -apple-system, Segoe UI, Arial\",fontSize:`${fontSize}px`,fontWeight:fontFamily?.fontWeight||400,lineHeight:`${lineHeight}px`,letterSpacing:`${letterSpacing}px`,textAlign,color,margin:0,whiteSpace:\"pre-wrap\",display:\"block\",overflow:\"visible\"},children:text})});}addPropertyControls(Reveal_Text_Scroll,{text:{title:\"Text\",type:ControlType.String,defaultValue:\"We create our designs with a special focus on ergonomics, quality materials, and timeless aesthetics. Every curve, every joint, and every texture is designed to support the body and spirit.\",displayTextArea:true},fontFamily:{title:\"Font\",type:ControlType.Font},fontSize:{title:\"Size\",type:ControlType.Number,defaultValue:44,min:10,max:200},lineHeight:{title:\"Line Height\",type:ControlType.Number,defaultValue:60,min:12,max:160},letterSpacing:{title:\"Letter Spacing\",type:ControlType.Number,defaultValue:-.35,min:-10,max:20},textAlign:{title:\"Align\",type:ControlType.Enum,options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\"},color:{title:\"Color\",type:ControlType.Color,defaultValue:\"#000\"},revealStart:{title:\"Reveal Start\",type:ControlType.Number,defaultValue:.8,min:0,max:1,step:.01},revealEnd:{title:\"Reveal End\",type:ControlType.Number,defaultValue:.4,min:0,max:1,step:.01},edgePct:{title:\"Edge %\",type:ControlType.Number,defaultValue:25,min:0,max:70,step:1},directionPreset:{title:\"Direction\",type:ControlType.Enum,options:[\"Top → Bottom\",\"Bottom → Top\",\"Left → Right\",\"Right → Left\"],optionTitles:[\"Top → Bottom\",\"Bottom → Top\",\"Left → Right\",\"Right → Left\"],defaultValue:\"Top → Bottom\"},repeatReveal:{title:\"Repeat on Scroll\",type:ControlType.Boolean,defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Reveal_Text_Scroll\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Reveal_Text_Scroll.map"],"mappings":"kRAAiP,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,OAAK,aAAW,WAAS,aAAW,gBAAc,YAAU,QAAM,cAAY,YAAU,UAAQ,kBAAgB,gBAAc,EAAY,EAAQA,EAAO,KAAK,CAAO,EAAKA,EAAO,KAAK,CAAM,CAAC,EAAU,GAAcC,EAAS,IAAA,GAAU,CAAC,MAAoB,CAAC,IAAM,EAAG,EAAK,QAAQ,GAAG,CAAC,EAAG,OAAO,IAAM,MAAS,CAAC,EAAa,EAAG,aAAa,EAAS,EAAG,IAAI,eAAe,EAAK,CAAuB,OAAtB,EAAG,QAAQ,EAAG,CAAC,GAAM,KAAW,EAAG,YAAY,EAAG,CAAC,EAAK,EAAS,EAAW,EAAc,GAAY,WAAW,GAAY,WAAW,CAAC,CAAC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