where: p is the speed of the switch (Higher is slower),
q is pattern #1,
and Q is pattern #2.
The cos(...)+1 part in both sections is in charge of timing. In the second part we subtract pi * p, which is half the period, from time to make it start at the half point of the cycle.
Speeding it up (increase the first "time" to "time^9") you can see that it eventually "heats up" all the way to black, but it's a nice journey.
Edit: also this one has a nice strobe. You can strobe any pattern you make by replacing a time with some variant of B*sin(time/C) where B and C are appropriately chosen coefficients.
Fan is (y-50)/(x-50)+time/5, sin is to add texture. Multiplying x by cos and y by sine of the same frequency would simply rotate the fan centre around top right corner, slightly off periods (19 and 21) degenerate that circle into a more interesting Lissajous curve.
fantastic effect! One of my favorites today, thank you. Quick question - do you think that I should refine the gallery formatting to include attribution? It's a bit of a "discovery vs invention" type quandary
Just wanted to mention, that gallery link is barely noticeable because of the blue color. I didn't notice it on multiple visits till you mentioned there was a gallery.
good idea! this project was partially inspired by math classes spent in high school plotting pretty polar functions on my graphing calculator instead of paying attention to trigonometry... I'm not sure that mojulo in it's current form will be a useful educational tool but I think that toys similar to this are a great way to impress upon kids a sense of different functions they usually only encounter on paper
http://maxbittker.github.io/Mojulo/#MTAgICsgMTY1ICogc2luKDIu...