solution
v0.1.1
Published
An animation library for different types of liquids.
Downloads
44
Maintainers
Readme
Solution
An animation library for three.js that provides different kinds of liquid effects.
Installation
$ npm install solution
Usage
// Attention: Three is not yet an ES6 module!
import {
WebGLRenderer,
PerspectiveCamera,
PlaneBufferGeometry,
TextureLoader,
Constants,
Scene,
Mesh
} from "three";
import { LavaMaterial } from "solution";
var renderer = new WebGLRenderer();
var camera = new PerspectiveCamera();
var scene = new Scene();
var geometry = new PlaneBufferGeometry(1, 1);
var mesh = new Mesh(geometry, null);
var textureLoader = new TextureLoader();
textureLoader.load("textures/noise.png", function(texture) {
texture.wrapS = texture.wrapT = Constants.RepeatWrapping;
mesh.material = new LavaMaterial(texture);
mesh.material.uniforms.offsetRepeat.value.set(0, 0, 75, 75);
mesh.rotation.set(-Math.PI / 2, 0, 0);
mesh.scale.set(2000, 2000, 1);
scene.add(mesh);
});
camera.position.set(0, 30, 50);
camera.lookAt(scene);
(function render(now) {
renderer.render(scene, camera);
requestAnimationFrame(render);
}());
Included Effects
- Distortion Droplet Filter
- Planar Water (WIP)
- Oceanic Water
- Waterfall
- Lava
Documentation
Contributing
Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
License
This library is licensed under the Zlib license
The original lava shader
was written by nimitz and is licensed under a
Creative Commons license