Anaglyph (3D) Images with CSS Filters
What you need:
- a png with transparency
- CSS
- tolerance for flickering images
How it works: The image works through a method known as anaglyph imagery , which is essentially two layers, one red and one cyan, over an image. Because the eyes perceive the two colored images, they compress into one image, which creates a 3d effect.
CSS Filters (webkit- only) allow us to create drop-shadows, which unlike box-shadows, form to the contour of an image's alpha (transparent) channel. We create two layers (cyan and red) this way. Then, using CSS animations, we make the two layers shift back and forth at a rapid rate. This shift creates a 3-dimensional image.
Notes: Sometimes, parts of the anaglyph will show on the border. This doesn't work effectively for all images. It's easier to perceive 3D when the image is big. Please be cautious about using this for websites. Those with serious epilepsy may be triggered.