Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit 323ac75

Browse files
author
Jeff Verkoeyen
committed
Merge branch 'release-candidate' into stable
2 parents 1fe294d + 9b8f1c5 commit 323ac75

25 files changed

+1335
-95
lines changed

.arcconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
"arc.feature.start.default": "origin/develop",
1414
"unit.xcode": {
1515
"build": {
16-
"workspace": "MaterialMotionAnimator.xcworkspace",
16+
"workspace": "MotionAnimator.xcworkspace",
1717
"scheme": "UnitTests",
1818
"configuration": "Debug",
1919
"destination": "platform=iOS Simulator,name=iPhone 6s"
2020
},
2121
"coverage": {
22-
"product": "MaterialMotionAnimator.framework/MaterialMotionAnimator"
22+
"product": "MotionAnimator.framework/MotionAnimator"
2323
},
2424
"pre-build": "pod install"
2525
}

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ before_install:
1010
script:
1111
- set -o pipefail
1212
- arcanist/bin/arc unit --everything --trace
13-
- xcodebuild build -workspace MaterialMotionAnimator.xcworkspace -scheme Catalog -sdk "iphonesimulator10.1" -destination "name=iPhone 6s,OS=10.1" ONLY_ACTIVE_ARCH=YES | xcpretty -c;
13+
- xcodebuild build -workspace MotionAnimator.xcworkspace -scheme MotionAnimatorCatalog -sdk "iphonesimulator10.1" -destination "name=iPhone 6s,OS=10.1" ONLY_ACTIVE_ARCH=YES | xcpretty -c;
1414
after_success:
1515
- bash <(curl -s https://codecov.io/bash)

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 1.0.0
2+
3+
Initial release.
4+
5+
Includes MDMMotionAnimator and a small set of pre-defined animatable key paths.
6+
7+
## Source changes
8+
9+
* [Add support for iOS 8.](https://github.com/material-motion/motion-animator-objc/commit/f83c8ff02a1b99649396e50c11f2dc1ef4dd408f) (Jeff Verkoeyen)
10+
* [Initial commit of MotionAnimator code. (#1)](https://github.com/material-motion/motion-animator-objc/commit/4f816553c409357ead3f9eb27a92066152591664) (featherless)
11+
* [Initial preparation for project.](https://github.com/material-motion/motion-animator-objc/commit/28666dbb46aaebf08e9b284fce7cba280a0736ff) (Jeff Verkoeyen)
12+
13+
## Non-source changes
14+
15+
* [Remove superlatives.](https://github.com/material-motion/motion-animator-objc/commit/5f3367654622c262f4b474be7e1e760814bbff08) (Jeff Verkoeyen)
16+
* [Add more delay to the chip animation.](https://github.com/material-motion/motion-animator-objc/commit/e1af31a0f72b7489431804ccac0eaa5101ef33b0) (Jeff Verkoeyen)
17+
* [Update docs.](https://github.com/material-motion/motion-animator-objc/commit/625ffe117d198421bffcf24a0f56c40203d0f614) (Jeff Verkoeyen)
18+
19+

MaterialMotionAnimator.podspec

Lines changed: 0 additions & 29 deletions
This file was deleted.

MotionAnimator.podspec

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Pod::Spec.new do |s|
2+
s.name = "MotionAnimator"
3+
s.summary = "A Motion Animator creates performant, interruptible animations from motion specs."
4+
s.version = "1.0.0"
5+
s.authors = "The Material Motion Authors"
6+
s.license = "Apache 2.0"
7+
s.homepage = "https://github.com/material-motion/motion-animator-objc"
8+
s.source = { :git => "https://github.com/material-motion/motion-animator-objc.git", :tag => "v" + s.version.to_s }
9+
s.platform = :ios, "8.0"
10+
s.requires_arc = true
11+
12+
s.public_header_files = "src/*.h"
13+
s.source_files = "src/*.{h,m,mm}", "src/private/*.{h,m,mm}"
14+
15+
s.dependency "MotionInterchange"
16+
end

Podfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
workspace 'MaterialMotionAnimator.xcworkspace'
1+
workspace 'MotionAnimator.xcworkspace'
22
use_frameworks!
33

4-
target "Catalog" do
4+
target "MotionAnimatorCatalog" do
55
pod 'CatalogByConvention'
6-
pod 'MaterialMotionAnimator/examples', :path => './'
7-
project 'examples/apps/Catalog/Catalog.xcodeproj'
6+
pod 'MotionAnimator', :path => './'
7+
project 'examples/apps/Catalog/MotionAnimatorCatalog.xcodeproj'
88
end
99

1010
target "UnitTests" do
11-
project 'examples/apps/Catalog/Catalog.xcodeproj'
12-
pod 'MaterialMotionAnimator/tests', :path => './'
11+
project 'examples/apps/Catalog/MotionAnimatorCatalog.xcodeproj'
12+
pod 'MotionAnimator', :path => './'
1313
end
1414

1515
post_install do |installer|

Podfile.lock

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
PODS:
2+
- CatalogByConvention (2.1.1)
3+
- MotionAnimator (1.0.0):
4+
- MotionInterchange
5+
- MotionInterchange (1.0.1)
6+
7+
DEPENDENCIES:
8+
- CatalogByConvention
9+
- MotionAnimator (from `./`)
10+
11+
EXTERNAL SOURCES:
12+
MotionAnimator:
13+
:path: "./"
14+
15+
SPEC CHECKSUMS:
16+
CatalogByConvention: c3a5319de04250a7cd4649127fcfca5fe3322a43
17+
MotionAnimator: 554b22116cbbcae6bf90fdad0042a87604225d0e
18+
MotionInterchange: 7a7c355ba2ed5d36c5cf2ceb76cacd3d3680dbf5
19+
20+
PODFILE CHECKSUM: 634239e7b183e669593b273198da9227ed207777
21+
22+
COCOAPODS: 1.2.1

README.md

Lines changed: 103 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,59 @@
11
# Motion Animator
22

3-
[![Build Status](https://travis-ci.org/material-motion/motionanimator-objc.svg?branch=develop)](https://travis-ci.org/material-motion/motionanimator-objc)
4-
[![codecov](https://codecov.io/gh/material-motion/motionanimator-objc/branch/develop/graph/badge.svg)](https://codecov.io/gh/material-motion/motionanimator-objc)
5-
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/MaterialMotionAnimator.svg)](https://cocoapods.org/pods/MaterialMotionAnimator)
6-
[![Platform](https://img.shields.io/cocoapods/p/MaterialMotionAnimator.svg)](http://cocoadocs.org/docsets/MaterialMotionAnimator)
7-
[![Docs](https://img.shields.io/cocoapods/metrics/doc-percent/MaterialMotionAnimator.svg)](http://cocoadocs.org/docsets/MaterialMotionAnimator)
3+
> A Motion Animator creates performant, interruptible animations from motion specs.
4+
5+
[![Build Status](https://travis-ci.org/material-motion/motion-animator-objc.svg?branch=develop)](https://travis-ci.org/material-motion/motion-animator-objc)
6+
[![codecov](https://codecov.io/gh/material-motion/motion-animator-objc/branch/develop/graph/badge.svg)](https://codecov.io/gh/material-motion/motion-animator-objc)
7+
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/MotionAnimator.svg)](https://cocoapods.org/pods/MotionAnimator)
8+
[![Platform](https://img.shields.io/cocoapods/p/MotionAnimator.svg)](http://cocoadocs.org/docsets/MotionAnimator)
9+
[![Docs](https://img.shields.io/cocoapods/metrics/doc-percent/MotionAnimator.svg)](http://cocoadocs.org/docsets/MotionAnimator)
10+
11+
This library turns [Motion Interchange](https://github.com/material-motion/motion-interchange-objc)
12+
data structures into performant Core Animation animations using a lightweight animator object.
13+
14+
<img src="assets/chip.gif" />
15+
16+
In the above example we're animating the expansion and collapse of a calendar event using the
17+
following motion specification:
18+
19+
```objc
20+
struct CalendarChipTiming {
21+
MDMMotionTiming chipWidth;
22+
MDMMotionTiming chipHeight;
23+
MDMMotionTiming chipY;
24+
25+
MDMMotionTiming chipContentOpacity;
26+
MDMMotionTiming headerContentOpacity;
27+
28+
MDMMotionTiming navigationBarY;
29+
};
30+
typedef struct CalendarChipTiming CalendarChipTiming;
31+
32+
struct CalendarChipMotionSpec {
33+
CalendarChipTiming expansion;
34+
CalendarChipTiming collapse;
35+
};
36+
typedef struct CalendarChipMotionSpec CalendarChipMotionSpec;
37+
38+
FOUNDATION_EXTERN struct CalendarChipMotionSpec CalendarChipSpec;
39+
```
40+
41+
In our application logic, we first determine which motion timing to use and then we create an
42+
instance of `MDMMotionAnimator`. The animator allows us to create animations with the given
43+
motion timing.
44+
45+
```objc
46+
CalendarChipTiming timing = _expanded ? CalendarChipSpec.expansion : CalendarChipSpec.collapse;
47+
48+
MDMMotionAnimator *animator = [[MDMMotionAnimator alloc] init];
49+
animator.shouldReverseValues = !_expanded;
50+
51+
[animator animateWithTiming:timing.chipHeight
52+
toLayer:chipView.layer
53+
withValues:@[ @(chipFrame.size.height), @(headerFrame.size.height) ]
54+
keyPath:MDMKeyPathHeight];
55+
...
56+
```
857
958
## Installation
1059
@@ -17,9 +66,9 @@
1766
>
1867
> gem install cocoapods
1968
20-
Add `MaterialMotionAnimator` to your `Podfile`:
69+
Add `motion-animator` to your `Podfile`:
2170
22-
pod 'MaterialMotionAnimator'
71+
pod 'MotionAnimator'
2372
2473
Then run the following command:
2574
@@ -29,7 +78,7 @@ Then run the following command:
2978
3079
Import the framework:
3180
32-
@import MaterialMotionAnimator;
81+
@import MotionAnimator;
3382
3483
You will now have access to all of the APIs.
3584
@@ -38,25 +87,65 @@ You will now have access to all of the APIs.
3887
Check out a local copy of the repo to access the Catalog application by running the following
3988
commands:
4089
41-
git clone https://github.com/material-motion/motionanimator-objc.git
42-
cd motionanimator-objc
90+
git clone https://github.com/material-motion/motion-animator-objc.git
91+
cd motion-animator-objc
4392
pod install
44-
open MaterialMotionAnimator.xcworkspace
93+
open MotionAnimator.xcworkspace
4594
4695
## Guides
4796
4897
1. [Architecture](#architecture)
49-
2. [How to ...](#how-to-...)
98+
2. [How to animate a transition](#how-to-animate-a-transition)
99+
3. [How to animate an interruptible transition](#how-to-animate-an-interruptible-transition)
50100
51101
### Architecture
52102
53-
### How to ...
103+
`MDMMotionAnimator` is the primary API provided by this library. You can configure the animations
104+
that an animator creates by modifying its configuration properties. When you're ready to add an
105+
animation to a CALayer instance, call one of the `animate` method variants and an animation will
106+
be added to the layer.
107+
108+
This library depends on [MotionInterchange](https://github.com/material-motion/motion-interchange-objc)
109+
in order to represent motion timing in a consistent fashion.
110+
111+
### How to animate a transition
112+
113+
> This guide assumes that you are animating a two state bi-directional transition.
114+
115+
Start by creating an `MDMMotionAnimator` instance.
116+
117+
```objc
118+
MDMMotionAnimator *animator = [[MDMMotionAnimator alloc] init];
119+
```
120+
121+
When we describe our transition we'll describe it as though we're moving forward and take advantage
122+
of the `shouldReverseValues` property on our animator to handle the reverse direction.
123+
124+
```objc
125+
animator.shouldReverseValues = isTransitionReversed;
126+
```
127+
128+
To animate a property on a view, we invoke the `animate` method. We must provide a timing, values,
129+
and a key path:
130+
131+
```objc
132+
[animator animateWithTiming:timing
133+
toLayer:view.layer
134+
withValues:@[ @(collapsedHeight), @(expandedHeight) ]
135+
keyPath:MDMKeyPathHeight];
136+
```
137+
138+
### How to animate an interruptible transition
139+
140+
`MDMMotionAnimator` is configured by default to generate interruptible animations using Core
141+
Animation's additive animation APIs. You can simply re-execute the `animate` calls when your
142+
transition's direction changes and the animator will add new animations for the updated direction.
54143
55144
## Contributing
56145
57146
We welcome contributions!
58147
59-
Check out our [upcoming milestones](https://github.com/material-motion/motionanimator-objc/milestones).
148+
Check out our [upcoming milestones](https://github.com/material-motion/motion-animator-objc/milestones).
60149
61150
Learn more about [our team](https://material-motion.github.io/material-motion/team/),
62151
[our community](https://material-motion.github.io/material-motion/team/community/), and

assets/chip.gif

185 KB
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
Copyright 2017-present The Material Motion Authors. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
#import <UIKit/UIKit.h>
18+
19+
@interface CalendarCardExpansionExampleViewController : UIViewController
20+
@end

0 commit comments

Comments
 (0)