Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
orbit-controls
Advanced tools
Readme
Generic controls for orbiting a target in 3D. Can be used to control a camera, a 3D ray, or anything with { position, direction }
.
Features:
Roadmap:
Can be used with any camera abstraction that uses position
and direction
to form the view matrix, including ThreeJS, Babylon, stackgl, etc.
Well-suited alongside perspective-camera.
Note: This module is still in development.
var controls = require('orbit-controls')()
function tick () {
controls.update()
controls.copyInto(camera.position, camera.direction, camera.up)
}
controls = createControls([opts])
position
the initial position of the camera, default [0, 0, 1]
up
the initial direction of the camera, default [0, 1, 0]
target
the center of the orbit, default [0, 0, 0]
phi
the initial rotation in radians, phi in spherical coordinates, default Math.PI/2
theta
the initial rotation in radians, theta in spherical coordinates, default 0
distance
the distance from the target, default 1
damping
how fast the controls slow down, between 0
and 1
, default 0.25
rotateSpeed
the speed of the rotation, default 0.28
zoomSpeed
the speed of the zoom, default 0.0075
pinchSpeed
(coming soon) the speed of the pinch, default 0.0075
pinch
(coming soon) enable pinching, default true
zoom
enable zooming, default true
rotate
enable rotating, default true
phiBounds
the bounds of the phi rotation, default [0, Math.PI]
thetaBounds
the bounds of the theta rotation, default [-Infinity, Infinity]
distanceBounds
the bounds of the distance, default [0, Infinity]
parent
the parent element, default window
element
the element, default window
controls.update()
Update the internal position, direction, and up vectors that represent the camera.
controls.copyInto(position, direction, up)
Apply the control's current state to a target camera.
This is purely for convenience; you can also copy the controls.position
and other members manually.
controls.enable()
Enables the DOM events and input, attaching new mouse and touch events. If already enabled, this function does nothing.
controls.disable()
Disables the DOM events and input, detaching all events. If already disabled, this function does nothing.
position
, direction
, up
Vector arrays [x, y, z]
that represent the camera controls. These are typically copied into your camera interface with:
var camera = new MyPerspectiveCamera()
controls.copyInto(camera.position, camera.direction, camera.up)
target
The vec3 center of the orbit
phi
, theta
The initial rotation in radians, in spherical coordinates. Changing either will re-calculate the direction.
distance
The distance from the target, default 1
damping
How fast the controls slow down, between 0
and 1
, default 0.25
rotateSpeed
, zoomSpeed
, pinchSpeed
The speed of the controls.
pinch
, zoom
, rotate
Enable pinch, zoom, and rotate
phiBounds
, thetaBounds
, distanceBounds
The bounds of the controls
dragging
(read-only)Returns true if the user is currently dragging the controls.
pinching
(read-only)Returns true if the user is currently pinching (zooming on mobile) the controls.
MIT, see LICENSE.md for details.
FAQs
generic controls for orbiting a target in 3D
The npm package orbit-controls receives a total of 695 weekly downloads. As such, orbit-controls popularity was classified as not popular.
We found that orbit-controls demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.