Closed pixelzoom closed 4 years ago
Doc for the t
parameter is also not helpful, does not describe what it is:
@param {number} t - Should be in the range [0,1].
Doc at the top of the file says "These should be equivalent to the polynomial tweens that TWEEN.js uses." Plowing through TWEEN.js website, I finally found Ease documentation:
The Ease class provides a collection of easing functions for use with TweenJS.
It does not use the standard 4 param easing signature. Instead it uses a single
param which indicates the current linear ratio (0 to 1) of the tween.
I factored out tIsValid
:
/**
* Verifies that t is valid.
* @param t - The linear ratio [0,1] of the animation
* @returns {boolean}
*/
function tIsValid( t ) {
return typeof t === 'number' && isFinite( t ) && t >= 0 && t <= 1;
}
And the 9 assertions now look like:
assert && assert( tIsValid( t ), `invalid t: ${t}` );
No unit tests (see #23) so I tested a few sims that use Easing
.
@jonathanolson please review.
It's been almost 1 year since a review was requested. So I'm going to just go ahead and close this.
CT recently reported a transient failure of this assertion in
Easing
:There's no assertion message, so no idea what was wrong with
t
that made this fail. And this same assertion expression is repeated 9 times.TODO: factor out the expression and add a message.
@jonathanolson FYI.