Skip to content
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 specified easing functions specified in (#88) #90

Merged
merged 9 commits into from
Apr 6, 2021

Conversation

tmpr
Copy link
Contributor

@tmpr tmpr commented Apr 6, 2021

What was added

Functions for circular, sine, exponential and bouncing easing have been added to easing.rs. Further, I added 3 constants. This doesn't have to close (#88), since one could still add functions.

Remarks

  • I took most functions from https://easings.net/, yet had no idea yet how to test the functions.
  • A few things about the bouncing easing could be added improved:
    • One could clarify the choice of numbers
    • Some of the code could be more compact and more configurable.

@lukechu10 lukechu10 self-requested a review April 6, 2021 15:26
@lukechu10
Copy link
Member

Hi there. Thanks for taking the time to contribute to Maple! About testing the easing functions, I plan to add something similar to https://svelte.dev/examples#easing which should allow to visually test the easing functions. If I can get that finished fast enough, you can rebase it.

@lukechu10
Copy link
Member

I thought about testing and a simple sanity test could just be checking that ease(0.0) == 0.0 and ease(1.0) == 1.0.

A macro could generate these test cases for all the easing functions.

Copy link
Member

@lukechu10 lukechu10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a few nits if you don't mind. I would prefer if all the numbers had at least 1 digit after the decimal point (so 1.0 instead of 1.). I think this makes it easier to see that it's a float rather than a number with a function call. It might also be clearer if you used associated functions (so f32::powi(t - 1.0, 2) instead of (t - 1.0).powi(2)).

I tried out the easing functions in the tweened example (you can run it using trunk serve) and some of them didn't work as expected so I added some fixes.

@tmpr
Copy link
Contributor Author

tmpr commented Apr 6, 2021

I switched out the formats now, but again this is just formalities so I hope you like it this way. :)

Copy link
Member

@lukechu10 lukechu10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'll merge this now

@lukechu10 lukechu10 merged commit c7bf585 into sycamore-rs:master Apr 6, 2021
@lukechu10 lukechu10 linked an issue Apr 6, 2021 that may be closed by this pull request
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more easing functions
2 participants