Cube in Babylon.js
Babylon.js Hispano
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/babylonjs/2.3.0/babylon.js"></script>
<canvas id="main"></canvas>
<script src="https://stemkoski.github.io/Three.js/js/Stats.js"></script>
CSS
html, body, canvas{
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
JavaScript
var canvas = document.getElementById("main");
var engine = new BABYLON.Engine(canvas);
var scene = new BABYLON.Scene(engine);
scene.clearColor = new BABYLON.Color3(0.6,0.6,0.6);
// STATS
var stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.bottom = '0px';
stats.domElement.style.zIndex = 100;
document.body.appendChild( stats.domElement );
function renderLoop(){
for(var i = 0; i<boxes.length; i++){
boxes[i].rotation.x += 0.01;
boxes[i].rotation.y += 0.01;
}
stats.update();
scene.render();
}
engine.runRenderLoop(renderLoop);
var camera = new BABYLON.FreeCamera("camera", new BABYLON.Vector3(0,0,-10),scene);
var light = new BABYLON.PointLight("light", new BABYLON.Vector3(10,10,0),scene);
var boxes = []
for(var i = 0; i<100; i++){
var box = new BABYLON.Mesh.CreateBox("box",2,scene);
box.rotation.x = -0.2;
box.rotation.y = -0.4;
boxes.push(box)
box.material = new BABYLON.StandardMaterial("material",scene);
box.material.emmisiveColor = new BABYLON.Color3(0, 0.58, 0.86);
}