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 `scale` animation Fix #121 #494

Merged
merged 5 commits into from Jun 6, 2017

Conversation

Projects
None yet
3 participants
@phimage
Member

phimage commented Jun 4, 2017

see #121

parameters inspired by android scale animation with fromXScale, fromYScale and toXScale, toYScale

  • scale animation
  • scaleTo and scaleFrom shortcut
  • demo
  • doc
  • changelog

@phimage phimage requested a review from JakeLin Jun 4, 2017

@phimage phimage changed the title from Add `scale` animation to Add `scale` animation Fix #121 Jun 4, 2017

@phimage phimage requested a review from tbaranes Jun 4, 2017

@JakeLin

JakeLin approved these changes Jun 4, 2017

Super cool and useful feature👍👍👍

* Animating forever? `repeatCount = Float.Infinit`
* timing: linear and easing
* Animating forever? `repeatCount = Float.Infinit`
* <del>timing: linear and easing</del>

This comment has been minimized.

@JakeLin

JakeLin Jun 4, 2017

Member

Great, I forgot that🤣

@JakeLin

JakeLin Jun 4, 2017

Member

Great, I forgot that🤣

@@ -499,6 +501,48 @@ fileprivate extension Animatable where Self: UIView {
}
}
func scale(fromX: Double, fromY: Double, toX: Double, toY: Double, configuration: AnimationConfiguration, completion: AnimatableCompletion? = nil) {
if fromX.isNaN || fromY.isNaN || toX.isNaN || toY.isNaN {

This comment has been minimized.

@tbaranes

tbaranes Jun 5, 2017

Member

What about a guard?

@tbaranes

tbaranes Jun 5, 2017

Member

What about a guard?

This comment has been minimized.

@phimage

phimage Jun 5, 2017

Member

I am not sure that a guard will be more clear here

guard !(fromX.isNaN || fromY.isNaN || toX.isNaN || toY.isNaN) else {
    return
}
guard !fromX.isNaN && !fromY.isNaN && !toX.isNaN && !toY.isNaN else {
    return
}

due to negative! and the code have the same complexity

@phimage

phimage Jun 5, 2017

Member

I am not sure that a guard will be more clear here

guard !(fromX.isNaN || fromY.isNaN || toX.isNaN || toY.isNaN) else {
    return
}
guard !fromX.isNaN && !fromY.isNaN && !toX.isNaN && !toY.isNaN else {
    return
}

due to negative! and the code have the same complexity

This comment has been minimized.

@tbaranes

tbaranes Jun 5, 2017

Member

I understand your point of view, I'm used to read guard in these cases, but it's up to you 👍
What about the others? @JakeLin @SD10

@tbaranes

tbaranes Jun 5, 2017

Member

I understand your point of view, I'm used to read guard in these cases, but it's up to you 👍
What about the others? @JakeLin @SD10

This comment has been minimized.

@JakeLin

JakeLin Jun 5, 2017

Member

I prefer if instead of guard there because of the !

@JakeLin

JakeLin Jun 5, 2017

Member

I prefer if instead of guard there because of the !

if fromX.isNaN || fromY.isNaN || toX.isNaN || toY.isNaN {
return
}
if case .none = configuration.timingFunction {

This comment has been minimized.

@tbaranes

tbaranes Jun 5, 2017

Member

Can you divide these in two functions in order to make it easier to read? One for the if, and a second one for else

@tbaranes

tbaranes Jun 5, 2017

Member

Can you divide these in two functions in order to make it easier to read? One for the if, and a second one for else

This comment has been minimized.

@phimage

phimage Jun 5, 2017

Member

the difficulty is to find 2 names for 2 'scale' functions 😿

@phimage

phimage Jun 5, 2017

Member

the difficulty is to find 2 names for 2 'scale' functions 😿

This comment has been minimized.

@tbaranes

tbaranes Jun 5, 2017

Member

scaleWithTimingFunction / scaleWithoutTimingFunction 😬
(not really fan, but can't come with a better name right now)

@tbaranes

tbaranes Jun 5, 2017

Member

scaleWithTimingFunction / scaleWithoutTimingFunction 😬
(not really fan, but can't come with a better name right now)

This comment has been minimized.

@phimage

phimage Jun 5, 2017

Member

scale0, scale1 👿
scaleLayer, scaleView ✌️ ✌️
springScale, layerScale 🌸 🌸 🌸

@phimage

phimage Jun 5, 2017

Member

scale0, scale1 👿
scaleLayer, scaleView ✌️ ✌️
springScale, layerScale 🌸 🌸 🌸

This comment has been minimized.

@phimage

phimage Jun 5, 2017

Member

If Xcode could have for swift refactor>extract method....
wait Xcode 9 😄

@phimage

phimage Jun 5, 2017

Member

If Xcode could have for swift refactor>extract method....
wait Xcode 9 😄

phimage added some commits Jun 5, 2017

@phimage phimage merged commit 1001c65 into master Jun 6, 2017

5 checks passed

buddybuild: IBAnimatable (iOS, IBAnimatable) Build succeeded
Details
buddybuild: IBAnimatable (iOS, IBAnimatableApp) Build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
danger/danger All green. Jolly good show.

@tbaranes tbaranes deleted the feature/scale branch Jun 6, 2017

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