glsl-barrel-pincushion
v1.0.3
Published
Distort UV using barrel or pincushion
Downloads
22
Maintainers
Readme
glsl-barrel-pincushion
Distort the UV with barrel or pincushion effect. Adapted from this shadertoy.
Installation :package:
npm i glsl-barrel-pincushion -S
Usage :book:
barrelPincushion(vec2 st, float strength)
strength > 0 for barrel distortion, strength < 0 for pincushion.
Example :floppy_disk:
uniform float uTime;
#pragma glslify: barrelPincushion = require(glsl-barrel-pincushion)
#pragma glslify: rectangle = require(glsl-2d-primitives/rectangle)
attribute vec2 vUv;
void main() {
vec2 st = barrelPincushion(vUv, sin(uTime));
float shape = rectangle(st, vec2(0.5));
gl_FragColor = vec4(color, shape);
}
License :pencil:
MIT. See LICENSE for details.