-
Notifications
You must be signed in to change notification settings - Fork 1
Description
The current (initial) design is the simplest of several, and the worst performing. It has 15 of the core animation-time calc functions, named in the format _cNN(), and a noop() that fills the data array. Those 15 calcs call one of 4 functions that perform the basic math:
f()for factor aka multiplier:*a()for addend, a number added to the value with "+", generally equivalent to the animation's start valueMath.max()is already a functionMath.min()is already a function
So single property value/argument can run up to 4 calc functions, each running one of the 4 math functions, for 8 function calls total.
Also note: forEach loops are notoriously slower than other types of iterators. The calc functions rely on forEach to take advantage of how they skip empty array slots, and to simplify the code.
The best performing design would bloat the code and probably require being generated by script (via AI?) because it's too tedious for a human, certainly for me. The ideal would be for only 1 function to run each time, versus the current 8. That's a whole lot of permutations.
There is at least one intermediate step, which involves encapsulating all the different dimensionality into the permutations of the 4 math functions. The result would be 11 functions, each handling all the permutations of dimensionality:
#f()
#a()
#m()
#fa()
#fm()
#am()
#mm()
#fam()
#fmm()
#amm()
#famm()
Before embarking on any of that, baselines must be set and tests must be run to determine if it's worth it. My perspective is that, ideally, this code would be highly optimized so that the biggest, most complex animations could run as smoothly as possible. But this is a substantial amount of coding and even more testing, so I'm not expecting it any time soon.