Skip to content

Commit 9672341

Browse files
committed
ver 1.2
1 parent 4b7f76a commit 9672341

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

loadingview/src/main/java/com/mmdev/loadingviewlib/LoadingView.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class LoadingView @JvmOverloads constructor(
8989
private val animatorSet = AnimatorSet()
9090

9191
//rotating whole view
92-
private val viewRotateAnimator = ValueAnimator.ofFloat(0f, 360f).apply {
92+
private fun viewRotateAnimator() = ValueAnimator.ofFloat(0f, 360f).apply {
9393
duration = 1600
9494
interpolator = LinearInterpolator()
9595
repeatCount = ValueAnimator.INFINITE
@@ -98,7 +98,7 @@ class LoadingView @JvmOverloads constructor(
9898
}
9999

100100
//animate 3 sweeps inside view
101-
private val angleAnimator = ValueAnimator.ofFloat(5f, 105f).apply {
101+
private fun angleAnimator() = ValueAnimator.ofFloat(5f, 105f).apply {
102102
duration = 800
103103
// god given custom interpolator
104104
interpolator = PathInterpolatorCompat.create(1f, 0f, 0f, 1f)
@@ -167,7 +167,7 @@ class LoadingView @JvmOverloads constructor(
167167
// auto start animation on pre-draw stage
168168
// no need to toggle
169169
animatorSet.cancel()
170-
animatorSet.playTogether(angleAnimator, viewRotateAnimator)
170+
animatorSet.playTogether(angleAnimator(), viewRotateAnimator())
171171
animatorSet.start()
172172
}
173173

0 commit comments

Comments
 (0)