{"version":3,"file":"ImageCycler.BACAdJDk.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/lqXDDbZbODHIZzZ1rrnu/ckZwsjDjxpW20YHpjRXR/ImageCycler.js"],"sourcesContent":["// Rapid Image Cycler - Displays a single image frame that cycles through multiple uploaded images with customizable speed and transitions\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * Rapid Image Cycler\n *\n * @framerIntrinsicWidth 800\n * @framerIntrinsicHeight 600\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ImageCycler(props){const{images=[{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Gradient 2 - Purple\"},{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Gradient 3 - Orange\"}],speed=1e3,transition=\"fade\",autoplay=true,pauseOnHover=false,randomize=false,height=600}=props;const[currentIndex,setCurrentIndex]=useState(0);const[isPaused,setIsPaused]=useState(false);const[shuffledImages,setShuffledImages]=useState(images);const intervalRef=useRef(null);// Shuffle images on mount if randomize is enabled\nuseEffect(()=>{if(randomize){const shuffled=[...images].sort(()=>Math.random()-.5);startTransition(()=>setShuffledImages(shuffled));}else{startTransition(()=>setShuffledImages(images));}},[images,randomize]);// Handle image cycling\nuseEffect(()=>{if(!autoplay||isPaused||shuffledImages.length===0){if(intervalRef.current!==null){clearInterval(intervalRef.current);intervalRef.current=null;}return;}intervalRef.current=window.setInterval(()=>{startTransition(()=>{setCurrentIndex(prevIndex=>(prevIndex+1)%shuffledImages.length);});},speed);return()=>{if(intervalRef.current!==null){clearInterval(intervalRef.current);intervalRef.current=null;}};},[autoplay,isPaused,speed,shuffledImages.length]);const handleMouseEnter=()=>{if(pauseOnHover){startTransition(()=>setIsPaused(true));}};const handleMouseLeave=()=>{if(pauseOnHover){startTransition(()=>setIsPaused(false));}};if(shuffledImages.length===0){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:\"#F5F5F5\",color:\"#CCCCCC\",fontSize:\"14px\",fontFamily:\"system-ui, -apple-system, sans-serif\"},children:\"Add images to begin\"});}const currentImage=shuffledImages[currentIndex];if(transition===\"cut\"){return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\"},onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,children:/*#__PURE__*/_jsx(\"img\",{src:currentImage.src,alt:currentImage.alt,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}},currentIndex)});}return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\"},onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,children:/*#__PURE__*/_jsx(AnimatePresence,{mode:\"sync\",children:/*#__PURE__*/_jsx(motion.img,{src:currentImage.src,alt:currentImage.alt,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5,ease:\"easeInOut\"},style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",objectFit:\"cover\"}},currentIndex)})});}addPropertyControls(ImageCycler,{images:{type:ControlType.Array,title:\"Images\",control:{type:ControlType.ResponsiveImage},defaultValue:[{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Gradient 2 - Purple\"},{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",alt:\"Gradient 3 - Orange\"}]},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:1e3,min:100,max:1e4,step:100,unit:\"ms\"},transition:{type:ControlType.Enum,title:\"Transition\",options:[\"cut\",\"fade\"],optionTitles:[\"Hard Cut\",\"Soft Fade\"],defaultValue:\"fade\",displaySegmentedControl:true},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},pauseOnHover:{type:ControlType.Boolean,title:\"Pause on Hover\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},randomize:{type:ControlType.Boolean,title:\"Randomize Order\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageCycler\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"600\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"800\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageCycler.map"],"mappings":"sQASG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,SAAO,CAAC,CAAC,IAAI,sEAAsE,IAAI,oBAAoB,CAAC,CAAC,IAAI,oEAAoE,IAAI,sBAAsB,CAAC,CAAC,IAAI,uEAAuE,IAAI,sBAAsB,CAAC,CAAC,QAAM,IAAI,aAAW,OAAO,WAAS,GAAK,eAAa,GAAM,YAAU,GAAM,SAAO,KAAK,EAAW,CAAC,EAAa,GAAiBA,EAAS,EAAE,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAM,CAAM,CAAC,EAAe,GAAmBA,EAAS,EAAO,CAAO,EAAYC,EAAO,KAAK,CAC9nB,MAAc,CAAC,GAAG,EAAU,CAAC,IAAM,EAAS,CAAC,GAAG,EAAO,CAAC,SAAS,KAAK,QAAQ,CAAC,GAAG,CAAC,MAAoB,E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