Last active
August 8, 2020 16:48
-
-
Save Skyyo/5835dbffd75cb841e7f869de17e14dc1 to your computer and use it in GitHub Desktop.
#extensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.skyyo.ext | |
import android.animation.AnimatorSet | |
import android.animation.ObjectAnimator | |
import android.view.View | |
fun View.flipInX(): AnimatorSet { | |
val animatorSet = AnimatorSet() | |
val object1: ObjectAnimator = ObjectAnimator.ofFloat(this, "alpha", 0.25f, 0.5f, 0.75f, 1f) | |
val object2: ObjectAnimator = ObjectAnimator.ofFloat(this, "rotationX", 90f, -15f, 15f, 0f) | |
animatorSet.playTogether(object1, object2) | |
return animatorSet | |
} | |
fun View.flipInY(): AnimatorSet { | |
val animatorSet = AnimatorSet() | |
val object1: ObjectAnimator = ObjectAnimator.ofFloat(this, "alpha", 0.25f, 0.5f, 0.75f, 1f) | |
val object2: ObjectAnimator = ObjectAnimator.ofFloat(this, "rotationY", 90f, -15f, 15f, 0f) | |
animatorSet.playTogether(object1, object2) | |
return animatorSet | |
} | |
fun View.flipOutX(): AnimatorSet { | |
val animatorSet = AnimatorSet() | |
val object1: ObjectAnimator = ObjectAnimator.ofFloat(this, "alpha", 1f, 0f) | |
val object2: ObjectAnimator = ObjectAnimator.ofFloat(this, "rotationX", 0f, 90f) | |
animatorSet.playTogether(object1, object2) | |
return animatorSet | |
} | |
fun View.flipOutY(): AnimatorSet { | |
val animatorSet = AnimatorSet() | |
val object1: ObjectAnimator = ObjectAnimator.ofFloat(this, "alpha", 1f, 0f) | |
val object2: ObjectAnimator = ObjectAnimator.ofFloat(this, "rotationY", 0f, 90f) | |
animatorSet.playTogether(object1, object2) | |
return animatorSet | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment