{"version":3,"file":"AnimatedBlocks_1.C0e4yjet.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/TEQ564nu01ofRbs70zok/ydVsTw4D8Ad5rzeHAUjV/AnimatedBlocks_1.js"],"sourcesContent":["// Animated grid blocks with random opacity animations\n// Blocks fade in and out randomly with configurable count, size, color, and layout\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function AnimatedBlocks(props){const{blockCount=50,blockSize=40,blockColor=\"#CCCCCC\",gap=8,columns=4,animationSpeed=2,minOpacity=0,maxOpacity=1,isPlaying=true,animationDuration=.5,animationFrequency=3,transition}=props;const[blockStates,setBlockStates]=useState(()=>{// Initialize with random mix of visible and invisible blocks\nreturn Array.from({length:blockCount},()=>Math.random()>.5?maxOpacity:minOpacity);});const isStatic=useIsStaticRenderer();const intervalRef=useRef(null);const lastChangeTime=useRef(Array.from({length:blockCount},()=>Date.now()-Math.random()*1e3));// Update block count when it changes\nuseEffect(()=>{startTransition(()=>{setBlockStates(Array.from({length:blockCount},()=>Math.random()>.5?maxOpacity:minOpacity));});lastChangeTime.current=Array.from({length:blockCount},()=>Date.now()-Math.random()*1e3);},[blockCount]);useEffect(()=>{if(isStatic||!isPlaying)return;// Clear any existing interval\nif(intervalRef.current!==null){clearInterval(intervalRef.current);}// Randomly animate blocks with independent timing\nconst animate=()=>{const now=Date.now();startTransition(()=>{setBlockStates(prev=>{const newStates=[...prev];const minTimeBetweenChanges=1e3/animationSpeed*.3;// Each block has a random chance to change based on frequency\nfor(let i=0;i<prev.length;i++){const timeSinceLastChange=now-(lastChangeTime.current[i]||0);// Random chance based on frequency and time since last change\nconst changeChance=animationFrequency/prev.length*.5;const shouldChange=Math.random()<changeChance&&timeSinceLastChange>minTimeBetweenChanges;if(shouldChange){newStates[i]=newStates[i]===maxOpacity?minOpacity:maxOpacity;lastChangeTime.current[i]=now;}}return newStates;});});};// Run animation check more frequently for smoother randomness\nconst interval=50// Check every 50ms\n;intervalRef.current=window.setInterval(animate,interval);return()=>{if(intervalRef.current!==null){clearInterval(intervalRef.current);intervalRef.current=null;}};},[animationSpeed,isStatic,minOpacity,maxOpacity,isPlaying,animationFrequency]);if(isStatic){// Show static preview with some blocks visible\nconst staticStates=Array.from({length:blockCount},(_,i)=>i%3===0?maxOpacity:minOpacity);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"grid\",gridTemplateColumns:`repeat(${columns}, ${blockSize}px)`,gap:`${gap}px`,padding:gap,overflow:\"auto\"},children:staticStates.map((opacity,index)=>/*#__PURE__*/_jsx(\"div\",{style:{width:blockSize,height:blockSize,backgroundColor:blockColor,opacity:opacity,borderRadius:4}},index))});}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"grid\",gridTemplateColumns:`repeat(${columns}, ${blockSize}px)`,gap:`${gap}px`,padding:gap,overflow:\"auto\"},children:blockStates.map((opacity,index)=>/*#__PURE__*/_jsx(motion.div,{animate:{opacity},transition:transition,style:{width:blockSize,height:blockSize,backgroundColor:blockColor,borderRadius:4}},index))});}addPropertyControls(AnimatedBlocks,{blockCount:{type:ControlType.Number,title:\"Block Count\",defaultValue:50,min:1,max:1e4,step:1},blockSize:{type:ControlType.Number,title:\"Block Size\",defaultValue:40,min:1,max:100,step:1,unit:\"px\"},blockColor:{type:ControlType.Color,title:\"Block Color\",defaultValue:\"#CCCCCC\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"},columns:{type:ControlType.Number,title:\"Columns\",defaultValue:4,min:1,max:20,step:1},minOpacity:{type:ControlType.Number,title:\"Min Opacity\",defaultValue:0,min:0,max:1,step:.1},maxOpacity:{type:ControlType.Number,title:\"Max Opacity\",defaultValue:1,min:0,max:1,step:.1},animationSpeed:{type:ControlType.Number,title:\"Animation Speed\",defaultValue:2,min:.1,max:10,step:.1,unit:\"x\"},transition:{type:ControlType.Transition,title:\"Transition\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedBlocks\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AnimatedBlocks_1.map"],"mappings":"sQAKG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,aAAW,GAAG,YAAU,GAAG,aAAW,UAAU,MAAI,EAAE,UAAQ,EAAE,iBAAe,EAAE,aAAW,EAAE,aAAW,EAAE,YAAU,GAAK,oBAAkB,GAAG,qBAAmB,EAAE,cAAY,EAAW,CAAC,EAAY,GAAgBA,MACxQ,MAAM,KAAK,CAAC,OAAO,CAAU,MAAM,KAAK,OAAO,EAAE,GAAG,EAAW,CAAU,CAAG,EAAQ,EAAS,EAAoB,EAAQ,EAAYC,EAAO,IAAI,EAAQ,EAAeA,EAAO,MAAM,KAAK,CAAC,OAAO,CAAU,MAAM,KAAK,IAAI,EAAE,KAAK,OAAO,EAAE,GAAG,CAAC,EAOF,GANnP,MAAc,CAAC,MAAoB,CAAC,EAAe,MAAM,KAAK,CAAC,OAAO,CAAU,MAAM,KAAK,OAAO,EAAE,GAAG,EAAW,CAAU,CAAC,CAAE,CAAC,EAAE,EAAe,QAAQ,MAAM,KAAK,CAAC,OAAO,CAAU,MAAM,KAAK,IAAI,EAAE,KAAK,OAAO,EAAE,GAAG,CAAE,EAAE,CAAC,CAAU,CAAC,EAAE,MAAkB,GAAU,CAAC,EAAU,QAC9Q,EAAY,UAAU,MAAM,cAAc,EAAY,OAAO,EAK/D,EAAY,QAAQ,EAAO,gBAJV,CAAC,IAAM,EAAI,KA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