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
Animation: Add interpolation functions #128
Comments
This would be useful for #121 as well |
@bryphe I added the type for easing into the record and defined linear, quadratic, and cubic. What part of Animation.re needs to be changed so that we use easing instead of default linear |
@Bretley - awesome! Would you mind posting up a PR of what you have so far? I can help point out the place we need to change to integrate the new easing functions |
@Bretley are you still working on this? |
@Bretley @albertorestifo A PR for "scroll bouncing" landed yesterday that added some missing easing functions to Lines 58 to 63 in ec5ca4e
The actual calculation of the values was put into a separate repo, at least temporarily, just because it could be useful for other folks (and I needed at some point a "clean slate" to properly test it, think about it, and understand what was going on with some nasty bugs 😅 ): https://github.com/jchavarri/rebez. There is some functionality to tween and also "chain" different animations, that can be seen in the tests. Sorry about that, I didn't realize there was an issue about easing. Having said so, I think the @bryphe Not sure if the spring animations work would deserve a new issue though? as this one was explicitly targeting easing functions. |
@jchavarri - amazing work! Thanks for implementing the remainder of easing functions.
I would love to have spring-based motion (some of those demos are really impressive for react-spring / popmotion - especially how little code it takes to get nice effects). I did log an issue previously in #131 - but it might be a bit too opionionated (maybe In the meantime, sounds like the work here is done between #149 and #315 , so we can close this one out 👍 |
Issue: Today, all our animation infrastructure uses a 'linear' easing function.
This happens in our
getLocalTime
method - we're implicitly using the linear easing function which is justt => t
. However, linear easing is not very visually appealing - usually you want an easing style animation which more closely replicates a physical model.The proposal is to add an additional parameter,
easing
to our animation options:https://github.com/bryphe/revery/blob/e024382f2631ac2026f129c52091e410c5e7a29a/src/UI/Animation.re#L27
This would be simply a function of
type easingFunction: float => float
.The user could define their own easing function, or we could have some defaults:
linear
step(boundary)
would bet => t < boundary ? : 0.0 : 1.0
quadratic
would bet => t * t
cubic
would bet => t * t * t
easeIn
easeOut
easeInOut
The text was updated successfully, but these errors were encountered: