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

Commit f05e787

Browse files
authored
Document each animatable key path. (#65)
1 parent 18a0edd commit f05e787

File tree

1 file changed

+151
-1
lines changed

1 file changed

+151
-1
lines changed

src/MDMAnimatableKeyPaths.h

Lines changed: 151 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,173 @@
2727
#endif
2828

2929
/**
30-
A representation of an animatable key path. Likely not exhaustive.
30+
A representation of an animatable key path.
31+
32+
This is NOT an exhaustive list of animatable properties; it only documents properties that are
33+
officially supported by the animator. If you animate unsupported properties then the resulting
34+
behavior is undefined.
35+
36+
Each property documents whether or not it supports being animated additively. This affects the
37+
behavior of animations when a MDMMotionAnimator's additive property is enabled. Properties that
38+
support additive animations can change direction mid-way through the animation while appearing
39+
to preserve momentum. Properties that do not support additive animation will instantly start
40+
animating towards the new toValue.
3141
*/
3242
NS_SWIFT_NAME(AnimatableKeyPath)
3343
typedef NSString * const MDMAnimatableKeyPath CF_TYPED_ENUM;
3444

45+
/**
46+
Background color.
47+
48+
Equivalent UIView property: backgroundColor
49+
Equivalent CALayer property: backgroundColor
50+
Expected value type: UIColor or CGColor.
51+
Additive animation supported: No.
52+
*/
3553
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathBackgroundColor NS_SWIFT_NAME(backgroundColor);
54+
55+
/**
56+
Corner radius.
57+
58+
Equivalent UIView property: N/A
59+
Equivalent CALayer property: cornerRadius
60+
Expected value type: CGFloat or NSNumber.
61+
Additive animation supported: Yes.
62+
*/
3663
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathCornerRadius NS_SWIFT_NAME(cornerRadius);
64+
65+
/**
66+
Height.
67+
68+
Equivalent UIView property: bounds.size.height
69+
Equivalent CALayer property: bounds.size.height
70+
Expected value type: CGFloat or NSNumber.
71+
Additive animation supported: Yes.
72+
*/
3773
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathHeight NS_SWIFT_NAME(height);
74+
75+
/**
76+
Opacity.
77+
78+
Equivalent UIView property: alpha
79+
Equivalent CALayer property: opacity
80+
Expected value type: CGFloat or NSNumber.
81+
Additive animation supported: Yes.
82+
TODO( https://github.com/material-motion/motion-animator-objc/issues/61 ):
83+
Disable additive animations for opacity.
84+
*/
3885
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathOpacity NS_SWIFT_NAME(opacity);
86+
87+
/**
88+
Position.
89+
90+
Equivalent UIView property: center if the layer's anchorPoint is 0.5, 0.5. N/A otherwise.
91+
Equivalent CALayer property: position
92+
Expected value type: CGPoint or NSValue (containing a CGPoint).
93+
Additive animation supported: Yes.
94+
*/
3995
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathPosition NS_SWIFT_NAME(position);
96+
97+
/**
98+
Rotation.
99+
100+
Equivalent UIView property: transform.rotation.z
101+
Equivalent CALayer property: transform.rotation.z
102+
Expected value type: CGFloat or NSNumber.
103+
Additive animation supported: Yes.
104+
*/
40105
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathRotation NS_SWIFT_NAME(rotation);
106+
107+
/**
108+
Scale.
109+
110+
Uniform scale along both the x and y axis.
111+
112+
Equivalent UIView property: transform.scale
113+
Equivalent CALayer property: transform.scale
114+
Expected value type: CGFloat or NSNumber.
115+
Additive animation supported: Yes.
116+
*/
41117
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathScale NS_SWIFT_NAME(scale);
118+
119+
/**
120+
Shadow offset.
121+
122+
Equivalent UIView property: N/A
123+
Equivalent CALayer property: shadowOffset
124+
Expected value type: CGSize or NSValue (containing a CGSize).
125+
Additive animation supported: Yes.
126+
*/
42127
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathShadowOffset NS_SWIFT_NAME(shadowOffset);
128+
129+
/**
130+
Shadow opacity.
131+
132+
Equivalent UIView property: N/A
133+
Equivalent CALayer property: shadowOpacity
134+
Expected value type: CGFloat or NSNumber.
135+
Additive animation supported: Yes.
136+
*/
43137
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathShadowOpacity NS_SWIFT_NAME(shadowOpacity);
138+
139+
/**
140+
Shadow radius.
141+
142+
Equivalent UIView property: N/A
143+
Equivalent CALayer property: shadowRadius
144+
Expected value type: CGFloat or NSNumber.
145+
Additive animation supported: Yes.
146+
*/
44147
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathShadowRadius NS_SWIFT_NAME(shadowRadius);
148+
149+
/**
150+
Stroke start.
151+
152+
Equivalent UIView property: N/A
153+
Equivalent CALayer property: N/A
154+
Equivalent CAShapeLayer property: strokeStart
155+
Expected value type: CGFloat or NSNumber.
156+
Additive animation supported: Yes.
157+
*/
45158
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathStrokeStart NS_SWIFT_NAME(strokeStart);
159+
160+
/**
161+
Stroke end.
162+
163+
Equivalent UIView property: N/A
164+
Equivalent CALayer property: N/A
165+
Equivalent CAShapeLayer property: strokeEnd
166+
Expected value type: CGFloat or NSNumber.
167+
Additive animation supported: Yes.
168+
*/
46169
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathStrokeEnd NS_SWIFT_NAME(strokeEnd);
170+
171+
/**
172+
Width.
173+
174+
Equivalent UIView property: bounds.size.width
175+
Equivalent CALayer property: bounds.size.width
176+
Expected value type: CGFloat or NSNumber.
177+
Additive animation supported: Yes.
178+
*/
47179
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathWidth NS_SWIFT_NAME(width);
180+
181+
/**
182+
X position.
183+
184+
Equivalent UIView property: center.x if the layer's anchorPoint.x is 0.5. N/A otherwise.
185+
Equivalent CALayer property: position.x
186+
Expected value type: CGFloat or NSNumber.
187+
Additive animation supported: Yes.
188+
*/
48189
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathX NS_SWIFT_NAME(x);
190+
191+
/**
192+
Y position.
193+
194+
Equivalent UIView property: center.y if the layer's anchorPoint.y is 0.5. N/A otherwise.
195+
Equivalent CALayer property: position.y
196+
Expected value type: CGFloat or NSNumber.
197+
Additive animation supported: Yes.
198+
*/
49199
FOUNDATION_EXPORT MDMAnimatableKeyPath MDMKeyPathY NS_SWIFT_NAME(y);

0 commit comments

Comments
 (0)