-
Notifications
You must be signed in to change notification settings - Fork 361
Easing Into It: The anim module
#2799
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
base: development
Are you sure you want to change the base?
Conversation
it doesn't look like it's used anywhere internally
|
The CI's doc build doing something weird again. I'm investigating it. |
|
The doc currently "builds" but it's empty. We could merge now if we need these functions to help fix other things. The API ref structure and docstrings won't get picked up with the current |
|
I think the core module looks good. I like the structure of it. Some nice to haves that I don't think particularly block merging the feature, but that I'd at least like to see as follow up PRs if they don't make their way into this one would be:
|
|
This is currently targeted to |
Is there another 3.x release planned? I figured we were holding off until 4.0 anyway. |
DragonMoffon
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.
We will need a second PR with examples, good docs, and testing, but getting this in now would be good
|
I wonder if we can find a way to have a common setup for transitions/animations for the UI, too. |
When |
|
Are we calling this ready to merge? I'd like @pushfoo to give me the go-ahead on making sure docs generate. |
|
Another think that comes to my mind, |
In my example, yes, you're correct -- I was aiming for the minimal "get this working" code. You could absolutely instead use your own clock the you hold in the Window's state, or implement these using |
|
@eruvanos TL;DR: This is could be controlled by a slider from the Arcade GUI or help with the UI. The PR replaces the limited and opinionated OOP with something which supports easing anything with the right math operations. In my eyes, the main doc concerns are how the static methods aren't on the object. If we move them into it instead of having them as private-level module defs, docs should be easier to generate. Otherwise, we may need a helper to transplant docstrings from the wrapped functions onto their new |
* Convert EasingFunction into a typing.Protocol so it gets picked up by doc build + explain why * Correct Sphinx style issues and broken cross-references * Explain how of pyglet.math Matrix types won't work with easing (matmul) * Add an __all__ to arcade.anim.easing
|
Otherwise, I think this is a pretty good PR. It sets up adding an
|
Easing Into It: The
animmoduleEasing, made easy.
Good UI has juice. The way an interface moves can matter just as much as how it operates when it comes to the user's experience. But programming motion is hard; computers want to do things instantly, and snap from one thing to the next, things that we as humans aren't evolved to see as anything but jarring. How do we solve this problem? You can store states, incrementing positions and scales and opacities with delays and equations, but that puts tons of overhead on not only the program, but the programmer.
[an actor in black-and-white exaggeratedly throws up their hands in frustration] There has to be a better way!
Beloved by many are the easing functions, a simple way to plug in some known values, and get a nice smooth animated value in return. To use them, you only need to know a few basic things:
That last one can be tricky, and it's why sites like easings.net exist at all. Even harder than knowing which curve to use, though, is knowing how to implement them, which is why I did it for you! Please, hold your applause to the end.
This PR introduces, primarily, two simple things:
ease(), a single function you can import for all your easing needsEasing, a class containing every standard easing function, that you can pass right intoease()!Every easing function from easings.net is implemented already, and adding more is trivial in the future.
Here's an example of how you might use
ease()in a real world setting:In just a few short lines, we've made a moving object on our screen!
Note
This PR also deprecates the
arcade.easingmodule, as its interface was somewhat confusing, and it was unused in the library.