Reproducing A Clever Animation Product, Part 22

I want to make the handling of the mMethod parameter in the bcDefineWhateverTween function more flexible and modular. As you can see in the code below, the parsing of the different types of methods or applied effects has to be handled in every tween definition. Even worse, the code all has to be peeled apart and processed in every individual case.

Therefore, I’m going to try to define a wrapper function that takes the mMethod parameter, and the values for pStart, pEnd, alpha, omega, and i, and return the desired output value for that animation step. I think we’re giving up the need to peel apart the mMethod during every call in order to get a more streamlined expression where the animation step values are assigned and the ability to have to only use a single copy of the code in all tweens.

Note that this approach is expected to work for numeric tweens. It is not necessary for tweens that merely change state in a single step (like the display CSS parameter). This approach may or may not prove troublesome for other types of tweens.

I’m thinking the new version of the bcDefineWhateverTween function should look like this:

Note that in the first example, in the code as it currently exists, that the left parameter is incremented in the linear case and set absolutely in the vibrate_right case. We therefore have to come up with a consistent treatment for generating results with the proposed processEffect function. I believe it will be preferable to generate the result in a form that can be used in an absolute assignment.

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

Leave a Reply