Skip to content

Commit 271b201

Browse files
committed
Minor updates to README and Guides
1 parent e7f386d commit 271b201

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

Guides/MoveableClasses.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
All standard motion classes in MotionMachine conform to the `Moveable` protocol. This protocol defines the minimum ways that a motion class should operate within the MotionMachine ecosystem. For instance, each class has start, stop, pause, and resume methods, and each one must support the ability to reverse the direction of the value's movement.
1+
## Overview
2+
3+
All standard motion classes in MotionMachine conform to the `Moveable` protocol. This protocol defines the minimum ways that a motion class should operate within the MotionMachine ecosystem. For instance, each class has start, stop, pause, and resume methods, and each one must support the ability to reverse the direction of the value's movement. This enables them to work seamlessly together without knowing or caring about their specific class types. If you want to use your own custom motion classes within the MotionMachine ecosystem, simply have them adopt the `Moveable` protocol. However, the base `Motion` class offers such modularity that in most cases you can just add to or replace the components you need with your own implementation.
24

35
`Motion` and `PhysicsMotion` are the base motion classes; they take in `PropertyData` structs and use these as instructions for how to modify object values. Each instance of `PropertyData` provides movement data that is specific to one property or discrete object. These property values are accessed and set by `ValueAssistant` objects. MotionMachine has assistants for several standard Core Graphics and UIKit value types, but you can add your own value assistants to a `Motion` to increase the types it can use.
46

57
These value updates are made as the motion moves through time. This movement is done via the `TempoDriven` protocol, which specifies how `Tempo` classes send update "beats" to motion classes. MotionMachine comes with two such `Tempo` classes – `CATempo`, which is driven by a `CADisplayLink` object and provides display-refresh syncing as Core Animation does, and `TimerTempo`, which provides tempo updates via an internal `NSTimer` object. The default `TempoDriven` object assigned to all MotionMachine classes is `CATempo`.
68

79

10+
811
![MotionMachine chart](mmchart.png)
912

1013
## Motion
1114

12-
`Motion` uses a keyPath (i.e. "frame.origin.x") to target specific properties of an object and transform their values over a period of time via an easing equation. The keyPath is relative to the parent object passed in, and normally you'd want to pass in the parent object of the object you actually want to modify (i.e. passing in a UIView object if you wish to modify its frame). This is necessary for MotionMachine to be able to modify the original object. However, you may pass in a target object directly for MotionMachine to modify, but that object will only be modified internally. In such cases you may access the object through the Motion's `PropertyData` objects, which are accessible from the `properties` property.
15+
`Motion` uses a keyPath (i.e. "frame.origin.x") in conjunction with NSObject's KVC to target specific properties of an object and transform their values over a period of time via an easing equation. The keyPath is relative to the parent object passed in, and normally you'd want to pass in the parent object of the object you actually want to modify (i.e. passing in a UIView object if you wish to modify its frame). This is necessary for MotionMachine to be able to modify the original object. However, you may pass in a target object directly for MotionMachine to modify, but that object will only be modified internally. In such cases you may access the object through the Motion's `PropertyData` objects, which are accessible from the `properties` property.
1316

