Scratch-Off
The open source repo for scratchy-lotto.com.
Drop a script tag on any page. Boom — it's a lottery ticket now.
Users scratch to reveal your content. It's dumb and delightful.
What you get
- Looks like a real scratch ticket (silver, shiny, the whole thing)
- Works on phones and desktop
- Makes scratchy sounds
- Little paint flakes fall off as you scratch
- Auto-reveals at ~60% scratched
- Zero dependencies
Install
Script tag. Done.
<script src="https://cdn.jsdelivr.net/npm/scratch-off@latest/dist/scratch-off.umd.js"></script>
Or npm if that's your thing:
That's it. It auto-runs.
How it works
- Scans your page
- Throws a scratch layer on top
- User scratches
- Particles fall
- 60% scratched = overlay fades
Dev stuff
npm install # setup npm run dev # dev server npm run build # build it
Outputs to dist/ in a few formats (ES, UMD, IIFE).
Browser support
Modern browsers. You're fine.
License
MIT
Contributing
Pull requests are welcome! If you have any ideas to improve this project, feel free to open an issue or submit a PR.