Merge branch 'release-candidate' into stable
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c25b775..bc8ed4d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,34 @@
+# 1.3.0
+
+This minor releases introduces new APIs for defining motion curves.
+
+## New deprecations
+
+`MDMMotionCurveTypeDefault` is now deprecated. Use `MDMMotionCurveTypeBezier` instead.
+
+## New features
+
+The new `MDMLinearMotionCurve` macro allows you to define linear easing curves in specs.
+
+Spring curve specs can now define initial velocity. This value can be read using the new
+`MDMSpringMotionCurveDataIndexInitialVelocity` enum value for `MDMSpringMotionCurveDataIndex`.
+
+## Source changes
+
+* [Document and define the initial velocity parameter of spring curves (#17)](https://github.com/material-motion/motion-interchange-objc/commit/7eb5e2f79229c3b7cdada7b8df3e1e66b7e229e5) (featherless)
+* [Add a linear curve constant. (#16)](https://github.com/material-motion/motion-interchange-objc/commit/0aa4f8caff7314310c3cbd721814305ee6f53601) (featherless)
+* [Deprecate MDMMotionCurveTypeDefault in favor of MDMMotionCurveTypeBezier. (#15)](https://github.com/material-motion/motion-interchange-objc/commit/f5a7f3b4a63d4643700403930e2cafd7d4482013) (featherless)
+
+## API changes
+
+### MDMSpringMotionCurveDataIndexInitialVelocity
+
+**new** enum: `MDMSpringMotionCurveDataIndexInitialVelocity`.
+
+### MDMLinearMotionCurve
+
+**new** constant/macro: `MDMLinearMotionCurve`.
+
# 1.2.0
This minor release introduces a new API for reversing cubic beziers and a unit test for
diff --git a/MotionInterchange.podspec b/MotionInterchange.podspec
index 5d5cc55..ff98c90 100644
--- a/MotionInterchange.podspec
+++ b/MotionInterchange.podspec
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "MotionInterchange"
s.summary = "Motion interchange format."
- s.version = "1.2.0"
+ s.version = "1.3.0"
s.authors = "The Material Motion Authors"
s.license = "Apache 2.0"
s.homepage = "https://github.com/material-motion/motion-interchange-objc"
diff --git a/Podfile.lock b/Podfile.lock
index ef0bf5f..99c3b47 100644
--- a/Podfile.lock
+++ b/Podfile.lock
@@ -1,6 +1,6 @@
PODS:
- CatalogByConvention (2.1.1)
- - MotionInterchange (1.2.0)
+ - MotionInterchange (1.3.0)
DEPENDENCIES:
- CatalogByConvention
@@ -12,7 +12,7 @@
SPEC CHECKSUMS:
CatalogByConvention: c3a5319de04250a7cd4649127fcfca5fe3322a43
- MotionInterchange: 499c98e7628a8a078905749734dbfedbfae54cca
+ MotionInterchange: 988fc0011e4b806cc33f2fb4f9566f5eeb4159e8
PODFILE CHECKSUM: 09090d12db5aab00a13fe82da94f338ebd03f5dc
diff --git a/src/MDMMotionCurve.h b/src/MDMMotionCurve.h
index 6eace63..4aab196 100644
--- a/src/MDMMotionCurve.h
+++ b/src/MDMMotionCurve.h
@@ -43,7 +43,7 @@
/**
The default curve will be used.
*/
- MDMMotionCurveTypeDefault,
+ MDMMotionCurveTypeDefault __deprecated_enum_msg("Use MDMMotionCurveTypeBezier instead."),
} NS_SWIFT_NAME(MotionCurveType);
@@ -119,7 +119,18 @@
typedef NS_ENUM(NSUInteger, MDMSpringMotionCurveDataIndex) {
MDMSpringMotionCurveDataIndexMass,
MDMSpringMotionCurveDataIndexTension,
- MDMSpringMotionCurveDataIndexFriction
+ MDMSpringMotionCurveDataIndexFriction,
+
+ /**
+ The initial velocity of the animation.
+
+ A value of zero indicates no initial velocity.
+ A positive value indicates movement toward the destination.
+ A negative value indicates movement away from the destination.
+
+ The value's units are dependent on the context and the value being animated.
+ */
+ MDMSpringMotionCurveDataIndexInitialVelocity
} NS_SWIFT_NAME(SpringMotionCurveDataIndex);
// Objective-C-specific macros
@@ -142,6 +153,11 @@
}
/**
+ A linear bezier motion curve.
+ */
+#define MDMLinearMotionCurve _MDMBezier(0, 0, 1, 1)
+
+/**
Timing information for an iOS modal presentation slide animation.
*/
#define MDMModalMovementTiming { \
diff --git a/tests/unit/MDMMotionCurveTests.m b/tests/unit/MDMMotionCurveTests.m
index 2d7da8c..0cf4941 100644
--- a/tests/unit/MDMMotionCurveTests.m
+++ b/tests/unit/MDMMotionCurveTests.m
@@ -23,6 +23,25 @@
@implementation MDMMotionCurveTests
+- (void)testLinearCurveConstantMatchesSystemLinearCurve {
+ MDMMotionCurve curve = MDMLinearMotionCurve;
+ CAMediaTimingFunction *linearTimingFunction =
+ [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
+ MDMMotionCurve systemLinearCurve = MDMMotionCurveFromTimingFunction(linearTimingFunction);
+ XCTAssertEqualWithAccuracy(curve.data[MDMBezierMotionCurveDataIndexP1X],
+ systemLinearCurve.data[MDMBezierMotionCurveDataIndexP1X],
+ 0.001);
+ XCTAssertEqualWithAccuracy(curve.data[MDMBezierMotionCurveDataIndexP1Y],
+ systemLinearCurve.data[MDMBezierMotionCurveDataIndexP1Y],
+ 0.001);
+ XCTAssertEqualWithAccuracy(curve.data[MDMBezierMotionCurveDataIndexP2X],
+ systemLinearCurve.data[MDMBezierMotionCurveDataIndexP2X],
+ 0.001);
+ XCTAssertEqualWithAccuracy(curve.data[MDMBezierMotionCurveDataIndexP2Y],
+ systemLinearCurve.data[MDMBezierMotionCurveDataIndexP2Y],
+ 0.001);
+}
+
- (void)testBezierCurveData {
MDMMotionCurve curve = MDMMotionCurveMakeBezier(0.1f, 0.2f, 0.3f, 0.4f);
XCTAssertEqualWithAccuracy(curve.data[MDMBezierMotionCurveDataIndexP1X], 0.1, 0.001);