Reproducing A Clever Animation Product, Part 8

I found it necessary to create a list of elements that will be transformed during the animation. Within each list of elements there will be a sublist of transform types. Within each list of transform types there will be a list of the actual transforms. Element zero of the first two dimensions of the array will contain the name of the element and transform type, respectively.

The first set of calls should be to define the transforms as the programmers thinks of them. Once all the transforms are defined the code sweeps through the list and, where it finds multiple transforms of a specific type for a specific element, reorders that list of transforms by starting time.

I’m assuming that later transforms (in list of like transforms for a given element) will determine the state of the element from their beginning in time through to the end of the animation. It will not be possible to embed transformation streams. For example, if stream A runs from 3.0 seconds to 9.0 seconds and stream B runs from 5.0 seconds to 7.0 seconds, the states defined by stream B will apply from 5.0 seconds to the end of the animation. The animation will not use the values from stream A from 7.0 to 9.0 seconds. There has to be a rule and this is the one I’m choosing. It has the virtue of being simple while also allowing anything to be done at any time.

The code will look something like this. I haven’t got time to debug it today; that will be tomorrow’s project and I’ll post any mods I make then (the chances of this being perfect as is are somewhere between zero and nothing…). Once I know this works I can readjust the previously existing functions to write out the transformation streams.

Once I get this working it should enable me to come up with a better way to specify starting times for each transformation stream. The Greensock product allows the programmer to specify starting times relative to other events and not necessarily in absolute terms, which (as they point out here) is cumbersome to keep track of and modify efficiently. The product also supports a flexible, shorthand notation for specifying transformations of increasing complexity, assuming default values for parameters not supplied. It appears to do this using function parameters in something like the object literal format.

This entry was posted in Tools and methods and tagged , , . Bookmark the permalink.

Leave a Reply