make a simple and fast viewport with camera and scene and render-loop for the three.js 3D library
Examples —
import * as THREE from 'three.module.js';
import Viewport from 'viewport.es.js'
const VP = new Viewport().VP.init().start();
//add new scene element
VP.scene.add( new THREE.Mesh( new THREE.BoxGeometry(10,10,10) ) );
see: https://i3ernie.github.io/three-viewport/examples/min.html
import * as THREE from 'three.module.js';
import Viewport from 'viewport.es.js'
let VP = new Viewport();
VP.init();
VP.start();
let box = new THREE.Mesh( new THREE.BoxGeometry(10,10,10) );
//add new scene element
VP.scene.add( box );
//animation with loop
VP.loop.add( function(){
box.position.x = box.position.x + .1
});
see: https://i3ernie.github.io/three-viewport/examples/animation.html