Lens Flare effect component
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
LensFlare.js
README.md

README.md

JS.LensFlare

Lens Flare effect component. Relies on the Greensock TweenLite library. Not dependent on external graphical resources.

All assets are generated on the fly with pure javascript using the HTML5 Canvas element.

Current Filesize: 6KB, Compiled: 1.6KB gzipped (3.66KB uncompressed)

Blog: http://www.foumartgames.com/blog/6-JavaScript-HTML5-Canvas-Lens-Flare.html

JSfiddle Demo: https://jsfiddle.net/Foumart/mtos60jd/

Usage:

var lensCanvas = LensFlare.init(bgrImage, width, height, customLensArray, lensGenerated);

function lensGenerated(e){
	lensCanvas.play(startX, startY, destinationX, destinationY, duration, central);
}

Returns a canvas element with integrated play() method.

Global methods:

LensFlare effect initialization.

LensFlare.init(bgrImage, width, height, flaresData, generated, finished)

Generic function for drawing an image to canvas.

LensFlare.drawToCanvas(canvas, img, width, height, clear, operation, x, y, alpha)

Generic function for canvas generation.

LensFlare.generateCanvas(width, height)