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

Commit

Permalink
Merge branch 'release-candidate' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Verkoeyen committed Dec 14, 2017
2 parents 292e4cc + 432585f commit f31562c
Show file tree
Hide file tree
Showing 38 changed files with 785 additions and 518 deletions.
4 changes: 2 additions & 2 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module: MotionAnimator
module_version: 2.6.0
module_version: 2.7.0
sdk: iphonesimulator
umbrella_header: src/MotionAnimator.h
objc: true
github_url: https://github.com/material-motion/motion-animator-objc
github_file_prefix: https://github.com/material-motion/motion-animator-objc/tree/v2.6.0
github_file_prefix: https://github.com/material-motion/motion-animator-objc/tree/v2.7.0
32 changes: 30 additions & 2 deletions .kokoro
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,35 @@ set -e
# Display commands to stderr.
set -x

KOKORO_RUNNER_VERSION="v3.*"
KOKORO_RUNNER_VERSION="v4.*"

POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"

case $key in
-v|--verbose)
VERBOSE_OUTPUT="1"
shift
;;
*)
POSITIONAL+=("$1")
shift
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters

if [ -n "$KOKORO_BUILD_NUMBER" ]; then
# Always enable verbose output on kokoro runs.
VERBOSE_OUTPUT=1
fi

if [ -n "$VERBOSE_OUTPUT" ]; then
# Display commands to stderr.
set -x
verbosity_args="-v"
fi

if [ ! -d .kokoro-ios-runner ]; then
git clone https://github.com/material-foundation/kokoro-ios-runner.git .kokoro-ios-runner
Expand All @@ -33,6 +61,6 @@ TAG=$(git tag --sort=v:refname -l "$KOKORO_RUNNER_VERSION" | tail -n1)
git checkout "$TAG" > /dev/null
popd

./.kokoro-ios-runner/bazel.sh test //:UnitTests 8.1.0
./.kokoro-ios-runner/bazel.sh test //:UnitTests --min-xcode-version 8.1.0 $verbosity_args

