{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/7qCBCTviqbjXhOT5g19J/Llqf6f7vURoR2xv4IX3i/OrbitingElements.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,useCallback}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @copyright \u00A9framersnippets.com\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 200\n * @framerDisableUnlink\n **/export default function OrbitingElements(props){const{orbits}=props;const containerRef=useRef(null);const[containerSize,setContainerSize]=useState(0);const[angles,setAngles]=useState(orbits.map(orbit=>orbit.startingPoint));const animationRef=useRef({id:null,lastTime:null});const updateAngles=useCallback(time=>{if(!animationRef.current.lastTime){animationRef.current.lastTime=time;}const elapsed=time-animationRef.current.lastTime;setAngles(prevAngles=>prevAngles.map((angle,index)=>{var _orbits_index;return(angle+(((_orbits_index=orbits[index])===null||_orbits_index===void 0?void 0:_orbits_index.speed)||0)*(elapsed/16.67))%360;}));animationRef.current.lastTime=time;animationRef.current.id=requestAnimationFrame(updateAngles);},[orbits]);// Start and stop animation\nuseEffect(()=>{animationRef.current.id=requestAnimationFrame(updateAngles);return()=>{if(animationRef.current.id!==null){cancelAnimationFrame(animationRef.current.id);}};},[updateAngles]);// Reset angles when orbits change\nuseEffect(()=>{setAngles(orbits.map(orbit=>orbit.startingPoint));},[orbits]);// width and height of the component, not the zoomed size\nuseEffect(()=>{const updateSize=()=>{if(containerRef.current){const{width,height}=containerRef.current.getBoundingClientRect();// offsetWidth and offsetHeight instead of width and height\n// ignoring any scaling from zoom\nsetContainerSize(Math.min(containerRef.current.offsetWidth,containerRef.current.offsetHeight));}};updateSize();window.addEventListener(\"resize\",updateSize);const observer=new ResizeObserver(updateSize);if(containerRef.current){observer.observe(containerRef.current);}return()=>{window.removeEventListener(\"resize\",updateSize);if(containerRef.current){observer.unobserve(containerRef.current);}};},[]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor:\"transparent\"},children:orbits.map((orbit,i)=>{const diameter=orbit.size/100*containerSize;const radius=diameter/2;const angle=angles[i];const x=radius*Math.cos(angle*Math.PI/180);const y=radius*Math.sin(angle*Math.PI/180);const avatarUrl=orbit.avatar||\"https://picsum.photos/200/300\";return /*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:`calc(50% - ${radius}px)`,left:`calc(50% - ${radius}px)`,width:diameter,height:diameter,borderRadius:\"50%\",border:`${orbit.borderSize}px ${orbit.borderStyle} ${orbit.borderColor}`,boxSizing:\"border-box\",overflow:\"hidden\",backgroundColor:\"transparent\"}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:`calc(50% - ${orbit.avatarSize/2}px + ${y}px)`,left:`calc(50% - ${orbit.avatarSize/2}px + ${x}px)`,width:orbit.avatarSize,height:orbit.avatarSize,borderRadius:\"50%\",backgroundImage:`url(${avatarUrl})`,backgroundSize:\"cover\",backgroundPosition:\"center\"}})]},i);})});}addPropertyControls(OrbitingElements,{orbits:{type:ControlType.Array,title:\"Orbits\",defaultValue:[{size:50,speed:.3,avatarSize:44,startingPoint:0,avatar:\"\",borderSize:1,borderColor:\"rgba(0,0,0, 0.6);\",borderStyle:\"solid\"},{size:75,speed:.2,avatarSize:32,startingPoint:90,avatar:\"\",borderSize:1,borderColor:\"rgba(0,0,0, 0.4);\",borderStyle:\"dotted\"},{size:100,speed:.1,avatarSize:40,startingPoint:180,avatar:\"\",borderSize:1,borderColor:\"rgba(0,0,0, 0.2);\",borderStyle:\"dashed\"}],propertyControl:{type:ControlType.Object,controls:{size:{type:ControlType.Number,title:\"Circle (%)\",defaultValue:50,min:0,max:100,step:1},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:1,min:.1,max:10,step:.1},avatarSize:{type:ControlType.Number,title:\"Element\",defaultValue:50,min:0,max:200},startingPoint:{type:ControlType.Number,title:\"Start\",defaultValue:0,min:0,max:360},avatar:{type:ControlType.Image,title:\"Image\",defaultValue:\"https://picsum.photos/200/300\"},borderSize:{type:ControlType.Number,title:\"Border\",defaultValue:1,displayStepper:true,step:.5,min:0,max:10},borderColor:{type:ControlType.Color,title:\"\u200E\",defaultValue:\"#FFFFFF\"},borderStyle:{type:ControlType.Enum,title:\"\u200E\",options:[\"solid\",\"dashed\",\"dotted\"],optionTitles:[\"Solid\",\"Dashed\",\"Dotted\"]}}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"OrbitingElements\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"200\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"200\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./OrbitingElements.map"],
  "mappings": "qKAOmB,SAARA,EAAkCC,EAAM,CAAC,GAAK,CAAC,OAAAC,CAAM,EAAED,EAAYE,EAAaC,EAAO,IAAI,EAAO,CAACC,EAAcC,CAAgB,EAAEC,EAAS,CAAC,EAAO,CAACC,EAAOC,CAAS,EAAEF,EAASL,EAAO,IAAIQ,GAAOA,EAAM,aAAa,CAAC,EAAQC,EAAaP,EAAO,CAAC,GAAG,KAAK,SAAS,IAAI,CAAC,EAAQQ,EAAaC,EAAYC,GAAM,CAAKH,EAAa,QAAQ,WAAUA,EAAa,QAAQ,SAASG,GAAM,IAAMC,EAAQD,EAAKH,EAAa,QAAQ,SAASF,EAAUO,GAAYA,EAAW,IAAI,CAACC,EAAMC,IAAQ,CAAC,IAAIC,EAAc,OAAOF,KAASE,EAAcjB,EAAOgB,CAAK,KAAK,MAAMC,IAAgB,OAAO,OAAOA,EAAc,QAAQ,IAAIJ,EAAQ,QA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AAK,CAAC,EAAE,MAAM,CAAC,KAAKA,EAAY,OAAO,MAAM,QAAQ,aAAa,EAAE,IAAI,GAAG,IAAI,GAAG,KAAK,EAAE,EAAE,WAAW,CAAC,KAAKA,EAAY,OAAO,MAAM,UAAU,aAAa,GAAG,IAAI,EAAE,IAAI,GAAG,EAAE,cAAc,CAAC,KAAKA,EAAY,OAAO,MAAM,QAAQ,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,OAAO,CAAC,KAAKA,EAAY,MAAM,MAAM,QAAQ,aAAa,+BAA+B,EAAE,WAAW,CAAC,KAAKA,EAAY,OAAO,MAAM,SAAS,aAAa,EAAE,eAAe,GAAK,KAAK,GAAG,IAAI,EAAE,IAAI,EAAE,EAAE,YAAY,CAAC,KAAKA,EAAY,MAAM,MAAM,SAAI,aAAa,SAAS,EAAE,YAAY,CAAC,KAAKA,EAAY,KAAK,MAAM,SAAI,QAAQ,CAAC,QAAQ,SAAS,QAAQ,EAAE,aAAa,CAAC,QAAQ,SAAS,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC",
  "names": ["OrbitingElements", "props", "orbits", "containerRef", "pe", "containerSize", "setContainerSize", "ye", "angles", "setAngles", "orbit", "animationRef", "updateAngles", "te", "time", "elapsed", "prevAngles", "angle", "index", "_orbits_index", "ue", "updateSize", "width", "height", "window", "observer", "p", "diameter", "radius", "x", "y", "avatarUrl", "u", "addPropertyControls", "ControlType"]
}
