You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
604 B
JavaScript

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)
}