@@ -18,6 +18,8 @@ class ViewPropertySpringAnimator<T : View>(
1818 }
1919
2020 private val pendingAnimations = mutableListOf<SpringAnimationHolder >()
21+
22+ // Contains pending animations and running animations
2123 private val animatorMap = mutableMapOf<FloatPropertyCompat <in T >, SpringAnimation > ()
2224 val isRunning: Boolean
2325 get() = animatorMap.values.any { it.isRunning }
@@ -40,6 +42,9 @@ class ViewPropertySpringAnimator<T : View>(
4042 ): ViewPropertySpringAnimator <T > =
4143 animateProperty(DynamicAnimation .X , value, config)
4244
45+ /* *
46+ * Eager evaluate the final value from the current value.
47+ */
4348 fun xBy (
4449 value : Float ,
4550 config : SpringAnimationConfig .() -> Unit = {}
@@ -52,6 +57,9 @@ class ViewPropertySpringAnimator<T : View>(
5257 ): ViewPropertySpringAnimator <T > =
5358 animateProperty(DynamicAnimation .Y , value, config)
5459
60+ /* *
61+ * Eager evaluate the final value from the current value.
62+ */
5563 fun yBy (
5664 value : Float ,
5765 config : SpringAnimationConfig .() -> Unit = {}
@@ -64,6 +72,9 @@ class ViewPropertySpringAnimator<T : View>(
6472 ): ViewPropertySpringAnimator <T > =
6573 animateProperty(DynamicAnimation .Z , value, config)
6674
75+ /* *
76+ * Eager evaluate the final value from the current value.
77+ */
6778 fun zBy (
6879 value : Float ,
6980 config : SpringAnimationConfig .() -> Unit = {}
@@ -76,6 +87,9 @@ class ViewPropertySpringAnimator<T : View>(
7687 ): ViewPropertySpringAnimator <T > =
7788 animateProperty(DynamicAnimation .ROTATION , value, config)
7889
90+ /* *
91+ * Eager evaluate the final value from the current value.
92+ */
7993 fun rotationBy (
8094 value : Float ,
8195 config : SpringAnimationConfig .() -> Unit = {}
@@ -88,6 +102,9 @@ class ViewPropertySpringAnimator<T : View>(
88102 ): ViewPropertySpringAnimator <T > =
89103 animateProperty(DynamicAnimation .ROTATION_X , value, config)
90104
105+ /* *
106+ * Eager evaluate the final value from the current value.
107+ */
91108 fun rotationXBy (
92109 value : Float ,
93110 config : SpringAnimationConfig .() -> Unit = {}
@@ -100,6 +117,9 @@ class ViewPropertySpringAnimator<T : View>(
100117 ): ViewPropertySpringAnimator <T > =
101118 animateProperty(DynamicAnimation .ROTATION_Y , value, config)
102119
120+ /* *
121+ * Eager evaluate the final value from the current value.
122+ */
103123 fun rotationYBy (
104124 value : Float ,
105125 config : SpringAnimationConfig .() -> Unit = {}
@@ -112,6 +132,9 @@ class ViewPropertySpringAnimator<T : View>(
112132 ): ViewPropertySpringAnimator <T > =
113133 animateProperty(DynamicAnimation .TRANSLATION_X , value, config)
114134
135+ /* *
136+ * Eager evaluate the final value from the current value.
137+ */
115138 fun translationXBy (
116139 value : Float ,
117140 config : SpringAnimationConfig .() -> Unit = {}
@@ -124,6 +147,9 @@ class ViewPropertySpringAnimator<T : View>(
124147 ): ViewPropertySpringAnimator <T > =
125148 animateProperty(DynamicAnimation .TRANSLATION_Y , value, config)
126149
150+ /* *
151+ * Eager evaluate the final value from the current value.
152+ */
127153 fun translationYBy (
128154 value : Float ,
129155 config : SpringAnimationConfig .() -> Unit = {}
@@ -136,6 +162,9 @@ class ViewPropertySpringAnimator<T : View>(
136162 ): ViewPropertySpringAnimator <T > =
137163 animateProperty(DynamicAnimation .TRANSLATION_Z , value, config)
138164
165+ /* *
166+ * Eager evaluate the final value from the current value.
167+ */
139168 fun translationZBy (
140169 value : Float ,
141170 config : SpringAnimationConfig .() -> Unit = {}
@@ -148,6 +177,9 @@ class ViewPropertySpringAnimator<T : View>(
148177 ): ViewPropertySpringAnimator <T > =
149178 animateProperty(DynamicAnimation .SCALE_X , value, config)
150179
180+ /* *
181+ * Eager evaluate the final value from the current value.
182+ */
151183 fun scaleXBy (
152184 value : Float ,
153185 config : SpringAnimationConfig .() -> Unit = {}
@@ -160,6 +192,9 @@ class ViewPropertySpringAnimator<T : View>(
160192 ): ViewPropertySpringAnimator <T > =
161193 animateProperty(DynamicAnimation .SCALE_Y , value, config)
162194
195+ /* *
196+ * Eager evaluate the final value from the current value.
197+ */
163198 fun scaleYBy (
164199 value : Float ,
165200 config : SpringAnimationConfig .() -> Unit = {}
@@ -172,12 +207,18 @@ class ViewPropertySpringAnimator<T : View>(
172207 ): ViewPropertySpringAnimator <T > =
173208 animateProperty(DynamicAnimation .ALPHA , value, config)
174209
210+ /* *
211+ * Eager evaluate the final value from the current value.
212+ */
175213 fun alphaBy (
176214 value : Float ,
177215 config : SpringAnimationConfig .() -> Unit = {}
178216 ): ViewPropertySpringAnimator <T > =
179217 animatePropertyBy(DynamicAnimation .ALPHA , value, config)
180218
219+ /* *
220+ * A new [SpringAnimation] will be created every time you call this method.
221+ */
181222 fun animateProperty (
182223 value : Float ,
183224 setter : T .(Float ) -> Unit ,
@@ -186,6 +227,10 @@ class ViewPropertySpringAnimator<T : View>(
186227 ): ViewPropertySpringAnimator <T > =
187228 animateProperty(createCustomProperty(setter, getter), value, config)
188229
230+ /* *
231+ * Eager evaluate the final value from the current value.
232+ * A new [SpringAnimation] will be created every time you call this method.
233+ */
189234 fun animatePropertyBy (
190235 setter : T .(Float ) -> Unit ,
191236 getter : T .() -> Float ,
@@ -202,6 +247,9 @@ class ViewPropertySpringAnimator<T : View>(
202247 animatePropertyInternal(property, value, config)
203248 }
204249
250+ /* *
251+ * Eager evaluate the final value from the current value.
252+ */
205253 fun animatePropertyBy (
206254 property : FloatPropertyCompat <in T >,
207255 value : Float ,
0 commit comments