-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add pow easing function #604
Conversation
Awesome! |
src/Easing.ts
Outdated
Out(amount: number): number | ||
InOut(amount: number): number | ||
} { | ||
power = power < 1.0 ? 1.0 : power |
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.
Just curious, why not allow numbers less than 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'm imagining that with a number less than 1, for example generatePow(0.3).InOut
, the user can animate as if some fast-moving object comes into the view, then the "film speed" is slowed down and the object is in slow motion, then the "film speed" is sped back up to normal speed and the moving object takes off out of the view at full speed.
With a more exaggerated number like 0.1
, it could be as if a "UFO" was caught on camera: it comes into view and slows down very quickly, then suddenly accelerates out of view.
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.
@trusktr
Thanks for your advice.
I had misunderstood that easing breaks when power is below 1.
https://www.desmos.com/calculator/in8brckvcq
After checking, I found a beautiful curve in range of 0.0 < power < 1.0.
Pow easing curve breaks down when power is below zero.
I will modify conditions to 0.0 < power.
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.
nice!
Hello @MasatoMakino! I can't find a value for It would be awesome to get the same effect as our current Exponential, but without the jump (start 0 end 0). Here's a video showing close-but-not-exactly.mp4 |
Hello @trusktr. First of all, please note that https://www.desmos.com/calculator/xbgt04gh4v A parameter of 5.8 is the value at which the intersection of the two curves is at the center. I hope this information will help you. |
Related Issues
Purpose of this Pull Request
This PR is for adding an easing function that has no jitter and a sharp curve like
TWEEN.Easing.Exponential
.Details of the changes
TWEEN.Easing.generatePow()
function.TWEEN.Easing.generatePow()
function the changes sharpness of a curve depending onpower
argument. This approach is the same as the expo easing function in popmotion.GSAP calls the similar easing function Power1 ~ 4. Also, CreateJS/TweenJS internally calls this easing function getPowIn, Out, InOut. Following these precedents, I named this function generatePow.