three-trackballcontrols


A module for using THREE.TrackballControls with nodejs
Setup and Installation
Installation
npm install three-trackballcontrols
or yarn add three-trackballcontrols
Usage
Using as module
Example was using three.js
+ three-trackballcontrols
inside of a very simple React app.
import * as THREE from 'three';
import TrackballControls from 'three-trackballcontrols';
const controls = new TrackballControls(camera, renderer.domElement);
camera.position.z = 5;
controls.update();
const animate = function () {
requestAnimationFrame(animate);
controls.update();
renderer.render(scene, camera);
}
animate();
Using with CDN / static hosted three.js
Example uses JSDelivr version, look up the latest URL for using with static hosting.
<script type="module">
import TrackballControls from 'https://cdn.jsdelivr.net/npm/three-trackballcontrols@0.0.8/index.min.js';
const controls = new TrackballControls(camera, renderer.domElement);
camera.position.z = 5;
controls.update();
const animate = function () {
requestAnimationFrame(animate);
controls.update();
renderer.render(scene, camera);
}
</script>
To-Dos