{"version":3,"file":"Color_Cycle.CkFSeswt.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/e12RmzJkpIJdZNJ1nhsK/0mLIlNs4TxNZDF4xxiSj/Color_Cycle.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{useInView,useAnimationControls}from\"framer-motion\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const useStore=createStore({colors:[\"#EEF35F\",\"#EEF35F\"],animate:true});export function withColorCycleController(Component){return props=>{const[store,setStore]=useStore();const ref=useRef(null);const isInView=useInView(ref);useEffect(()=>{if(isInView&&!store.animate){setStore({animate:true});}else if(!isInView&&store.animate){setStore({animate:false});}},[ref,isInView,store,setStore]);return /*#__PURE__*/ _jsx(Component,{...props,ref:ref});};}export function withBGColorCycle(Component){return props=>{const[store,setStore]=useStore();const controls=useAnimationControls();useEffect(()=>{if(store.animate){controls.start({backgroundColor:[...store.colors]});}else{controls.stop();}},[controls,store]);return /*#__PURE__*/ _jsx(Component,{...props,style:{...props.style,backgroundColor:store.colors[0],willChange:\"background-color\"},animate:controls,transition:{type:\"tween\",duration:20,repeat:Infinity,repeatType:\"reverse\"}});};}export function withColorCycle(Component){return props=>{const[store,setStore]=useStore();const controls=useAnimationControls();useEffect(()=>{if(store.animate){controls.start({color:[...store.colors]});}else{controls.stop();}},[controls,store]);return /*#__PURE__*/ _jsx(Component,{...props,style:{...props.style,color:store.colors[0],willChange:\"color\"},animate:controls,transition:{type:\"tween\",duration:20,repeat:Infinity,repeatType:\"reverse\"}});};} // Attempted this: https://codesandbox.io/s/framer-motion-morphsvg-example-dp7to?from-embed=&file=/src/App.tsx\n // export function withAccentCycle(Component): ComponentType {\n //     return (props) => {\n //         const [store, setStore] = useStore()\n //         const [colorIndex, setColorIndex] = useState(0)\n //         const progress = useMotionValue(0)\n //         const input = [0, 1, 2, 3]\n //         const colors = [\"red\", \"yellow\", \"green\", \"blue\"]\n //         const color = useTransform(progress, input, colors)\n //         useEffect(() => {\n //             const animation = animate(progress, colorIndex, {\n //                 duration: 1,\n //                 ease: \"linear\",\n //                 onComplete: () => {\n //                     if (colorIndex === colors.length - 1) {\n //                         progress.set(0)\n //                         setColorIndex(0)\n //                     } else {\n //                         setColorIndex(colorIndex + 1)\n //                     }\n //                 },\n //             })\n //             return () => animation.stop()\n //         }, [colorIndex])\n //         return <Component accent={color} {...props} />\n //     }\n // }\n\nexport const __FramerMetadata__ = {\"exports\":{\"withColorCycleController\":{\"type\":\"reactHoc\",\"name\":\"withColorCycleController\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withBGColorCycle\":{\"type\":\"reactHoc\",\"name\":\"withBGColorCycle\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withColorCycle\":{\"type\":\"reactHoc\",\"name\":\"withColorCycle\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Color_Cycle.map"],"mappings":"oOAAsR,SAAgB,EAAyB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAM,GAAU,EAAS,EAAQ,EAAIA,EAAO,IAAI,EAAQ,EAAS,EAAU,CAAG,EAAsK,OAApK,MAAc,CAAI,GAAU,CAAC,EAAM,QAAS,EAAS,CAAC,QAAQ,EAAI,CAAC,EAAW,CAAC,GAAU,EAAM,SAAS,EAAS,CAAC,QAAQ,EAAK,CAAC,CAAG,EAAE,CAAC,EAAI,EAAS,EAAM,CAAQ,CAAC,EAAuB,EAAK,EAAU,CAAC,GAAG,EAAU,KAAG,CAAC,CAAE,CAAE,CAAC,SAAgB,EAAiB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAM,GAAU,EAAS,EAAQ,EAAS,EAAqB,EAAkI,OAAhI,MAAc,CAAI,EAAM,QAAS,EAAS,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAM,MAAM,CAAC,CAAC,EAAQ,EAAS,KAAK,CAAG,EAAE,CAAC,EAAS,CAAK,CAAC,EAAuB,EAAK,EAAU,CAAC,GAAG,EAAM,MAAM,CAAC,GAAG,EAAM,MAAM,gBAAgB,EAAM,OAAO,GAAG,WAAW,kBAAkB,EAAE,QAAQ,EAAS,WAAW,CAAC,KAAK,QAAQ,SAAS,GAAG,OAAO,IAAS,WAAW,SAAS,CAAC,CAAC,CAAE,CAAE,mBAAzkC,IAAoC,IAA0D,IAAqE,EAAO,EAAS,EAAY,CAAC,OAAO,CAAC,UAAU,SAAS,EAAE,QAAQ,EAAI,CAAC"}