Instant.js 2.21 allows you to add an instant picture effect (including tilt) to images on your webpages (alternatively: slided.js or filmed.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.
Setting Up
Download "instant.js" and include it into your webpage.
// only if you want to use the annotation feature...
<script type="text/javascript" src="cvi_text_lib.js"></script>
// ...else this one only...
<script type="text/javascript" src="instant.js"></script>
Using It
To get the instant picture effect just add a class="instant" to the image (minimum dimension: 64x64).
Classes
Initialisation class "instant"
vary the shadow by adding ishadow followed by the desired opacity in percent:
Shadow opacity class "ishadow" - min=0 max=100 default=33
vary the frame by adding icolor followed by the desired color as hex:
Frame color class "icolor" - min=000000 max=ffffff default=f0f4ff
vary the tilt direction by adding one of the following:
Tilt direction class "itiltleft" or "itiltnone" or "itiltright"
by default "instant.js" cycles through [left|none|right].
prevent the shading by adding noshading:
Shading off class "noshading"
vary the border design by adding historical:
Frayed border class "historical"
prevent quadratic corner by adding nocorner:
Round corner class "nocorner"
preserve the image aspect ratio by adding preserve:
Image aspectratio class "preserve"
vary the annotation text by adding itxtcol followed by the desired color as hex:
Text color class "itxtcol" - min=000000 max=ffffff default=000000
get the text from alt attribute by adding itxtalt:
Text selection class "itxtalt"
get the text from title attribute by adding itxttitle:
Text selection class "itxttitle"
Scripting
If you want flexibility, use "cvi_instant_lib.js" instead of "instant.js".
You can make your images respond to user actions (e.g. changing one or more options when the image is hovered over).
First image with class = "instant itiltleft icolorFFFCE9 ishadow40 historical", next image with class = "instant nocorner itxtalt" and next two images with class = "instant itxtalt". All other images with class = "instant" only...
Why use Javascript Instant Image?
Fast and easy to implement. Just add class="instant" to the image and your good to go.
Don't need to spend time in an image editor creating an Polaroid™ image effect. *Polaroid is a trademark of Polaroid Corporation.
Works really well with forum avatars. Doesn't require additional server work.
It's dead easy to change the attributes of the images.
Free of charge use on non-commercial and private web sites.
In older browsers, the script degrades and your visitors won't notice a thing.
History
Version 2.21
IE8 modifications
Version 2.2
Added frayed border support
Version 2.1
Added round corner support
Version 2.0
Added text annotation support
Version 1.7
Changed algorithm for calculating border width
Version 1.6
Added better shading support for Internet Explorer
Version 1.5
Added support to preserve image aspect ratio
Version 1.4
Added scriptable lib version cvi_instant_lib.js
Version 1.3
Added soft shadow support for IE
Added noshading class
Version 1.2
Added support for img attributes: id alt title src onclick
Version 1.12
IE bug fixing
Version 1.11
Changed minimum dimension to 64x64
Version 1.1
Added support for Internet Explorer 6/7
Version 1.0
Initial Release
Credits
The inspiration for the script came from polaroid.rb.
License
Instant.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.