Now that my advent calendar is finished for this year, I wanted to post about the individual entries.
The code is kind of a mess, and evolved in an ad hoc kind of way, with some irregularities in the syntax of the function. It's not easy to teach a computer to draw like a kid! And sometimes I'd throw in a new function just to make the computations easier.
The project README.md (as seen on the github project page explains some of the typical logic I employed. There was some inconsistency to when I would use pushMatrix() and popMatrix() and translate() vs just drawing the primitive in a different location, a lot just depended on what animation or effect I was going for.
Day 1: Snake
Even though this is the first entry, it was made in the middle of the pack.
I think its sinusoidal motion came out rather well, not bad for an opener, given how limited the source material was. The way the snake moves to the mouse location was added later, when I realized I wanted every puppet to do something with "normal" mouse motion and something special on the mouse click.
I still don't know how many users of the site didn't realize something special would happen when you used the mouse button... or for that matter, that you could go back and forth to the "deconstructed" version by pressing the "Go" button that starts the thing off, and then flies to the upper corner and becomes a "<->" button.
Actually, the "Go" button neatly solved a problem I had on iOS, where the first click would be ignored- it's actually there to make sure the canvas has focus.
Springy motion is a crowd-pleaser, and easy to make: simple x-speed, y-speed, always attraction to the center (where the thread is nailed down) and always a gravity... a lot of tweaking so the thread was stretched to a reasonable at length when the thing was at rest.
I was able to leverage the http://kirkdev.blogspot.com/2013/09/seeker-and-you-shall-finder.html for this little guy.
At first it only did turn and move on button, but then I added turning just on mouse, in a similar spirit to adding stuff to the snake, so normal mouse behaviour had some puppet like effect.
Day 4: Chick
This was the second puppet I created, and honestly one of the most dull.
Mostly I wanted to prove that I could reuse the library I had stasted building up with the frog.
One of the final ones I created. Kind of cute, though without much of a puppet effect, and for the interaction I was hoping to get more of the visual effect of a coin reaching the end of its spin, right before it shudders to a stop.