bevel.js

Bevel.js 1.4 allows you to add bevels (and also shading, shining and glowing) to images on your webpages (alternatively: glossy.js). It uses unobtrusive javascript to keep your code clean.

It works in all the major browsers - Mozilla Firefox 1.5+, Opera 9+, Safari and IE6+. On older browsers, it'll degrade and your visitors won't notice a thing.

CVI-lab: Get a fast impression of the effects and their illustration qualities.

Demonstration

Shows some of the things "bevel.js" does.

candy
candy

Setting Up

Download "bevel.js" and include it into your webpage.

<script type="text/javascript" src="bevel.js"></script>

Using It

To make it bevel just add a class="bevel" to the image.

Classes

Scripting lib

If you want flexibility, use "cvi_bevel_lib.js" instead of "bevel.js". You can make your images respond to user actions (e.g. changing one or more options when the image is hovered over).

Set defaults using Javascript
cvi_bevel.defaultRadius = 20; //INT 20-40 (%)
cvi_bevel.defaultGlow = 33; //INT 1-100 (% opacity)
cvi_bevel.defaultShine = 40; //INT 1-100 (% opacity)
cvi_bevel.defaultShade = 50; //INT 1-100 (% opacity)
cvi_bevel.defaultGlowcolor = '#000000'; //STR '#000000'-'#ffffff'
cvi_bevel.defaultShinecolor = '#ffffff'; //STR '#000000'-'#ffffff'
cvi_bevel.defaultShadecolor = '#000000'; //STR '#000000'-'#ffffff'
cvi_bevel.defaultBackcolor = '#0080ff'; //STR '#000000'-'#ffffff'
cvi_bevel.defaultFillcolor = '#0080ff'; //STR '#000000'-'#ffffff'
cvi_bevel.defaultLinear = false; //BOOLEAN
cvi_bevel.defaultUsemask = false; //BOOLEAN
cvi_bevel.defaultNoglow = false; //BOOLEAN
cvi_bevel.defaultNoshine = false; //BOOLEAN
cvi_bevel.defaultNoshade = false; //BOOLEAN
If cvi_filter_lib.js is loaded also...
cvi_bevel.defaultFilter = null; //OBJ [{f='grayscale'},{f='emboss', s:1}...]

Add images using Javascript
cvi_bevel.add(image, options);
image should be an image element: document.getElementById("myimg")
options can contain one or more values: {radius: value, glow: value, shine: value, shade: value, glowcolor: value, shinecolor: value, shadecolor: value, backcolor: value, fillcolor: value, linear: value, noglow: value, noshine: value, noshade: value, usemask: value, filter: value }
Examples:
cvi_bevel.add(document.getElementById("myimg"), { radius: 50 });
<img onLoad="cvi_bevel.add(this, { radius: 50 });" ...>

Modify images using Javascript
cvi_bevel.modify(image, options);
If the image has already an effect but a option value has changed, the effect will be changed accordingly.
Example:
cvi_bevel.modify(document.getElementById("myimg"), { radius: 50 });

Remove effect from an image using Javascript
cvi_bevel.remove(image);

Support libs

If you are using the more flexible "cvi_bevel_lib.js" instead of "bevel.js", you'll get access to additional features by the following support libraries (part of distribution):

Why use Javascript Image Bevels?

In older browsers, the script degrades and your visitors won't notice a thing.

History

Version 1.4 Version 1.3 Version 1.2 Version 1.1 Version 1.0

License

Bevel.js is distributed under this LICENSE. License permits free of charge use on non-commercial and private web sites only under special conditions (as described in the license). This license equals neither "open source" nor "public domain". There are also Commercial Software Licenses available.

YOU AGREE TO ALL CONDITIONS OF THIS LICENCE AGREEMENT CONCERNING THE USE OF THE SOFTWARE BY ACCEPTING THIS LICENCE.
IF YOU DO NOT AGREE TO ALL CONDITIONS OF THIS AGREEMENT, YOU SHALL NOT INSTALL THE SOFTWARE, OR USE IT IN OTHER WAYS.

Images used are copyrighted and are used for demonstration only.

cvi.netzgesta.de  also visit  CVI-lab, S5 Reloaded and AJAX-FilmDB