Shiny Contest Submission: ...Spirograph Toy

This emulates a Spirograph toy. Quite simple, but it shows how Shiny animation can be very engaging. An early version was my first Shiny project two years ago. The trick in this app is to get latency down to a minimum so the animation is smooth. Reactive functions are the key. Additionally,I precompute all the points of the figure before rendering any. This is pretty snappy even though you can change the ring sizes on the fly. Still, latency could be better. Try pausing the animation. It takes a couple seconds before it stops. I'd be grateful for any suggestions in reducing lag time.


Also, here's an interesting math puzzle. Given the three input parameters. ring 1 size, ring 2 size and position of the pen hole in ring 2 (expressed as a distance from the perimeter of ring 2), what is the minimum number of cycles needed to close the figure?

Code at rstudio cloud

Code at github

App at