Hi,
I don’t have an example of the code, as I’ve not implemented anything exactly like what you’re after. We’ve given you a couple of links, and some thoughts on how to approach the problem, so the best way forward is to have a go at what you want, and then come back and post on here with what you’ve done. Then we’ll be able to give specific tips and suggest edits to your code where/if you run into problems.
Good luck, and I look forward to seeing what you come up with!
Cheers,
Simon