Javascript glint effect
Glint effect class is a standalone package or jquery plugin, that provides a way to add glint effect to HTML elements. It appends canvas to provided HTML element and generates glint effect based on provided configuration
Note: To make it work in IE9, you should use HMTL 5 Doctype. Simply put "<!DOCTYPE html>" in the beginning in your file
Contents
Download
Example codes
<html> <head> </head> <body> <style type="text/css"> #line { position:relative; width: 600px; left:50px; top:40px; height: 100px; background-color: red; font-size: 100px; } #line2 { position:relative; width: 100px; left:50px; top:40px; height: 600px; background-color: red; font-size: 100px; text-align: center; } </style> <!-- a line from A to B --> <div id="line"> Some text here </div> <div id="line2"> S<br/>o<br/>m<br/>e<br/> </div> <script type="text/javascript" src="./glint.packed.js" ></script> <script type="text/javascript"> var g1 = new glint("line"); var g2 = new glint("line2", {horizontal: false, angle: 135}); </script> </body> </html>
Examples in action
Method list
Constructor
| Method name | new glint(id, config); |
| Description | Add glint effect to HTML object |
| Input parameters | string id - id of element where to add glint effect json config - Json structure with configuration properties
|
| Example input | var g = new glint_effect("glint",
{
//how many pixels per interval to move
speed: 3,
//how often to move glint
interval: 10,
//pause after glint before another one
pause: 1000,
//size of glint
size: 100,
//red channel
r: 255,
//green channel
g: 255,
//blue channel
b: 255,
//angle of glint
angle: 45,
//density/maximal alpha channel
density: 255,
//horizontal or vertical
horizontal: true,
//from left to right or backward
forward: true,
//on error callback
onerror: function(){"Your browser doesn't support canvas"}
}); |
Latest changes
- 21. September, 2011 - Added on error callback support
- 22. September, 2011 - Fixed density bug, optimized, Jquery plugin added
You may also be interested in:
Powered by BlogAlike.com