1417
Here's a basic example using this workhorse of MotionMachine. We've supplied the `Motion` with a single `PropertyData` object which defines a property keyPath and an ending value, along with a duration of 1 second and a Quadratic easing equation. This easing parameter defines the easing equation assigned to the `easing` property. If your `Motion` is `reversing`, you can also specify a separate easing equation for the reverse movement via the `reverseEasing` property. If that property is undefined, the `Motion` will use the `easing` property for both motion directions.
1518

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
![platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20tvOS-005AA5.svg)
55
![license](https://img.shields.io/badge/license-MIT-005AA5.svg)
66

7-
MotionMachine is a powerful yet elegant animation library for Swift. It offers sensible default functionality that abstracts most of the hard work away, allowing you to focus on your work. But MotionMachine also makes it easy to dive in and modify for your own needs, whether that be custom motion classes, supporting custom value types, or new easing equations.
8-
9-
## Overview
10-
11-
MotionMachine provides a modular, generic platform for manipulating values. Its animation engine was built from the ground up to support not just UIKit values, but property values of any class you want to manipulate. MotionMachine does support most major UIKit types out of the box and provides syntactic sugar to easily manipulate them.
7+
MotionMachine provides a modular, powerful, and generic platform for manipulating values, whether that be animating UI elements or interpolating property values in your own classes. It offers sensible default functionality that abstracts most of the hard work away, allowing you to focus on your work. While it is type-agnostic, MotionMachine does support most major UIKit types out of the box and provides syntactic sugar to easily manipulate them. But it's also easy to dive in and modify for your own needs, whether that be custom motion classes, supporting custom value types, or new easing equations.
128

139
* Animation engine built from the ground up (not tied to Core Animation).
1410
* Motions can be grouped, sequenced, and nested in any arrangement and have reversing and repeating actions applied at any level.
@@ -27,7 +23,7 @@ MotionMachine provides a modular, generic platform for manipulating values. Its
2723
Also check out the [Examples project](Examples) to see all the MotionMachine classes in action, or dive deep into the source [Documentation](https://poetmountain.github.io/MotionMachine/).
2824

2925

30-
#### Example
26+
## Introduction
3127
![MotionGroup animation](Guides/group.gif)
3228

3329
This complex animation was created with the code sample below. These `Motion` classes animate the NSLayoutConstraints of the circle views (_the constraints object in the `target` parameter is a dictionary of NSLayoutConstraint references_) as well as one of their `backgroundColor` properties. A `MotionGroup` object is used to synchronize the four `Motion` objects and reverse their movements.
@@ -61,7 +57,7 @@ let group = MotionGroup()
6157

6258
#### How does this work?
6359

64-
All of the included motion classes in MotionMachine adopt the `Moveable` protocol, which enables them to work seamlessly together. By using the `MotionGroup` and `MotionSequence` collection classes to control multiple motion objects – even nesting multiple layers – you can create complex animations with little effort. If you want to use your own custom motion classes within the MotionMachine ecosystem, simply have them adopt the `Moveable` protocol. However, the base `Motion` class offers such modularity that in most cases you can just add to or replace the components you need with your own implementation.
60+
All of the included motion classes in MotionMachine adopt the `Moveable` protocol, which enables them to work seamlessly together. By using the `MotionGroup` and `MotionSequence` collection classes to control multiple motion objects – even nesting multiple layers – you can create complex animations with little effort.
6561

6662

6763
#### Motion
@@ -166,7 +162,7 @@ If you use CocoaPods, add this pod to your Podfile:
166162

167163
##### Podfile
168164
```ruby
169-
pod 'MotionMachine', '~> 1.3.0'
165+
pod 'MotionMachine', '~> 1.3'
170166
```
171167

172168
Or add the Sources directory to your project.
@@ -182,15 +178,15 @@ MotionMachine currently requires:
182178

183179
* MotionMachine uses Key-Value Coding (KVC) to introspect objects and retrieve and set their property values using keypaths. Because Swift currently offers no native ability in this regard, objects whose properties should be modified by MotionMachine must inherit from `NSObject`. If and when more dynamism is added to Swift (and the author of this library hopes that is the case), MotionMachine will hopefully be able to do away with this restriction. Note that as of Swift 4.0, any properties of a custom class you wish to manipulate must be prefixed with `@objc`, or add `@objcMembers` above the class if all properties should be exposed.
184180

185-
* Because native Swift structs cannot inherit from `NSObject`, Swift structs unfortunately cannot be used directly with MotionMachine at this time.
181+
* Because native Swift structs cannot inherit from `NSObject`, Swift structs unfortunately cannot be used directly with MotionMachine at this time, though you can use them in a keyPath if you're not targeting one of their properties directly.
186182

187183
* The KVC provided by `NSObject` is not able to evaluate Optional values. Properties you wish to modify with MotionMachine must not be Optionals.
188184

189185
* Swift on Linux is not currently supported due to the lack of Foundation and Core Graphics frameworks on that platform.
190186

191187
## Credits
192188

193-
MotionMachine was created by [Brett Walker](https://twitter.com/petsound). It is based on the author's Objective-C library [PMTween](https://github.com/poetmountain/PMTween).
189+
MotionMachine was created by [Brett Walker](https://twitter.com/petsound). It is loosely based on the author's Objective-C library [PMTween](https://github.com/poetmountain/PMTween).
194190

195191

196192
## License

0 commit comments

Comments
 (0)