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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cam3d

v1.0.6

Published

Minimal set of Perspective & Orthographic camera utilities

Downloads

12

Readme

cam3d

cam3d is a small module for working with 3D in WebGL, DOM, or 2D Canvas. It will be the basis for higher-level APIs down the road, but also stands on its own if you need basic 3D effects or low-level control over your scenegraph (e.g. working with Canvas gradients, clipping, etc).

code snippet

var cam = new PerspectiveCamera(fieldOfView, viewportWidth, viewportHeight);


cam.position.set(10, 50, -100); //change camera position
cam.lookAt(0, 0, 0); //Look at (0, 0, 0) origin
cam.up.set(0, 1, 0); //Adjust up-vector
cam.update(); //update matrices

... for WebGL ....
	//upload the Float32Array
	gl.uniformMatrix4fv(location, false, cam.projection.val); 

... for Canvas ...
	//project the 3D position into a 2D screen-space position
	cam.project( position, outVec );

	//draw something at that location
	context.fillRect(outVec.x, outVec.y, 10, 10);

docs

See the wiki for now.

live examples

Click the images to see the demos.

![Image](http://i.imgur.com/PaATBuK.png Window)
a rotating 3D window with snow outside -- source code

![Image](http://i.imgur.com/2svBxYp.png Window)
spinning 3D particles -- source code

roadmap

cam3d and its related modules (like vecmath) are still a work in progress; more documentation will be added soon.

The tools are intended to be decoupled from higher-level functionality, like WebGL features. If you are looking for a WebGL module, you can use these modules together with kami or another WebGL renderer. Some other modules that may be useful in the future:

  • Efficient sprite tinting for Canvas 2D (currently in development)
  • Higher-level 3D features, like depth-testing, texture-mapped triangles, lighting, etc.
  • A unified API for loading sprites with WebGL and 2D Canvas
  • Hit-detection and ray picking for 3D