-
Notifications
You must be signed in to change notification settings - Fork 12k
Move easing effects in separate file + unit tests #4475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a95da17 to
6cdd6d0
Compare
etimberg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments. Other than that, it looks good 👍
| }, | ||
|
|
||
| easeInExpo: function(t) { | ||
| return (t === 0) ? 0 : Math.pow(2, 10 * (t - 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this changed when t === 0. Was that intentional? The old version was
easeInExpo: function(t) {
return (t === 0) ? 1 : 1 * Math.pow(2, 10 * (t / 1 - 1));
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was incorrectly adapted from the original method:
// t: current time, b: start value, c: end value, d: duration
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
}All these methods assume b == 0 and c == 1 and d == 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, ok. Good catch!
src/helpers/helpers.easing.js
Outdated
| return 1; | ||
| } | ||
| if (!p) { | ||
| p = 1 * 0.3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we simplify this too as p = 0.3?
src/helpers/helpers.easing.js
Outdated
| if (!p) { | ||
| p = 1 * 0.3; | ||
| } | ||
| if (a < Math.abs(1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also remove Math.abs(1) too
src/helpers/helpers.easing.js
Outdated
| return 1; | ||
| } | ||
| if (!p) { | ||
| p = 1 * 0.3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as previous function
src/helpers/helpers.easing.js
Outdated
| if (!p) { | ||
| p = 1 * 0.3; | ||
| } | ||
| if (a < Math.abs(1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as previous function
src/helpers/helpers.easing.js
Outdated
| return 1; | ||
| } | ||
| if (!p) { | ||
| p = 0.3 * 1.5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we change this to p = 0.45 ?
src/helpers/helpers.easing.js
Outdated
| if (!p) { | ||
| p = 0.3 * 1.5; | ||
| } | ||
| if (a < Math.abs(1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as previous function
Also removed
1*,/1and replace1/2by0.5