Check out this amazing scratch-off reveal image animation using HTML5 canvas by Dudley Storey. This code snippet can be used in your web projects where you want to show the before and after effects or comparing photos taken at different time periods. In this snippet when you click and drag the mouse over the image, it will reveal another image beneath it, like a scratch card.
If you are having trouble with the pen, try the archived copy on GitHub
See the Pen Scratch Reveal with by Dudley Storey (@dudleystorey) on CodePen.0