import {BoxGeometry, MeshBasicMaterial, Mesh} from "https://unpkg.com/three@0.150.1/build/three.module.js"; import context from './3d.js' // Mapping export default { 1: () => addCube(), 2: () => addCube(), 3: () => addCube() } // Functions const addCube = () => { const geometry = new BoxGeometry(1,1,1); const material = new MeshBasicMaterial({color: 0xff0000}) const cube = new Mesh(geometry,material) cube.position.x = Math.random() * 10 - 5; cube.position.y = Math.random() * 10 - 5; cube.position.z = Math.random() * 10 - 5; context.scene.add(cube) }