JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://www.echou.xyz/taro/build/taro.js"></script>
CSS
body { margin: 0; }
canvas { width: 100%; height: 100% }
JavaScript
var app = new TARO.App();
document.body.appendChild( app.domElement );
var scene = new TARO.Scene();
app.setScene(scene);
class CubeController {
init() {
// fires when the component is attached to an entity
this.rotation = this.entity.rotation;
}
update() {
// fires once per frame
this.rotation.x += 0.01;
this.rotation.y += 0.01;
}
}
TARO.registerComponent('cubeController', CubeController);
var cube = new TARO.Entity('cube');
cube.addComponent('material', { color: 0x00ff00 });
cube.addComponent('geometry', { type: 'box' });
cube.addComponent('cubeController');
var camera = new TARO.Entity('camera');
camera.position.z = 5;
camera.addComponent('camera');
app.start();