WebGL Heatmap
This is a fork of Florian Boesch's excellent WebGL Heatmap to support CommonJS and and to make it available from NPM. To install it run:
npm install webgl-heatmap
webgl-heatmap is a JavaScript library for high performance heatmap display.
Demo
Live Demo at codeflow.org
How to use it
Instantiate a new heatmap, errors can be one of:
- Webgl is not supported
- No floating point texture support
- Floating point render target not supported
- Shader Compile Error: ...
- Shader Link Error: ...
try var heatmap = canvas: yourCanvas;catcherror // handle the error
creation arguments
- canvas: the canvas you wish to draw on
- width: explicit width
- height: explicit height
- intensityToAlpha: defaults to true
- gradientTexture: texture used instead of color calculation, can be path or an image
Add a data point.
- x and y relative to the canvas in pixels
- size in pixels (radius)
- intensity between 0 and 1
heatmap;
Add a list of data points.
- x and y relative to the canvas in pixels
- size in pixels (radius)
- intensity between 0 and 1
heatmap;
Draw queued data points:
heatmap
Display the heatmap
heatmapdisplay
Multiply all values in the heatmap by a number (useful for decay)
heatmap
Clamp all values in the heatmap to between two values:
heatmap
Blur all values a little:
heatmap