@ocio/three-camera-utils

2.5.2 • Public • Published

Install

npm i @ocio/three-camera-utils

Example

import * as THREE from 'three'
import OrbitControls from 'three-orbitcontrols'
import {
    changeRotation,
    changePosition,
    createLimitPan,
} from '@ocio/three-camera-utils'

const camera = new THREE.PerspectiveCamera(
    fov: 10,
    window.innerWidth / window.innerHeight,
    near: 1,
    far: 9999
)
const controls = new OrbitControls(camera, renderer.domElement);

// changeRotation
changeRotation({ angleV: 45, angleH: 45, distance:100, controls, camera });

// changePosition
changePosition({ x: 0, z: 0, camera, controls })

// limitPan
const limitPan = createLimitPan({ camera, controls, THREE });
controls.addEventListener("change", e => {
  limitPan({ maxX: 25, maxZ: 25 });
});

Demo

https://codesandbox.io/s/funny-bhabha-kjyfw

Readme

Keywords

none

Package Sidebar

Install

npm i @ocio/three-camera-utils

Weekly Downloads

4

Version

2.5.2

License

none

Unpacked Size

6.3 kB

Total Files

6

Last publish

Collaborators

  • enzo