Skip to content

Commit

Permalink
ver 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
muramrr committed Aug 21, 2020
1 parent 4b7f76a commit 9672341
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class LoadingView @JvmOverloads constructor(
private val animatorSet = AnimatorSet()

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

//animate 3 sweeps inside view
private val angleAnimator = ValueAnimator.ofFloat(5f, 105f).apply {
private fun angleAnimator() = ValueAnimator.ofFloat(5f, 105f).apply {
duration = 800
// god given custom interpolator
interpolator = PathInterpolatorCompat.create(1f, 0f, 0f, 1f)
Expand Down Expand Up @@ -167,7 +167,7 @@ class LoadingView @JvmOverloads constructor(
// auto start animation on pre-draw stage
// no need to toggle
animatorSet.cancel()
animatorSet.playTogether(angleAnimator, viewRotateAnimator)
animatorSet.playTogether(angleAnimator(), viewRotateAnimator())
animatorSet.start()
}

Expand Down

0 comments on commit 9672341

Please sign in to comment.