echo "Success!"
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ before_install:
- pod install --repo-update
script:
- set -o pipefail
- xcodebuild build -workspace MotionAnimator.xcworkspace -scheme MotionAnimatorCatalog -sdk "iphonesimulator10.3" -destination "name=iPhone 6s,OS=10.1" ONLY_ACTIVE_ARCH=YES | xcpretty -c;
- xcodebuild test -workspace MotionAnimator.xcworkspace -scheme MotionAnimatorCatalog -sdk "iphonesimulator10.3" -destination "name=iPhone 6s,OS=10.3.1" -enableCodeCoverage YES ONLY_ACTIVE_ARCH=YES | xcpretty -c;
after_success:
- bash <(curl -s https://codecov.io/bash)
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
# 2.7.0

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.

## New features

It is now possible to additively and implicitly animate the `transform` property of both UIView and CALayer.

## Source changes

* [Fix pre-iOS 11 unit test failure. (#89)](https://github.com/material-motion/motion-animator-objc/commit/7e506cc37b7d64d010b69d4996621755ece26595) (featherless)
* [Migrate to the Objective-C interchange format (#88)](https://github.com/material-motion/motion-animator-objc/commit/573b19269e155f15e05e9b146a1c324b937cfb1c) (featherless)
* [Revert "Update with ObjC implementation."](https://github.com/material-motion/motion-animator-objc/commit/f55625d9f63e857e878eff4e7687ddd40bad0fea) (Jeff Verkoeyen)
* [Update with ObjC implementation.](https://github.com/material-motion/motion-animator-objc/commit/be7f9081c0678484e034cc976aafcdab748b58bf) (Jeff Verkoeyen)
* [Add support for additively animating transform. (#85)](https://github.com/material-motion/motion-animator-objc/commit/e54ce3a118c1e877c5ca78a7d2fed9625d0ffc67) (featherless)

## API changes

Auto-generated by running:

apidiff origin/stable release-candidate objc src/MotionAnimator.h

#### MDMMotionAnimator

*new* method: `-animateWithTraits:animations:completion:` in `MDMMotionAnimator`

*new* method: `-animateWithTraits:between:layer:keyPath:` in `MDMMotionAnimator`

*new* method: `-animateWithTraits:animations:` in `MDMMotionAnimator`

*new* method: `-animateWithTraits:between:layer:keyPath:completion:` in `MDMMotionAnimator`

#### MDMKeyPathTransform

*new* constant: `MDMKeyPathTransform`

## Non-source changes

* [Update .travis.yml](https://github.com/material-motion/motion-animator-objc/commit/8f474dd545ec1b3e98db5ef783bca502351911e4) (featherless)
* [Enable coverage on travis](https://github.com/material-motion/motion-animator-objc/commit/45d43aa23a88c963927f4f01669e1b0ae26fb9e5) (featherless)
* [Update kokoro bazel runner for v4.](https://github.com/material-motion/motion-animator-objc/commit/67d903ed71fbc909ea06bb8097313a4218c8f566) (Jeff Verkoeyen)

# 2.6.0

This minor release increases test coverage, fixes a variety of bugs related to `beginFromCurrentState`, and generally improves the stability and robustness of the underlying implementation.
Expand Down
4 changes: 2 additions & 2 deletions MotionAnimator.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "MotionAnimator"
s.summary = "A Motion Animator creates performant, interruptible animations from motion specs."
s.version = "2.6.0"
s.version = "2.7.0"
s.authors = "The Material Motion Authors"
s.license = "Apache 2.0"
s.homepage = "https://github.com/material-motion/motion-animator-objc"
Expand All @@ -12,5 +12,5 @@ Pod::Spec.new do |s|
s.public_header_files = "src/*.h"
s.source_files = "src/*.{h,m,mm}", "src/private/*.{h,m,mm}"

s.dependency "MotionInterchange", "~> 1.3"
s.dependency "MotionInterchange", "~> 1.6"
end
10 changes: 5 additions & 5 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PODS:
- CatalogByConvention (2.2.0)
- MotionAnimator (2.6.0):
- MotionInterchange (~> 1.3)
- MotionInterchange (1.3.0)
- MotionAnimator (2.7.0):
- MotionInterchange (~> 1.6)
- MotionInterchange (1.6.0)

DEPENDENCIES:
- CatalogByConvention
Expand All @@ -14,8 +14,8 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
CatalogByConvention: 5df5831e48b8083b18570dcb804f20fd1c90694f
MotionAnimator: a4b0ba87a674bb3e89e25f0530b7e80a204ac1c1
MotionInterchange: 988fc0011e4b806cc33f2fb4f9566f5eeb4159e8
MotionAnimator: fe012f4b344f091f95a621b0d0a97c4e2ea1c525
MotionInterchange: ead0e3ae1f3a5fb539e289debbc7ae036160a10d

PODFILE CHECKSUM: 3537bf01c11174928ac008c20fec4738722e96f3

Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ git_repository(
git_repository(
name = "motion_interchange_objc",
remote = "https://github.com/material-motion/motion-interchange-objc.git",
tag = "v1.3.0",
tag = "v1.6.0",
)
80 changes: 41 additions & 39 deletions examples/CalendarCardExpansionExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

#import "MotionAnimator.h"

// This example demonstrates how to use a motion timing specification to build a complex
// This example demonstrates how to use a motion traits specification to build a complex
// bi-directional animation using the MDMMotionAnimator object. MDMMotionAnimator is designed for
// building fine-tuned explicit animations. Unlike UIView's implicit animation API, which can be
// used to cause cascading animations on a variety of properties, MDMMotionAnimator will always add
// exactly one animation per key path to the layer. This means you don't get as much for "free", but
// you do gain more control over the timing and motion of the animation.
// you do gain more control over the traits and motion of the animation.

@implementation CalendarCardExpansionExampleViewController {
// In a real-world scenario we'd likely create a separate view to manage all of these subviews so
Expand All @@ -40,81 +40,83 @@ @implementation CalendarCardExpansionExampleViewController {
- (void)didTap {
_expanded = !_expanded;

CalendarChipTiming timing = (_expanded
? CalendarChipMotionSpec.expansion
: CalendarChipMotionSpec.collapse);
id<CalendarChipTiming> traits = (_expanded
? CalendarChipMotionSpec.expansion
: CalendarChipMotionSpec.collapse);

MDMMotionAnimator *animator = [[MDMMotionAnimator alloc] init];
animator.shouldReverseValues = !_expanded;
animator.beginFromCurrentState = YES;

[animator animateWithTiming:timing.navigationBarY animations:^{
[animator animateWithTraits:traits.navigationBarY animations:^{
[self.navigationController setNavigationBarHidden:_expanded animated:YES];
}];

CGRect chipFrame = [self frameForChip];
CGRect headerFrame = [self frameForHeader];

// Animate the chip itself.
[animator animateWithTiming:timing.chipHeight
toLayer:_chipView.layer
withValues:@[ @(chipFrame.size.height), @(headerFrame.size.height) ]
[animator animateWithTraits:traits.chipHeight
between:@[ @(chipFrame.size.height), @(headerFrame.size.height) ]
layer:_chipView.layer
keyPath:MDMKeyPathHeight];
[animator animateWithTiming:timing.chipWidth
toLayer:_chipView.layer
withValues:@[ @(chipFrame.size.width), @(headerFrame.size.width) ]
[animator animateWithTraits:traits.chipWidth
between:@[ @(chipFrame.size.width), @(headerFrame.size.width) ]
layer:_chipView.layer
keyPath:MDMKeyPathWidth];
[animator animateWithTiming:timing.chipWidth
toLayer:_chipView.layer
withValues:@[ @(CGRectGetMidX(chipFrame)), @(CGRectGetMidX(headerFrame)) ]
[animator animateWithTraits:traits.chipWidth
between:@[ @(CGRectGetMidX(chipFrame)), @(CGRectGetMidX(headerFrame)) ]
layer:_chipView.layer
keyPath:MDMKeyPathX];
[animator animateWithTiming:timing.chipY
toLayer:_chipView.layer
withValues:@[ @(CGRectGetMidY(chipFrame)), @(CGRectGetMidY(headerFrame)) ]
[animator animateWithTraits:traits.chipY
between:@[ @(CGRectGetMidY(chipFrame)), @(CGRectGetMidY(headerFrame)) ]
layer:_chipView.layer
keyPath:MDMKeyPathY];
[animator animateWithTiming:timing.chipHeight
toLayer:_chipView.layer
withValues:@[ @([self chipCornerRadius]), @0 ]
[animator animateWithTraits:traits.chipHeight
between:@[ @([self chipCornerRadius]), @0 ]
layer:_chipView.layer
keyPath:MDMKeyPathCornerRadius];

// Cross-fade the chip's contents.
[animator animateWithTiming:timing.chipContentOpacity
toLayer:_collapsedContent.layer
withValues:@[ @1, @0 ]
[animator animateWithTraits:traits.chipContentOpacity
between:@[ @1, @0 ]
layer:_collapsedContent.layer
keyPath:MDMKeyPathOpacity];
[animator animateWithTiming:timing.headerContentOpacity
toLayer:_expandedContent.layer
withValues:@[ @0, @1 ]
[animator animateWithTraits:traits.headerContentOpacity
between:@[ @0, @1 ]
layer:_expandedContent.layer
keyPath:MDMKeyPathOpacity];

// Keeps the expandec content aligned to the bottom of the card by taking into consideration the
// extra height.
CGFloat excessTopMargin = chipFrame.size.height - headerFrame.size.height;
[animator animateWithTiming:timing.chipHeight
toLayer:_expandedContent.layer
withValues:@[ @(CGRectGetMidY([self expandedContentFrame]) + excessTopMargin),
[animator animateWithTraits:traits.chipHeight
between:@[ @(CGRectGetMidY([self expandedContentFrame]) + excessTopMargin),
@(CGRectGetMidY([self expandedContentFrame])) ]
layer:_expandedContent.layer
keyPath:MDMKeyPathY];

// Keeps the collapsed content aligned to its position on screen by taking into consideration the
// excess left margin.
CGFloat excessLeftMargin = chipFrame.origin.x - headerFrame.origin.x;
[animator animateWithTiming:timing.chipWidth
toLayer:_collapsedContent.layer
withValues:@[ @(CGRectGetMidX([self collapsedContentFrame])),
[animator animateWithTraits:traits.chipWidth
between:@[ @(CGRectGetMidX([self collapsedContentFrame])),
@(CGRectGetMidX([self collapsedContentFrame]) + excessLeftMargin) ]
layer:_collapsedContent.layer
keyPath:MDMKeyPathX];

// Keeps the shape anchored to the bottom right of the chip.
CGRect shapeFrameInChip = [self shapeFrameInRect:chipFrame];
CGRect shapeFrameInHeader = [self shapeFrameInRect:headerFrame];
[animator animateWithTiming:timing.chipWidth
toLayer:_shapeView.layer
withValues:@[ @(CGRectGetMidX(shapeFrameInChip)), @(CGRectGetMidX(shapeFrameInHeader)) ]
[animator animateWithTraits:traits.chipWidth
between:@[ @(CGRectGetMidX(shapeFrameInChip)),
@(CGRectGetMidX(shapeFrameInHeader)) ]
layer:_shapeView.layer
keyPath:MDMKeyPathX];
[animator animateWithTiming:timing.chipHeight
toLayer:_shapeView.layer
withValues:@[ @(CGRectGetMidY(shapeFrameInChip)), @(CGRectGetMidY(shapeFrameInHeader)) ]
[animator animateWithTraits:traits.chipHeight
between:@[ @(CGRectGetMidY(shapeFrameInChip)),
@(CGRectGetMidY(shapeFrameInHeader)) ]
layer:_shapeView.layer
keyPath:MDMKeyPathY];
}

Expand Down
24 changes: 13 additions & 11 deletions examples/CalendarChipMotionSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,26 @@
#import <Foundation/Foundation.h>
#import <MotionInterchange/MotionInterchange.h>

typedef struct CalendarChipTiming {
MDMMotionTiming chipWidth;
MDMMotionTiming chipHeight;
MDMMotionTiming chipY;
@protocol CalendarChipTiming <NSObject>

MDMMotionTiming chipContentOpacity;
MDMMotionTiming headerContentOpacity;
@property(nonatomic, strong, nonnull, readonly) MDMAnimationTraits *chipWidth;
@property(nonatomic, strong, nonnull, readonly) MDMAnimationTraits *chipHeight;
@property(nonatomic, strong, nonnull, readonly) MDMAnimationTraits *chipY;

MDMMotionTiming navigationBarY;
} CalendarChipTiming;
@property(nonatomic, strong, nonnull, readonly) MDMAnimationTraits *chipContentOpacity;
@property(nonatomic, strong, nonnull, readonly) MDMAnimationTraits *headerContentOpacity;

@property(nonatomic, strong, nonnull, readonly) MDMAnimationTraits *navigationBarY;

@end

@interface CalendarChipMotionSpec: NSObject

@property(nonatomic, class, readonly) CalendarChipTiming expansion;
@property(nonatomic, class, readonly) CalendarChipTiming collapse;
@property(nonatomic, class, strong, nonnull, readonly) id<CalendarChipTiming> expansion;
@property(nonatomic, class, strong, nonnull, readonly) id<CalendarChipTiming> collapse;

// This object is not meant to be instantiated.
- (instancetype)init NS_UNAVAILABLE;
- (nonnull instancetype)init NS_UNAVAILABLE;

@end

Loading

0 comments on commit f31562c

Please sign in to comment.