{"version":3,"file":"Wireframecube.a0MXtBeg.mjs","names":["useRef","THREE.Scene","THREE.PerspectiveCamera","THREE.WebGLRenderer","THREE.IcosahedronGeometry","THREE.MeshBasicMaterial","THREE.Color","THREE.Mesh"],"sources":["https:/framerusercontent.com/modules/LftZuf1D0JPFTLSsLZe1/t5tzLIT6OeB0bc9GNmc6/Wireframecube.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef}from\"react\";import*as THREE from\"three\";export default function WireframeIcosahedron(props){const{elementSize=200,elementColor=\"#000000\",detail=0,spinSpeed=8,backgroundColor=\"transparent\",borderRadius=0,style}=props;const containerRef=useRef(null);const sceneRef=useRef(null);useEffect(()=>{if(!containerRef.current)return;const container=containerRef.current;const width=elementSize;const height=elementSize;// Scene setup\nconst scene=new THREE.Scene;const camera=new THREE.PerspectiveCamera(50,1,.1,1e3);camera.position.z=3;const renderer=new THREE.WebGLRenderer({antialias:true,alpha:true});renderer.setSize(width,height);renderer.setPixelRatio(Math.min(window.devicePixelRatio,2));renderer.setClearColor(0,0);container.appendChild(renderer.domElement);// Create icosahedron (20-sided polyhedron, like a d20 dice)\nconst geometry=new THREE.IcosahedronGeometry(1,detail);const material=new THREE.MeshBasicMaterial({color:new THREE.Color(elementColor),wireframe:true});const mesh=new THREE.Mesh(geometry,material);scene.add(mesh);// Animation\nconst rotationSpeed=2*Math.PI/spinSpeed;let lastTime=performance.now();function animate(){const currentTime=performance.now();const delta=(currentTime-lastTime)/1e3;lastTime=currentTime;mesh.rotation.y+=rotationSpeed*delta;mesh.rotation.x+=rotationSpeed*delta*.4;renderer.render(scene,camera);sceneRef.current.animationId=requestAnimationFrame(animate);}sceneRef.current={renderer,scene,camera,mesh,animationId:0};animate();return()=>{cancelAnimationFrame(sceneRef.current?.animationId||0);renderer.dispose();geometry.dispose();material.dispose();if(container.contains(renderer.domElement)){container.removeChild(renderer.domElement);}};},[elementSize,detail]);// Update color live\nuseEffect(()=>{if(sceneRef.current?.mesh){const material=sceneRef.current.mesh.material;material.color.set(elementColor);}},[elementColor]);return /*#__PURE__*/_jsx(\"div\",{style:{...style,width:\"100%\",height:\"100%\",background:backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",borderRadius,overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:elementSize,height:elementSize}})});}addPropertyControls(WireframeIcosahedron,{elementSize:{type:ControlType.Number,title:\"Size\",defaultValue:200,min:50,max:800,step:1,unit:\"px\",displayStepper:true},elementColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},detail:{type:ControlType.Number,title:\"Subdivisions\",defaultValue:0,min:0,max:4,step:1,displayStepper:true},spinSpeed:{type:ControlType.Number,title:\"Rotation (sec)\",defaultValue:8,min:1,max:60,step:.5,unit:\"s\",displayStepper:true},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"transparent\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:0,min:0,max:100,unit:\"px\",displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WireframeIcosahedron\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Wireframecube.map"],"mappings":"2RAA+J,SAAwB,EAAqB,EAAM,CAAC,GAAK,CAAC,cAAY,IAAI,eAAa,UAAU,SAAO,EAAE,YAAU,EAAE,kBAAgB,cAAc,eAAa,EAAE,SAAO,EAAY,EAAaA,EAAO,KAAK,CAAO,EAASA,EAAO,KAAK,CAI9P,OAJ+P,MAAc,CAAC,GAAG,CAAC,EAAa,QAAQ,OAAO,IAAM,EAAU,EAAa,QAAc,EAAM,EAAkB,EAAO,EAC9f,EAAM,IAAIC,EAAkB,EAAO,IAAIC,EAAwB,GAAG,EAAE,GAAG,IAAI,CAAC,EAAO,SAAS,EAAE,EAA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