velox3d
Version:
**velox3d** is a lightweight Three.js scene initializer with built-in best practices, clean defaults, and extensibility. It gives you a powerful 3D setup with just one function call — ideal for beginners and fast prototyping, but flexible enough for advan
15 lines (12 loc) • 430 B
JavaScript
import * as THREE from "three";
export function addCube(scene, options = {}) {
const size = options.size || 1;
const geometry = new THREE.BoxGeometry(size, size, size);
const material = new THREE.MeshStandardMaterial({
color: options.color || "skyblue",
});
const cube = new THREE.Mesh(geometry, material);
cube.position.set(...(options.position || [0, 0, 0]));
scene.add(cube);
return cube;
}