lithree.js

1.0.1-alpha • Public • Published

NPM version npm

lithree.js

lithree.js is a lightweight 3D WebGL framework. It's just about 25kb. lithree.js is originally written in ES6 and is transcompiled to ES5.

When to use lithree.js

Well, LiThree is created for lightweight 3D projects. For example if you want to create a website to preview some simple product, It's not relevant to load some heavy library like three.js which is about 450kb.

Usage

You can check the demo here.

Make a world which will contain all your elements.

var world = new LiThree.World();

Create an object using object factories.

var sphere = LiThree.ObjectFactory.Sphere(1, 20, 20);

Add object to the world.

world.add(sphere);

Create a renderer.

var renderer = new LiThree.WebGLRenderer(640, 480, world);
renderer.initShapes();

Append canvas to body.

document.body.appendChild(renderer.canvas);

Attempt to draw and redraw canvas as many times as you want.

function redraw() {
    renderer.draw();
    requestAnimationFrame(redraw);
}
 
requestAnimationFrame(redraw);

Contribution

Feel free to help us and making a new awesome 3D library with ES6.

Package Sidebar

Install

npm i lithree.js

Weekly Downloads

2

Version

1.0.1-alpha

License

MIT

Last publish

Collaborators

  • mohebifar