Closed AndrewRayCode closed 8 years ago
I just opened sourced https://github.com/DelvarWorld/easing-functions to address all of these issues and use the algorithms in an agnostic environment
I'm having a low of warnings when using it JSHint and Gulp. The quality could be improved.
EDIT: Made some changes to the code so now it passes JSHint without errors nor warning https://gist.github.com/nonameolsson/4cefaa34a6dbc7b12e05c4f7cad55fc5
Fixed in 1.4
The source code of this library is written as if it were minified code, and it also has lots of redundant logic problems. I'm trying to expand this into non-jQuery functions to use in another library which is why I've discovered these cases.
For example these lines of code:
https://github.com/gdsmith/jquery.easing/blob/master/jquery.easing.js#L104-L111
There's a few things here that are undesirable in source code:
var p = 0;
and then checksif (!p) p=d*(.3*1.5);
. Things like this could be avoided for efficiency, and make the source code more readable.var s=1.70158;
and thenelse var s =
you can sees
is redefined incorrectly using a secondvar
declarationif ((t/=d/2)==2)
which mutates the variablet
in place, making tracing code unnecessarily difficult.Since these functions have clearly stood the test of time the logic in them is sound and doesn't need to change for the library to work. For a learning opportunity, however, there is much room for improvement.