dz

0.0.3 • Public • Published

DZ is A small library for making 3D fun with D3

WARNING: this is a very new (and likely unstable) project. use as your own risk.

DZ takes data in 3 dimensions and transforms it to 2 dimensions.

DZ(3d) -> 2d

Demos

all these demos use SVG

Installation

just download dz.js and include it into your HTML

  <script src="dz.js"></script> 

or, install via npm

npm install dz

Example

Here's a quick sample. Checkout example/orbit.html for a simple fully working demo.

// create a new projection
var perspective = dz.projection.perspective()
 
// and configure the camera (aka, the "eyeball")
perspective.camera().position([0, 0, 1]).lookAt([0, 0, 0])
 
// create some 3d data
var data = [0, -1, -0.5] // a point at (0, -1, -0.5)
 
// projection of your data point onto the camera "film"
perspective(data) // -> [x, y]
 
// or also
 
perspective.x(data) // x coordinate of the 3D -> 2D projection
perspective.y(data) // y coordinate of the 3D -> 2D projection
 

No documentation yet so for now have a look at the source code

Readme

Keywords

none

Package Sidebar

Install

npm i dz

Weekly Downloads

1

Version

0.0.3

License

BSD

Last publish

Collaborators

  • vicapow