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

Feature: Timing functions #70

Merged
merged 3 commits into from
Aug 31, 2020
Merged

Conversation

marcosgriselli
Copy link
Owner

@marcosgriselli marcosgriselli commented Aug 30, 2020

This PR adds support for Predefined Timing Functions. The library used the UIView animation API with springs which doesn't rely on timing functions.

To support this I had to remove. the default spring parameters so the method's signature would differ. Since this is a breaking change I also went ahead a replaced the AnimationType.from(Direction, CGFloat) case for AnimationType.vector(Vector).

I'll keep this PR open for the weekend in case anybody wants to comment.

@marcosgriselli marcosgriselli self-assigned this Aug 30, 2020
@marcosgriselli marcosgriselli linked an issue Aug 30, 2020 that may be closed by this pull request
@marcosgriselli marcosgriselli merged commit 53e9249 into master Aug 31, 2020
@marcosgriselli marcosgriselli deleted the feature/timing-functions branch August 31, 2020 11:08
@iTarek
Copy link

iTarek commented Sep 4, 2020

Hi, Please update the readme examples. Also is there any example for using AnimationType.vector, how I change this to vector
let animMove = AnimationType.from(direction: .bottom, offset: self.view.height/2)
Thank you

@marcosgriselli
Copy link
Owner Author

marcosgriselli commented Sep 5, 2020

Good call @iTarek! I'll update the examples shortly. What you're looking for is:
let animMove = AnimationType.vector((CGVector(dx: 0, dy: self.view.height/2))

Both CollectionViewController.swift and TableViewController.swift files have examples using the .vector animation you can check those. I'll update the docs shortly.

@iTarek
Copy link

iTarek commented Sep 5, 2020

The AnimationType.vector is so confusing, I have icon on middle of screen and I was able to animate it to go down off screen like that....
let animMove = AnimationType.from(direction: .bottom, offset: self.view.height/2)
loadingViewIcon.animate(animations: [animMove], reversed: true, initialAlpha: 1, finalAlpha: 1, duration: 20.2)

Right now with AnimationType.vector the icon not start from the position it was before but it jumps to the new position and then move back, Is reversed: true working as it was before?

@marcosgriselli
Copy link
Owner Author

@iTarek you're right. There's some odd behavior. The example app is working in the same way as before with UITableView and UICollectionView but I individual views have problems.

I'll send a PR fixing this and adding examples shortly.

In the meantime I recommend you switch back to the previous release 2.7.0 to avoid any issues and still be able to use the directions as before.

@iTarek
Copy link

iTarek commented Sep 5, 2020

@iTarek you're right. There's some odd behavior. The example app is working in the same way as before with UITableView and UICollectionView but I individual views have problems.

I'll send a PR fixing this and adding examples shortly.

In the meantime I recommend you switch back to the previous release 2.7.0 to avoid any issues and still be able to use the directions as before.

Thank you for the quick response, I will wait for the next update 😊

@marcosgriselli
Copy link
Owner Author

@iTarek after some review I believe the functionality is working as expected. I agree the API is a bit confusing but I'm testing the example project and running this code:

let animation = AnimationType.vector(CGVector(dx: 0, dy: 30))
activityIndicator.animate(animations: [animation], reversed: true, initialAlpha: 1, finalAlpha: 0)

will effectively animate the view by moving it from its current position 30 points to the bottom. Can you maybe replicate the issue you're having on a PR or demo project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support of timing functions
2 participants