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

Commit ff39ecc

Browse files
author
Jeff Verkoeyen
committed
Merge branch 'release-candidate' into stable
2 parents f31562c + fa35516 commit ff39ecc

22 files changed

+817
-145
lines changed

.jazzy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module: MotionAnimator
2-
module_version: 2.7.0
2+
module_version: 2.8.0
33
sdk: iphonesimulator
44
umbrella_header: src/MotionAnimator.h
55
objc: true
66
github_url: https://github.com/material-motion/motion-animator-objc
7-
github_file_prefix: https://github.com/material-motion/motion-animator-objc/tree/v2.7.0
7+
github_file_prefix: https://github.com/material-motion/motion-animator-objc/tree/v2.8.0

CHANGELOG.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,68 @@
1+
# 2.8.0
2+
3+
This minor release introduces support for animating more key paths and support for drop-in UIView animation API replacements.
4+
5+
## New features
6+
7+
The MotionAnimator can now implicitly animate the following CALayer properties: `anchorPoint`, `borderWidth`, `borderColor`, `shadowColor`, and `zPosition`.
8+
9+
There are now UIKit equivalency APIs that can be used as drop-in replacements for existing UIView animation code.
10+
11+
## Source changes
12+
13+
* [Add IS_BAZEL_BUILD around MotionInterchange import (#103)](https://github.com/material-motion/motion-animator-objc/commit/042eb8cb46c077121f817d5e8ebc7b51d4ec54b9) (Louis Romero)
14+
* [Anchor point became animatable on iOS 11.](https://github.com/material-motion/motion-animator-objc/commit/a56cd92874440b975591e421eaad8d4ef28cb9d4) (Jeff Verkoeyen)
15+
* [Add support for animating anchorPoint. (#97)](https://github.com/material-motion/motion-animator-objc/commit/646b6f6fd1ed3a10dae7ab4e98caa43cad65f2ff) (featherless)
16+
* [Add support for animating shadow color. (#99)](https://github.com/material-motion/motion-animator-objc/commit/ca896623a4e5a42a458e6fd59c8f405b55e87e26) (featherless)
17+
* [Add support for animating border width and color. (#98)](https://github.com/material-motion/motion-animator-objc/commit/55c23d5c4f8029cc45f6331a894ddf1960863ba7) (featherless)
18+
* [Add support for animating z position. (#96)](https://github.com/material-motion/motion-animator-objc/commit/23cd380bf2414b2834da7f8d55548cd00166d6f8) (featherless)
19+
* [Add support for additively animating bounds. (#93)](https://github.com/material-motion/motion-animator-objc/commit/32c78d4d93b6c82ff55693c54176b2826f718e5e) (featherless)
20+
* [Improve the documentation for initial velocity. (#94)](https://github.com/material-motion/motion-animator-objc/commit/e260418023430e0541360ec46ed6d4d931dbf05c) (featherless)
21+
* [Standardize our param docs formatting. (#95)](https://github.com/material-motion/motion-animator-objc/commit/024296aca338b106cf49b87fcc83b9feb216ee9d) (featherless)
22+
* [Add back test properties that were accidentally removed in 69469aedb987e516ff1f43a123b3ee29dfef38ca.](https://github.com/material-motion/motion-animator-objc/commit/e41ccb4890b9ed3bad5ab52015f8224adb5bbba6) (Jeff Verkoeyen)
23+
* [Add support for using a spring generator as a timing curve. (#91)](https://github.com/material-motion/motion-animator-objc/commit/46fd517e18b3a9555e46dcdd942601dd4ccd5149) (featherless)
24+
* [Throw an assertion when an unrecognized timing curve is provided. (#92)](https://github.com/material-motion/motion-animator-objc/commit/1e76e2ba8fe9bc08d623a55623f5fd40579d0287) (featherless)
25+
* [Add UIKit equivalent APIs for animating implicitly. (#90)](https://github.com/material-motion/motion-animator-objc/commit/69469aedb987e516ff1f43a123b3ee29dfef38ca) (featherless)
26+
27+
## API changes
28+
29+
Auto-generated by running:
30+
31+
apidiff origin/stable release-candidate objc src/MotionAnimator.h
32+
33+
#### Animatable key paths
34+
35+
*new* constant: `MDMKeyPathAnchorPoint`
36+
37+
*new* constant: `MDMKeyPathBorderWidth`
38+
39+
*new* constant: `MDMKeyPathBorderColor`
40+
41+
*new* constant: `MDMKeyPathShadowColor`
42+
43+
*new* constant: `MDMKeyPathZ`
44+
45+
#### MDMMotionAnimator(UIKitEquivalency)
46+
47+
*new* class method: `+animateWithDuration:delay:options:animations:completion:` in `MDMMotionAnimator(UIKitEquivalency)`
48+
49+
*new* class method: `+animateWithDuration:animations:completion:` in `MDMMotionAnimator(UIKitEquivalency)`
50+
51+
*new* class method: `+animateWithDuration:animations:` in `MDMMotionAnimator(UIKitEquivalency)`
52+
53+
*new* class method: `+animateWithDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:` in `MDMMotionAnimator(UIKitEquivalency)`
54+
55+
## Non-source changes
56+
57+
* [Animate the border as well to demonstrate that we can animate CALayer properties with the animator. (#101)](https://github.com/material-motion/motion-animator-objc/commit/e48cc459f281afde1ab2ae2c985b4fb64555c0f9) (featherless)
58+
* [Add a UIKit-ish tap to bounce example as a contrast to the traits example. (#100)](https://github.com/material-motion/motion-animator-objc/commit/c04fd1a5ad5ba910cb609d5edf52f1fa2b88826f) (featherless)
59+
* [Wording order.](https://github.com/material-motion/motion-animator-objc/commit/4bf33e213af26511e0aca40f42ebceb0a077076a) (Jeff Verkoeyen)
60+
* [Min SDK support.](https://github.com/material-motion/motion-animator-objc/commit/0ca2e7c7e154da62fac508d6f8c21f1ff3b37c02) (Jeff Verkoeyen)
61+
* [Fix the banner url.](https://github.com/material-motion/motion-animator-objc/commit/966ae6769288e4913219c7de156b846af5789d96) (Jeff Verkoeyen)
62+
* [Add banner and drop most of the preamble docs in preparation for the new readme.](https://github.com/material-motion/motion-animator-objc/commit/cf183c788fba2fef2e144674d412da67d5adc438) (Jeff Verkoeyen)
63+
64+
---
65+
166
# 2.7.0
267

368
This minor release introduces support for the new [v1.5.0](https://github.com/material-motion/motion-interchange-objc/releases/tag/v1.5.0) MotionInterchange format.

MotionAnimator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "MotionAnimator"
33
s.summary = "A Motion Animator creates performant, interruptible animations from motion specs."
4-
s.version = "2.7.0"
4+
s.version = "2.8.0"
55
s.authors = "The Material Motion Authors"
66
s.license = "Apache 2.0"
77
s.homepage = "https://github.com/material-motion/motion-animator-objc"

Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PODS:
22
- CatalogByConvention (2.2.0)
3-
- MotionAnimator (2.7.0):
3+
- MotionAnimator (2.8.0):
44
- MotionInterchange (~> 1.6)
55
- MotionInterchange (1.6.0)
66

@@ -14,7 +14,7 @@ EXTERNAL SOURCES:
1414

1515
SPEC CHECKSUMS:
1616
CatalogByConvention: 5df5831e48b8083b18570dcb804f20fd1c90694f
17-
MotionAnimator: fe012f4b344f091f95a621b0d0a97c4e2ea1c525
17+
MotionAnimator: 8af077dac084b7880a4d2ddae31a26171087bd87
1818
MotionInterchange: ead0e3ae1f3a5fb539e289debbc7ae036160a10d
1919

2020
PODFILE CHECKSUM: 3537bf01c11174928ac008c20fec4738722e96f3

README.md

Lines changed: 2 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,13 @@
1-
# Motion Animator
1+
![Motion Animator Banner](img/motion-animator-banner.gif)
22

3-
> A Motion Animator creates performant, interruptible animations from motion specs.
3+
> An animator for iOS 8+ that combines the best aspects of modern UIView and CALayer animation APIs.
44
55
[![Build Status](https://travis-ci.org/material-motion/motion-animator-objc.svg?branch=develop)](https://travis-ci.org/material-motion/motion-animator-objc)
66
[![codecov](https://codecov.io/gh/material-motion/motion-animator-objc/branch/develop/graph/badge.svg)](https://codecov.io/gh/material-motion/motion-animator-objc)
77
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/MotionAnimator.svg)](https://cocoapods.org/pods/MotionAnimator)
88
[![Platform](https://img.shields.io/cocoapods/p/MotionAnimator.svg)](http://cocoadocs.org/docsets/MotionAnimator)
99

10-
---
1110

12-
This library provides APIs that turn [Motion Interchange](https://github.com/material-motion/motion-interchange-objc)
13-
**motion specifications** into animations.
14-
15-
---
16-
17-
#### What is a motion specification?
18-
19-
A **motion specification** defines the delay, duration, and acceleration of animations in a simple
20-
data format that can live separate from your animation logic.
21-
22-
For example, let's say we wanted to describe the motion for this animation:
23-
24-
<img src="assets/chip.gif" />
25-
26-
We might create a specification like so:
27-
28-
```objc
29-
struct CalendarChipTiming {
30-
MDMMotionTiming chipWidth;
31-
MDMMotionTiming chipHeight;
32-
MDMMotionTiming chipY;
33-
34-
MDMMotionTiming chipContentOpacity;
35-
MDMMotionTiming headerContentOpacity;
36-
37-
MDMMotionTiming navigationBarY;
38-
};
39-
typedef struct CalendarChipTiming CalendarChipTiming;
40-
41-
struct CalendarChipMotionSpec {
42-
CalendarChipTiming expansion;
43-
CalendarChipTiming collapse;
44-
};
45-
typedef struct CalendarChipMotionSpec CalendarChipMotionSpec;
46-
47-
FOUNDATION_EXTERN struct CalendarChipMotionSpec CalendarChipSpec;
48-
```
49-
50-
With our implementation of the spec looking like so:
51-
52-
```objc
53-
struct CalendarChipMotionSpec CalendarChipSpec = {
54-
.expansion = {
55-
.chipWidth = {
56-
.delay = 0.000, .duration = 0.285, .curve = MDMEightyForty,
57-
},
58-
.chipHeight = {
59-
.delay = 0.015, .duration = 0.360, .curve = MDMEightyForty,
60-
},
61-
...
62-
},
63-
.collapse = {
64-
.chipWidth = {
65-
.delay = 0.045, .duration = 0.330, .curve = MDMEightyForty,
66-
},
67-
.chipHeight = {
68-
.delay = 0.000, .duration = 0.330, .curve = MDMEightyForty,
69-
},
70-
...
71-
},
72-
};
73-
```
74-
75-
Our spec defines two different transition states: expansion and collapse. At runtime, we determine
76-
which of these two specs we need and then use the timings to animate our views with an instance of
77-
`MDMMotionAnimator`:
78-
79-
```objc
80-
CalendarChipTiming timing = _expanded ? CalendarChipSpec.expansion : CalendarChipSpec.collapse;
81-
82-
MDMMotionAnimator *animator = [[MDMMotionAnimator alloc] init];
83-
animator.shouldReverseValues = !_expanded;
84-
85-
[animator animateWithTiming:timing.chipHeight
86-
toLayer:chipView.layer
87-
withValues:@[ @(chipFrame.size.height), @(headerFrame.size.height) ]
88-
keyPath:MDMKeyPathHeight];
89-
...
90-
```
91-
92-
A working implementation of this example can be seen in the included example app.
9311

9412
## Example apps/unit tests
9513

examples/TapToBounceExample.swift renamed to examples/TapToBounceTraitsExample.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
import UIKit
1818
import MotionAnimator
1919

20-
class TapToBounceExampleViewController: UIViewController {
20+
// This demo shows how to use animation traits to define the timings for an animation.
21+
class TapToBounceTraitsExampleViewController: UIViewController {
2122

2223
override func viewDidLoad() {
2324
super.viewDidLoad()
@@ -28,6 +29,10 @@ class TapToBounceExampleViewController: UIViewController {
2829
circle.bounds = CGRect(x: 0, y: 0, width: 128, height: 128)
2930
circle.center = view.center
3031
circle.layer.cornerRadius = circle.bounds.width / 2
32+
circle.layer.borderColor = UIColor(red: (CGFloat)(0x88) / 255.0,
33+
green: (CGFloat)(0xEF) / 255.0,
34+
blue: (CGFloat)(0xAA) / 255.0,
35+
alpha: 1).cgColor
3136
circle.backgroundColor = UIColor(red: (CGFloat)(0xEF) / 255.0,
3237
green: (CGFloat)(0x88) / 255.0,
3338
blue: (CGFloat)(0xAA) / 255.0,
@@ -50,13 +55,18 @@ class TapToBounceExampleViewController: UIViewController {
5055
let animator = MotionAnimator()
5156
animator.animate(with: traits) {
5257
sender.transform = CGAffineTransform(scaleX: 1.5, y: 1.5)
58+
59+
// This would normally not be animatable with the UIView animation APIs, but it is animatable
60+
// with the motion animator.
61+
sender.layer.borderWidth = 10
5362
}
5463
}
5564

5665
func didUnfocus(_ sender: UIButton) {
5766
let animator = MotionAnimator()
5867
animator.animate(with: traits) {
5968
sender.transform = .identity
69+
sender.layer.borderWidth = 0
6070
}
6171
}
6272
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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
18+
import MotionAnimator
19+
20+
// This demo shows how to the MotionAnimator UIKit-ish APIs for animating properties and is provided
21+
// as a contrast to the TapToBounceTraits example.
22+
class TapToBounceUIKitExampleViewController: UIViewController {
23+
24+
override func viewDidLoad() {
25+
super.viewDidLoad()
26+
27+
view.backgroundColor = .white
28+
29+
let circle = UIButton()
30+
circle.bounds = CGRect(x: 0, y: 0, width: 128, height: 128)
31+
circle.center = view.center
32+
circle.layer.cornerRadius = circle.bounds.width / 2
33+
circle.layer.borderColor = UIColor(red: (CGFloat)(0x88) / 255.0,
34+
green: (CGFloat)(0xEF) / 255.0,
35+
blue: (CGFloat)(0xAA) / 255.0,
36+
alpha: 1).cgColor
37+
circle.backgroundColor = UIColor(red: (CGFloat)(0xEF) / 255.0,
38+
green: (CGFloat)(0x88) / 255.0,
39+
blue: (CGFloat)(0xAA) / 255.0,
40+
alpha: 1)
41+
view.addSubview(circle)
42+
43+
circle.addTarget(self, action: #selector(didFocus),
44+
for: [.touchDown, .touchDragEnter])
45+
circle.addTarget(self, action: #selector(didUnfocus),
46+
for: [.touchUpInside, .touchUpOutside, .touchDragExit])
47+
}
48+
49+
func didFocus(_ sender: UIButton) {
50+
MotionAnimator.animate(withDuration: 0.8,
51+
delay: 0,
52+
usingSpringWithDamping: 0.5,
53+
initialSpringVelocity: 0,
54+
options: [],
55+
animations: {
56+
sender.transform = CGAffineTransform(scaleX: 1.5, y: 1.5)
57+
58+
// This would normally not be animatable with the UIView animation APIs, but it is animatable
59+
// with the motion animator.
60+
sender.layer.borderWidth = 10
61+
}, completion: nil)
62+
}
63+
64+
func didUnfocus(_ sender: UIButton) {
65+
MotionAnimator.animate(withDuration: 0.8,
66+
delay: 0,
67+
usingSpringWithDamping: 0.5,
68+
initialSpringVelocity: 0,
69+
options: [],
70+
animations: {
71+
sender.transform = .identity
72+
sender.layer.borderWidth = 0
73+
}, completion: nil)
74+
}
75+
}
76+

0 commit comments

Comments
 (0)