{
  "name": "hello-world",
  "type": "registry:function",
  "description": "Renders an auto-rotating colored cube. A minimal Three.js setup to verify your 3dvf installation.",
  "dependencies": [
    "three"
  ],
  "devDependencies": [
    "@types/three"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "index.ts",
      "type": "registry:function",
      "content": "import * as THREE from \"three\";\n\n/**\n * helloWorld — renders an auto-rotating colored cube in a container element.\n * A minimal Three.js setup to verify your 3dvf installation is working.\n *\n * @param container - The DOM element to render into\n * @returns A dispose function that cleans up the scene, renderer, and animation loop\n */\nexport function helloWorld(container: HTMLElement): () => void {\n  const scene = new THREE.Scene();\n  scene.background = new THREE.Color(0x1a1a2e);\n\n  const camera = new THREE.PerspectiveCamera(\n    75,\n    container.clientWidth / container.clientHeight,\n    0.1,\n    1000\n  );\n  camera.position.z = 3;\n\n  const renderer = new THREE.WebGLRenderer({ antialias: true });\n  renderer.setSize(container.clientWidth, container.clientHeight);\n  renderer.setPixelRatio(window.devicePixelRatio);\n  container.appendChild(renderer.domElement);\n\n  const geometry = new THREE.BoxGeometry(1.2, 1.2, 1.2);\n  const material = new THREE.MeshPhongMaterial({ color: 0x4fc3f7 });\n  const cube = new THREE.Mesh(geometry, material);\n  scene.add(cube);\n\n  const ambientLight = new THREE.AmbientLight(0xffffff, 0.4);\n  scene.add(ambientLight);\n\n  const directionalLight = new THREE.DirectionalLight(0xffffff, 1);\n  directionalLight.position.set(5, 5, 5);\n  scene.add(directionalLight);\n\n  let animationId: number;\n\n  function animate() {\n    animationId = requestAnimationFrame(animate);\n    cube.rotation.x += 0.005;\n    cube.rotation.y += 0.01;\n    renderer.render(scene, camera);\n  }\n\n  animate();\n\n  function handleResize() {\n    camera.aspect = container.clientWidth / container.clientHeight;\n    camera.updateProjectionMatrix();\n    renderer.setSize(container.clientWidth, container.clientHeight);\n  }\n  window.addEventListener(\"resize\", handleResize);\n\n  return function dispose() {\n    cancelAnimationFrame(animationId);\n    window.removeEventListener(\"resize\", handleResize);\n    renderer.dispose();\n    geometry.dispose();\n    material.dispose();\n    container.removeChild(renderer.domElement);\n  };\n}\n"
    }
  ]
}