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

Fixed possible negative duration #8

Merged
merged 1 commit into from
Dec 4, 2017
Merged

Fixed possible negative duration #8

merged 1 commit into from
Dec 4, 2017

Conversation

iDonJose
Copy link
Contributor

@iDonJose iDonJose commented Dec 2, 2017

Hello Steve, this is a really a nice framework that your offer us !
In the many animation frameworks available on Github I've chose yours as it's really clean, simple to use and powerful.

Now comes a bunch of updates I want to bring to better TweenKit !

Here we fix the duration. It needs to be positive and distance between the two values is algebraic.

Distance in this framework are algebraic, they can either be positive
or negative. Thus the calculated duration could be negative which is
interpreted as a null duration.
@SteveBarnegren
Copy link
Owner

@iDonJose Thanks for the kind words, and glad that you're enjoying using TweenKit!

Good spot! This is a good fix, I'm going to merge it in. This really exposes an inconsistency in the way that I've implemented the distanceTo(other:) method. CGPoints will always return a positive value, but Double / Float can return negative.

Really it should be consistent, so I might change all of them to return positive values. It's still a good idea to have this check in too, to avoid bugs when users of the library implement their own Tweenable conformances.

You are officially the second contributor to TweenKit! 🎉 Thanks for helping to improve it! 👍

@SteveBarnegren SteveBarnegren merged commit 303ec58 into SteveBarnegren:master Dec 4, 2017
@SteveBarnegren
Copy link
Owner

I'll have a look at your other PR's, although I'm just about to go on holiday for the next couple of weeks, so if you don't hear from me then just give me a bit more time to get round to it.

I'll aim to do another release to CocoaPods when I'm back 👍

@iDonJose
Copy link
Contributor Author

iDonJose commented Dec 9, 2017

@SteveBarnegren Ok ! Wish you happy Hollidays and Christmas time.

That's what I was thinking too. Distance should be returning only positive values as it used only for calculating duration at the moment. I'll send you a PR.

@iDonJose iDonJose deleted the negative-duration-fix branch December 10, 2017 17:22
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.

None yet

2 participants