Commit a26c532b by Daniel Dahan

updated public motion helper properties to internal

parent 4a1008d8
...@@ -84,6 +84,61 @@ public extension UIView { ...@@ -84,6 +84,61 @@ public extension UIView {
} }
} }
/**
A function that accepts CAAnimation objects and executes them on the
view's backing layer.
- Parameter animations: A list of CAAnimations.
*/
func animate(_ animations: CAAnimation...) {
layer.animate(animations)
}
/**
A function that accepts an Array of CAAnimation objects and executes
them on the view's backing layer.
- Parameter animations: An Array of CAAnimations.
*/
func animate(_ animations: [CAAnimation]) {
layer.animate(animations)
}
/**
A function that accepts a list of MotionAnimation values and executes
them on the view's backing layer.
- Parameter animations: A list of MotionAnimation values.
*/
func animate(_ animations: MotionAnimation...) {
layer.animate(animations)
}
/**
A function that accepts an Array of MotionAnimation values and executes
them on the view's backing layer.
- Parameter animations: An Array of MotionAnimation values.
- Parameter completion: An optional completion block.
*/
func animate(_ animations: [MotionAnimation], completion: (() -> Void)? = nil) {
layer.animate(animations, completion: completion)
}
/**
A function that accepts a list of MotionTransition values.
- Parameter transitions: A list of MotionTransition values.
*/
func transition(_ transitions: MotionTransition...) {
transition(transitions)
}
/**
A function that accepts an Array of MotionTransition values.
- Parameter transitions: An Array of MotionTransition values.
*/
func transition(_ transitions: [MotionTransition]) {
motionTransitions = transitions
}
}
internal extension UIView {
/// The animations to run while in transition. /// The animations to run while in transition.
var motionTransitions: [MotionTransition]? { var motionTransitions: [MotionTransition]? {
get { get {
...@@ -95,7 +150,6 @@ public extension UIView { ...@@ -95,7 +150,6 @@ public extension UIView {
} }
/// The animations to run while in transition. /// The animations to run while in transition.
@IBInspectable
var motionAlpha: CGFloat? { var motionAlpha: CGFloat? {
get { get {
return associatedInstance.alpha return associatedInstance.alpha
...@@ -139,59 +193,6 @@ public extension UIView { ...@@ -139,59 +193,6 @@ public extension UIView {
var motionScaleY: CGFloat { var motionScaleY: CGFloat {
return transform.b return transform.b
} }
/**
A function that accepts CAAnimation objects and executes them on the
view's backing layer.
- Parameter animations: A list of CAAnimations.
*/
func animate(_ animations: CAAnimation...) {
layer.animate(animations)
}
/**
A function that accepts an Array of CAAnimation objects and executes
them on the view's backing layer.
- Parameter animations: An Array of CAAnimations.
*/
func animate(_ animations: [CAAnimation]) {
layer.animate(animations)
}
/**
A function that accepts a list of MotionAnimation values and executes
them on the view's backing layer.
- Parameter animations: A list of MotionAnimation values.
*/
func animate(_ animations: MotionAnimation...) {
layer.animate(animations)
}
/**
A function that accepts an Array of MotionAnimation values and executes
them on the view's backing layer.
- Parameter animations: An Array of MotionAnimation values.
- Parameter completion: An optional completion block.
*/
func animate(_ animations: [MotionAnimation], completion: (() -> Void)? = nil) {
layer.animate(animations, completion: completion)
}
/**
A function that accepts a list of MotionTransition values.
- Parameter transitions: A list of MotionTransition values.
*/
func transition(_ transitions: MotionTransition...) {
transition(transitions)
}
/**
A function that accepts an Array of MotionTransition values.
- Parameter transitions: An Array of MotionTransition values.
*/
func transition(_ transitions: [MotionTransition]) {
motionTransitions = transitions
}
} }
internal extension UIView { internal extension UIView {
......
...@@ -103,7 +103,7 @@ public extension MotionAnimation { ...@@ -103,7 +103,7 @@ public extension MotionAnimation {
} }
/** /**
Animates a view's current rotate to the given x, y, Animates a view's current rotation to the given x, y,
and z values. and z values.
- Parameter x: A CGFloat. - Parameter x: A CGFloat.
- Parameter y: A CGFloat. - Parameter y: A CGFloat.
...@@ -120,9 +120,9 @@ public extension MotionAnimation { ...@@ -120,9 +120,9 @@ public extension MotionAnimation {
} }
/** /**
Animates a view's current rotate to the given point. Animates a view's current rotation to the given point.
- Parameter _ point: A CGPoint. - Parameter _ point: A CGPoint.
- Parameter z: A CGFloat, default is 0. - Parameter z: A CGFloat.
- Returns: A MotionAnimation. - Returns: A MotionAnimation.
*/ */
static func rotate(_ point: CGPoint, z: CGFloat = 0) -> MotionAnimation { static func rotate(_ point: CGPoint, z: CGFloat = 0) -> MotionAnimation {
...@@ -155,7 +155,7 @@ public extension MotionAnimation { ...@@ -155,7 +155,7 @@ public extension MotionAnimation {
/** /**
Animates a view's current spin to the given point. Animates a view's current spin to the given point.
- Parameter _ point: A CGPoint. - Parameter _ point: A CGPoint.
- Parameter z: A CGFloat, default is 0. - Parameter z: A CGFloat.
- Returns: A MotionAnimation. - Returns: A MotionAnimation.
*/ */
static func spin(_ point: CGPoint, z: CGFloat = 0) -> MotionAnimation { static func spin(_ point: CGPoint, z: CGFloat = 0) -> MotionAnimation {
...@@ -172,7 +172,7 @@ public extension MotionAnimation { ...@@ -172,7 +172,7 @@ public extension MotionAnimation {
} }
/** /**
Animates the view's current scale to the given x, y, z scale values. Animates the view's current scale to the given x, y, and z scale values.
- Parameter x: A CGFloat. - Parameter x: A CGFloat.
- Parameter y: A CGFloat. - Parameter y: A CGFloat.
- Parameter z: A CGFloat. - Parameter z: A CGFloat.
...@@ -194,8 +194,7 @@ public extension MotionAnimation { ...@@ -194,8 +194,7 @@ public extension MotionAnimation {
} }
/** /**
Animates a view's current translation to the given Animates a view equal to the distance given by the x, y, and z values.
x, y, and z values.
- Parameter x: A CGFloat. - Parameter x: A CGFloat.
- Parameter y: A CGFloat. - Parameter y: A CGFloat.
- Parameter z: A CGFloat. - Parameter z: A CGFloat.
...@@ -208,10 +207,9 @@ public extension MotionAnimation { ...@@ -208,10 +207,9 @@ public extension MotionAnimation {
} }
/** /**
Animates a view's current translation to the given Animates a view equal to the distance given by a point and z value.
point value (x & y), and a z value.
- Parameter _ point: A CGPoint. - Parameter _ point: A CGPoint.
- Parameter z: A CGFloat, default is 0. - Parameter z: A CGFloat.
- Returns: A MotionAnimation. - Returns: A MotionAnimation.
*/ */
static func translate(_ point: CGPoint, z: CGFloat = 0) -> MotionAnimation { static func translate(_ point: CGPoint, z: CGFloat = 0) -> MotionAnimation {
...@@ -346,6 +344,20 @@ public extension MotionAnimation { ...@@ -346,6 +344,20 @@ public extension MotionAnimation {
} }
/** /**
Available in iOS 9+, animates a view using the spring API,
given a stiffness and damping.
- Parameter stiffness: A CGFlloat.
- Parameter damping: A CGFloat.
- Returns: A MotionAnimation.
*/
@available(iOS 9, *)
static func spring(stiffness: CGFloat, damping: CGFloat) -> MotionAnimation {
return MotionAnimation {
$0.spring = (stiffness, damping)
}
}
/**
The duration of the view's animation. If a duration of 0 is used, The duration of the view's animation. If a duration of 0 is used,
the value will be converted to 0.01, to give a close to zero value. the value will be converted to 0.01, to give a close to zero value.
- Parameter _ duration: A TimeInterval. - Parameter _ duration: A TimeInterval.
...@@ -380,21 +392,7 @@ public extension MotionAnimation { ...@@ -380,21 +392,7 @@ public extension MotionAnimation {
} }
/** /**
Available in iOS 9+, animates a view using the spring API, Creates a completion block handler that is executed once the animation
given a stiffness and damping.
- Parameter stiffness: A CGFlloat.
- Parameter damping: A CGFloat.
- Returns: A MotionAnimation.
*/
@available(iOS 9, *)
static func spring(stiffness: CGFloat, damping: CGFloat) -> MotionAnimation {
return MotionAnimation {
$0.spring = (stiffness, damping)
}
}
/**
Creates a completion block handler that executed once tha animation
is done. is done.
- Parameter _ execute: A callback to execute once completed. - Parameter _ execute: A callback to execute once completed.
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment