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

Commit 23cd380

Browse files
authored
Add support for animating z position. (#96)
1 parent 32c78d4 commit 23cd380

File tree

7 files changed

+17
-1
lines changed

7 files changed

+17
-1
lines changed

src/MDMAnimatableKeyPaths.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,13 @@ FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathX NS_SWIFT_NAME(x);
218218
Additive animation supported: Yes.
219219
*/
220220
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathY NS_SWIFT_NAME(y);
221+
222+
/**
223+
Z position.
224+
225+
Equivalent UIView property: N/A
226+
Equivalent CALayer property: zPosition
227+
Expected value type: CGFloat or NSNumber.
228+
Additive animation supported: Yes.
229+
*/
230+
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathZ NS_SWIFT_NAME(z);

src/MDMAnimatableKeyPaths.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@
3333
MDMAnimatableKeyPath MDMKeyPathWidth = @"bounds.size.width";
3434
MDMAnimatableKeyPath MDMKeyPathX = @"position.x";
3535
MDMAnimatableKeyPath MDMKeyPathY = @"position.y";
36+
MDMAnimatableKeyPath MDMKeyPathZ = @"zPosition";

src/private/MDMBlockAnimations.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
MDMKeyPathTransform,
4444
MDMKeyPathWidth,
4545
MDMKeyPathX,
46-
MDMKeyPathY]];
46+
MDMKeyPathY,
47+
MDMKeyPathZ]];
4748
});
4849
return animatableKeyPaths;
4950
}

tests/unit/MotionAnimatorBehavioralTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class AnimatorBehavioralTests: XCTestCase {
6060
.width: 25,
6161
.x: 12,
6262
.y: 23,
63+
.z: 3,
6364
]
6465

6566
func testAllKeyPathsExplicitlyAnimateWithLayerBackingUIView() {

tests/unit/QuartzCoreBehavioralTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class QuartzCoreBehavioralTests: XCTestCase {
8585
.width: 25,
8686
.x: 12,
8787
.y: 23,
88+
.z: 3,
8889
]
8990
for (keyPath, value) in properties {
9091
rebuildLayer()

tests/unit/UIKitBehavioralTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ class UIKitBehavioralTests: XCTestCase {
144144
.shadowRadius: 5,
145145
.strokeStart: 0.2,
146146
.strokeEnd: 0.5,
147+
.z: 3,
147148
]
148149

149150
let properties: [AnimatableKeyPath: Any]

tests/unit/UIKitEquivalencyTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class UIKitEquivalencyTests: XCTestCase {
6969
.transform: CGAffineTransform(scaleX: 1.5, y: 1.5),
7070
.x: 12,
7171
.y: 23,
72+
.z: 3,
7273

7374
// Should animate additively, but blocked by
7475
// https://github.com/material-motion/motion-animator-objc/issues/74

0 commit comments

Comments
 (0)