I am now qualified to write screensavers.
Because there's a biorobotics meeting tomorrow (today, whatever) and it's nice to have some illustration that you have in fact done work since the last meeting, I hacked together a simple demo of the Bézier-spline interpolation for keyframe animation this evening.
(Incidentally, if anyone reading this thinks I'm using perfectly good kilobytes to record trivial details, that person is probably right. However, I have to document all my work at the end of the semester and this will serve nicely as a record to which I can later refer, in addition to allowing me to talk out my plans for the program and others to read them should they be struck by brain fever or something.)
Anyhoo... Bézier interpolation. Screensavers. Forward!
The demo is pretty stupid and has nothing in particular to do with cockroaches (as you can see below), but it has several other redeeming features: It was easy to program, for one. (Was it a Honda commercial that had the "things just work" line? That was this program.) In addition, the objects only move in one really obvious degree of freedom (the y axis), which makes seeing the difference quite easy; and the objects, being without joints or discrete parts, both move as whole bodies, which also helps make the motion discernible.
I would've taken video of this thing in action for reference, but it seemed like that would consitute work or something. I think I'll just save a copy of this particular program. The upshot is that the balls bounce up and down at the same average speed -- it takes a duration of x seconds for both to reach the apex, and the same for both to reach the nadir. The blue ball, however, its animation being linearly interpolated between the functional keyframes at top and bottom, never varies its speed. It occurred to me after I had this working that the blue ball looks, in essence, like a game of Pong. The red ball, on the other hand, is animated along a curved line, and demonstrates behavior reasonably similar to a ball in an idealized low-gravity environment. It slows toward the top of its motion and then accelerates toward the bottom.
The graphs at right show the calculated animation curves in the balls' respective colors. This was originally stuck in as an aid to debugging, which can be absolutely hellish in graphics programming. However, with Murphy's Law in full effect, the graphs turned out to be totally unnecessary. I left them since they make a nice gimmick and serve as a visual guide to what's going on. The balls, as indicated by the graphs, are currently in the downward portion of their cycle, and I think the blue ball is, if anything, a bit behind the red ball in terms of elapsed time from the upper keyframe -- yet you can clearly see that the blue ball is further down than the red, as it should be. (The balls, having been stopped and restarted, weren't necessarily in synchronization at this point: you can see their time positions as the left-right location of the white dots on the graphs.)
As you can clearly see, all I have to do is add a little shading and motion in other dimensions to this, and I'll have a perfectly functional Microsoft screensaver. This has been your trivial-detail post for the day.


Comments