{"version":3,"file":"DrawnFrame.inNoTd9A.mjs","names":["useRef","p"],"sources":["https:/framerusercontent.com/modules/ljtSfl5HpRDzmJA5xDxR/FBMTsBWb0IF7L2aU8DO9/DrawnFrame.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useScroll,useTransform,useMotionValue,useReducedMotion,animate}from\"framer-motion\";// Drawn frame: a sheet border drawn around the box it covers, top, right, bottom, then left, the same\n// order as the hero sheet. Scrubbed by scroll for sections that pass by, or drawn once on load for a sheet that is\n// already on screen. Place it over a section, pinned to all four sides, above the content.\nconst EASE_IN_OUT=[.65,0,.35,1];const EASE_OUT=[.22,1,.36,1];function Side({p,from,to,side,color,width}){const v=useTransform(p,[from,to],[0,1],{clamp:true});const horizontal=side===\"top\"||side===\"bottom\";const style={position:\"absolute\",background:color,...horizontal?{left:0,right:0,height:width,scaleX:v,originX:side===\"top\"?0:1,originY:.5}:{top:0,bottom:0,width,scaleY:v,originY:side===\"right\"?0:1,originX:.5},...side===\"top\"?{top:0}:side===\"bottom\"?{bottom:0}:side===\"left\"?{left:0}:{right:0}};return /*#__PURE__*/_jsx(motion.div,{\"aria-hidden\":true,style:style});}/**\n * Drawn frame: a border drawn around a section, scrubbed by scroll or drawn once.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 1440\n * @framerIntrinsicHeight 640\n */export default function DrawnFrame(props){const{trigger=\"scroll\",color=\"#1B1D1A\",underlay=\"#D3D4D0\",showUnderlay=true,lineWidth=1,inset=20,drawStart=100,drawEnd=50,duration=600,delay=0,curve=\"easeInOut\",style}=props;const ref=useRef(null);const isStatic=useIsStaticRenderer();const reduce=useReducedMotion();const done=isStatic||reduce===true;// Scroll: 0 when the top of the frame's box meets Draw start (share of the screen from the top), 1 at Draw end.\nconst{scrollYProgress}=useScroll({target:ref,offset:[`0 ${drawStart/100}`,`0 ${drawEnd/100}`]});const timed=useMotionValue(done?1:0);const full=useMotionValue(1);const inView=useRef(false);useEffect(()=>{if(done||trigger===\"scroll\")return;const ease=curve===\"linear\"?\"linear\":curve===\"easeOut\"?EASE_OUT:EASE_IN_OUT;const run=()=>animate(timed,1,{duration:duration/1e3,delay:delay/1e3,ease:ease});if(trigger===\"load\"){const controls=run();return()=>controls.stop();}const el=ref.current;if(!el||typeof IntersectionObserver===\"undefined\")return;let controls=null;const io=new IntersectionObserver(entries=>{if(entries.some(e=>e.isIntersecting)&&!inView.current){inView.current=true;controls=run();io.disconnect();}},{threshold:.2});io.observe(el);return()=>{io.disconnect();if(controls)controls.stop();};},[done,trigger,duration,delay,curve,timed]);const p=done?full:trigger===\"scroll\"?scrollYProgress:timed;const box={position:\"absolute\",inset};const w=Math.max(.5,lineWidth);return /*#__PURE__*/_jsxs(\"div\",{ref:ref,\"aria-hidden\":true,style:{position:\"relative\",width:\"100%\",height:\"100%\",pointerEvents:\"none\",...style},children:[showUnderlay&&/*#__PURE__*/_jsx(\"div\",{style:{...box,boxShadow:`inset 0 0 0 ${w}px ${underlay}`}}),/*#__PURE__*/_jsxs(\"div\",{style:box,children:[/*#__PURE__*/_jsx(Side,{p:p,from:0,to:.25,side:\"top\",color:color,width:w}),/*#__PURE__*/_jsx(Side,{p:p,from:.25,to:.5,side:\"right\",color:color,width:w}),/*#__PURE__*/_jsx(Side,{p:p,from:.5,to:.75,side:\"bottom\",color:color,width:w}),/*#__PURE__*/_jsx(Side,{p:p,from:.75,to:1,side:\"left\",color:color,width:w})]})]});}DrawnFrame.displayName=\"Drawn frame\";addPropertyControls(DrawnFrame,{trigger:{type:ControlType.Enum,title:\"Trigger\",options:[\"scroll\",\"load\",\"view\"],optionTitles:[\"Scroll\",\"Page load\",\"In view\"],defaultValue:\"scroll\",description:\"Scroll follows the reader both ways. Page load and In view draw once.\"},color:{type:ControlType.Color,title:\"Line\",defaultValue:\"#1B1D1A\"},showUnderlay:{type:ControlType.Boolean,title:\"Faint line\",defaultValue:true},underlay:{type:ControlType.Color,title:\"Faint line color\",defaultValue:\"#D3D4D0\",description:\"The pale line shown before it is inked.\",hidden:p=>p.showUnderlay===false},lineWidth:{type:ControlType.Number,title:\"Line width\",defaultValue:1,min:.5,max:6,step:.5,unit:\"px\"},inset:{type:ControlType.Number,title:\"Inset\",defaultValue:20,min:0,max:200,step:1,unit:\"px\",description:\"Distance from the edge of the section to the frame.\"},drawStart:{type:ControlType.Number,title:\"Draw start\",defaultValue:100,min:0,max:100,step:1,unit:\"%\",description:\"Where the top of the section is on screen when drawing starts, from the top of the screen.\",hidden:p=>p.trigger!==undefined&&p.trigger!==\"scroll\"},drawEnd:{type:ControlType.Number,title:\"Draw end\",defaultValue:50,min:0,max:100,step:1,unit:\"%\",description:\"Where the top of the section is on screen when the frame is closed. Keep it above Draw start.\",hidden:p=>p.trigger!==undefined&&p.trigger!==\"scroll\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:600,min:100,max:4e3,step:50,unit:\"ms\",hidden:p=>p.trigger===undefined||p.trigger===\"scroll\"},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:5e3,step:50,unit:\"ms\",hidden:p=>p.trigger===undefined||p.trigger===\"scroll\"},curve:{type:ControlType.Enum,title:\"Easing\",options:[\"easeInOut\",\"easeOut\",\"linear\"],optionTitles:[\"Ease in out\",\"Ease out\",\"Linear\"],defaultValue:\"easeInOut\",hidden:p=>p.trigger===undefined||p.trigger===\"scroll\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DrawnFrame\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicHeight\":\"640\",\"framerIntrinsicWidth\":\"1440\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DrawnFrame.map"],"m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