npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

first-person-camera

v1.1.0

Published

A generic first person camera for WebGL.

Readme

first-person-camera

A generic first person camera for WebGL.

first-person-camera

example

var createCamera = require('first-person-camera')

var viewer = require('mesh-viewer')({
  clearColor: [0.2, 0.3, 0.8, 1],
  pointerLock: true,
})

var bunny

viewer.on('viewer-init', function() {
  this.camera = createCamera()
  bunny = this.createMesh(require('bunny'))
})

viewer.on('gl-render', function() {
  bunny.draw()
})

viewer.on('tick', function() {
  if (this.pointerLock) {
    this.camera.control(this.frameTime, [
      this.down('W'), this.down('S'),
      this.down('A'), this.down('D'),
      this.down('space'), this.down('shift'),
    ], this.mouse, this.prevMouse)
  }
})

install

npm install first-person-camera

api

var createCamera = require('first-person-camera')

var camera = createCamera(opts)

Create a first person style camera. Each of the following options are optional:

  • position {vec3} Initial position of the camera.
  • rotation {vec3} Initial rotation of the camera.
  • positionSpeed {float} The speed in which the position moves.
  • rotationSpeed {float} The speed in which the camera rotates.

camera.position

A vec3 or [x,y,z] of the position of the camera. The position can be obtained or set manually through this property.

camera.rotation

A vec3 or [x,y,z] of the rotation of the camera in radians. The rotation can be obtained or set manually through this property.

camera.control(frameTime, direction, mouse, prevMouse)

A convenience method for connecting controls to the camera.

  • frameTime The delta time that has changed in milliseconds.
  • direction Array of booleans in which direction to move: [forward, backward, left, right, up, down]
  • mouse Array of [x,y] coordinates of the current mouse position.
  • prevMouse Array of [x,y] coordinates of the mouse position from the previous frame.

camera.move(direction)

Moves the camera by the direction [x,y,z].

camera.pointer(mouse, prevMouse)

Rotates the camera based on the mouse vector. Both mouse and prevMouse are [x,y] coordinates.

camera.view([out])

Retrieve the view matrix for the camera.

license

(c) 2015 Kyle Robinson Young. MIT License