User guide
Try the two demos, then use the effect with your own images.
What's included
single/: one photo with one spectacles lens.multi/: variations with several images.
Try it
- Download the ZIP and unzip it.
- Serve the folder with any web server, for example
php -S localhost:8000ornpx serve. The demo files end in.phpbut contain only HTML and JavaScript. - Open
single/index.phpand move the mouse, or drag a finger, over the photo.
Use your own images
- Set the
srcof#myimageto the photo people see normally. - Set its
data-imgattribute to the image shown through the lenses. - To change the glasses, replace the lens shape (
img/black.png, used as a CSS mask) and the frame artwork (the SVG background).
Something unclear or missing? Tell us.