Skip to content

Instantly share code, notes, and snippets.

@mitchallen
Created December 16, 2021 03:10
Show Gist options
  • Save mitchallen/ff1c43260715cb583252e49d7625f332 to your computer and use it in GitHub Desktop.
Save mitchallen/ff1c43260715cb583252e49d7625f332 to your computer and use it in GitHub Desktop.
ThreeJS cube example snippet
var cubeOptions = [
{ color: "#FF0000" },
{ color: "#00FF00", width: 0.5, height: 2, depth: 0.5 },
{ color: "#0000FF", width: 2, height: 0.5, depth: 0.5 },
{ color: "#FF00FF", width: 0.5, height: 0.5, depth: 2 },
{ color: "#FFFF00", translateX: 3.0 },
{ color: "#FF6619", translateX: -3.0 },
{ color: "#AAAAAA", translateY: 2.0, translateZ: -0.05, width: 0.5, height: 0.5, depth: 2 },
{ color: "#04D9FF", translateY: -2.0, translateZ: 0.05, width: 0.5, height: 0.5, depth: 2 },
];
cubeOptions.forEach(options => scene.add(CubeFactory.create(options)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment