CanvasReflection, JavaScript, Canvas von Finn Rudolph
I was always interested if the pixel based canvas element is fast enough to provide client-side image reflections. This is my first experiment on that topic. You can try the demo and download the whole thing from GitHub.
Reflections are pretty simple with the canvas element (18 lines of code): Just create a canvas and set the height to the source image height plus the height of the reflection. Then draw the source image and a mirrored source image. Place a gradient over the mirrored image and set the globalCompositeOperation to destination-out.
The problem is, that if you want to scale the canvas you have to redo all the canvas drawing, since it is pixel based.

Icons by: FastIcon.com
Update: Also works nicely with eleven transparent PNG images.
24
Oct
2010
CanvasReflection.js - Client-side image reflections using the HTML5 canvas element
Stand: 12. Oktober 2008. Copyright 2006-2012 Finn Rudolph. Impressum.

