-
Notifications
You must be signed in to change notification settings - Fork 435
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
Additional easing functions #2080
Conversation
Currently, all other ease functions have three versions: in, out and in-out. Is there a reason |
Short answer: both of those are Longer answer: It's based on how those two functions are defined. Not sure how familiar with calculus you are, but
|
Right... This kind of messes with how the UI is set up in the FlxTween demo. :P |
We should probably use a flat list of ease modes and get rid of that second dropdown for in / out / in-out. Can you make a PR for that (unless you can think of a better solution)? |
Maybe disabling/ignoring that dropdown and setting
Edit: Unless |
I thought about that solution too, but it doesn't seem very elegant / seems quite messy. No need for special cases like that if you have a flat list. |
Surely in and out versions are still possible... The in version would
effectly be 2f(t/2) and out would be 2f(t/2+0.5)-1?
…On 18 Jun 2017 09:33, "Jens Fischer" ***@***.***> wrote:
I thought about that solution too, but it doesn't seem very elegant /
seems quite messy. No need for special cases like that if you have a flat
list.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2080 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACbEvEd5XZa3r9NU9sl-c6y1cNP7InJ2ks5sFODSgaJpZM4N5FmN>
.
|
I mean at that point, you're manufacturing functions that don't already exist in the field of computer science, as far as I'm aware. Plus, if doing that math causes the derivative stuff to change at all, then they're not |
This math wouldn't change the derivatives on the relevant sides. I.e at 0 the ease in functions would maintain the same derivatives and at 1 the rase out would. All the math does is chop was is the easeInOut function in half so that it's possible to only use the curve in or curve out. SmoothStep probably wouldn't be the correct name anymore due to the lack of the step in all cases, but you could call them SmoothIn, SmoothOut and SmoothInOut. It seems to me in any case SmoothStep might be useful one of the in/out variants could also be useful. It doesn't seem to me relevant whether or not the in/out variants "exist in computer science", but I'm pretty sure I've come across them before in other tweening libs. |
Just did a quick search. Evidently I'm not the first to have had the idea of chopping it in half. https://rexrainbow.github.io/C2RexDoc/c2rexpluginsACE/behavior_rex_lunarray.tween_mod.html A second point, what is a use case for the linear function? Why include it when it is identical to simply not specifying and easing function? |
What does the code for those look like? Chopping a smooth function in half doesn't necessarily keep it smooth. If you need to specify an easing function, like if it's mandatory, it's easier to use |
In the equation you posted before, both the |
You seem to have misread my equations. The stuff in the brackets are the arguments of f. |
Last point still remains, and I feel like this is going out of scope of the PR. |
Your last point does not stand as it isn't true. I have not given arbitrary polynomials. They are the front and end of the smoothStep and smootherStep functions. Im on my phone right now so it's not convenient for me to link you to a graphing tool to illustrate what these do, but I encourage you to do so. My suggestion maintains the symmetry in flixel, is easily useful if ever the full inout version would be useful, and contrary to what you say, the relevant derivative propeties are maintained. |
I know what polynomials look like, thanks. If the only reason to invent and include these functions is for parity with the others in flixel, then go for it. Although to me it's confusing as |
I only suggested the graph seeing as the equation alone evidently wasn't clear, given that you read it as something totally different. Considering I've already graphed them now, here are SmoothInOut (SmoothStep), SmoothIn and SmoothOut: https://www.desmos.com/calculator/vpyfohq3fo Symmetry is one of the two reasons I gave, the other is the fact that if the in/out version is useful, then so will the in and out variants be. If you, for example, use the functions for tweening UI, for some elements it may be sensible for them to ease in and out, whereas for others the timing/positioning etc may better warrant only the start and end of that function, and consistency between the functions may be necessary to keep elements positioned correctly with respect to other elements. Sigmoid inout functions (e.g. quadInOut) can be defined with respect to the separate in/out functions, or the separate in/out functions can be defined with respect to a sigmoid function such as smoothstep. The direction of this relationship has no bearing on the utility of the combined or separated versions. This is my main point. The presence of t<.5 conditions in the former cases isn't relevant. |
That's all fine, and you can PR mine to add them, but you could just use any other But like I said, you can just PR my branch. Makes the demo easier to change. |
PRed. I'm open minded about what to call them. smoothIn/smoothstepIn/hermiteCubeIn? |
|
Regardless of the prefix, I'd prefer to maintain the In/Out/InOut pattern. @Gama11? |
@JoeCreates agreed. |
If I were looking for |
Maybe add a doc comment? |
Yeah that's what I was thinking. |
In/out smoothstep easing variants
I think I'll comment all of the easing functions in a separate PR |
[skip ci]
(cherry picked from commit ae68994)
Linear, smoothstep, and smootherstep eases.