I noticed I was unable to download a png of any of the frames of this… Does anyone know if I should be able to use gif.js to to record this animation while it plays? I was hoping someone could tell me if it is possible (and hopefully how!) before I start trying.
Amazing! Thank you so much. Though I am curious how you got the gif to record while playing through the months. I tried adding a scrubber to adjust the months but that caused the gif function to rerun every time the month changed.
Or perhaps you stitched the gif together after individually downloading each frame?
All parameters can be adjusted for each draw. The t argument that gets passed to the drawFrame callback goes from 0 to 1 (excluding 1; the number of steps is determined by the animation duration and the number of frames per second).
You can animate various parameters through t, e.g.:
// Step through all months, from 0 up to (but excluding) 12
month: Math.floor(t * 12),
// Wiggle around the offset .25 by a distance of -/+ .15
latitude: .25 + .15 * Math.cos((t+.3) * Math.PI * 2),
month ranges from 0 to 11. The ranges for latitude and rotation are arbitrary, but a delta of 1 means a full rotation for each of them.
Otherwise you’d miss the last step of the month progression. If you want to be on the safe side, you can write (t * 12) % 12. This also allows you to set a different starting month, e.g. (3 + t * 12) % 12.