An animation library for different types of liquids.
npm install solutionAn animation library for three.js that provides different kinds of liquid effects.
``sh`
$ npm install solution
`javascript
// 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);
}());
``