Commit 5dfbeed2 by Daniel Dahan

updated README to test new gif animations

parent d47c8f2a
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
Motion offers a clean API to add animations to your views and layers. Simply pass in animation structs with configurable parameters. Take a look at some examples below: Motion offers a clean API to add animations to your views and layers. Simply pass in animation structs with configurable parameters. Take a look at some examples below:
[Download Sample Animations Project](https://github.com/CosmicMind/Samples/tree/development/Projects/Programmatic/Animations)
| Animation | Property | Swift | | Animation | Property | Swift |
| --- |:--- |:--- | | --- |:--- |:--- |
| ![BackgroundColor](http://www.cosmicmind.com/motion/background_color.gif) | Background Color | background(color: UIColor) | | ![BackgroundColor](http://www.cosmicmind.com/motion/background_color.gif) | Background Color | background(color: UIColor) |
...@@ -19,6 +21,17 @@ Motion offers a clean API to add animations to your views and layers. Simply pas ...@@ -19,6 +21,17 @@ Motion offers a clean API to add animations to your views and layers. Simply pas
| ![Spring](http://www.cosmicmind.com/motion/spring.gif) | Spring | spring(stiffness: CGFloat, damping: CGFloat) | | ![Spring](http://www.cosmicmind.com/motion/spring.gif) | Spring | spring(stiffness: CGFloat, damping: CGFloat) |
| ![Translate](http://www.cosmicmind.com/motion/translate.gif) | Translate | translate(x: CGFloat, y: CGFloat, z: CGFloat) | | ![Translate](http://www.cosmicmind.com/motion/translate.gif) | Translate | translate(x: CGFloat, y: CGFloat, z: CGFloat) |
## Transitions
Motion offers a clean API to add animations to your views and layers. Simply pass in animation structs with configurable parameters. Take a look at some examples below:
[Download Sample Transitions Project](https://github.com/CosmicMind/Samples/tree/development/Projects/Programmatic/Transitions)
| Transition | Type | Swift |
| --- |:--- |:--- |
| ![Zoom Out](http://www.cosmicmind.com/motion/zoom.gif) | Zoom Out| .zoomOut |
## Requirements ## Requirements
* iOS 8.0+ * iOS 8.0+
......
...@@ -176,6 +176,22 @@ public extension UIView { ...@@ -176,6 +176,22 @@ public extension UIView {
func animate(_ animations: [MotionAnimation], completion: (() -> Void)? = nil) { func animate(_ animations: [MotionAnimation], completion: (() -> Void)? = nil) {
layer.animate(animations, completion: completion) 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 {
......
...@@ -111,7 +111,7 @@ public extension MotionAnimation { ...@@ -111,7 +111,7 @@ public extension MotionAnimation {
static func perspective(_ perspective: CGFloat) -> MotionAnimation { static func perspective(_ perspective: CGFloat) -> MotionAnimation {
return MotionAnimation { return MotionAnimation {
var t = $0.transform ?? CATransform3DIdentity var t = $0.transform ?? CATransform3DIdentity
t.m34 = 1 / -perspective t.m34 = 1.0 / -perspective
$0.transform = t $0.transform = t
} }
} }
......
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