-
-
Save EgorSalenko/230b39d2c840ac0f3010aa599ec98ad7 to your computer and use it in GitHub Desktop.
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
private fun animationOpenNewTask() { | |
if (!isNewTaskOpened) { | |
val x = addTaskButton.x.toInt() + addTaskButton.width / 2 | |
val y = addTaskButton.y.toInt() + addTaskButton.height / 2 | |
val startRadius = 0.0f | |
val endRadius = (Math.hypot( | |
overlayFragmentContainer.width.toDouble(), | |
overlayFragmentContainer.height.toDouble() | |
)).toFloat() | |
val anim = | |
ViewAnimationUtils.createCircularReveal(overlayFragmentContainer, x, y, startRadius, endRadius).apply { | |
interpolator = FastOutLinearInInterpolator() | |
duration = 800 | |
addListener(object : AnimatorListenerAdapter { | |
override fun onAnimationStart(animation: Animator?) { | |
overlayFragmentContainer.visibility = View.VISIBLE | |
} | |
}) | |
} | |
anim.start() | |
isNewTaskOpened = true | |
} else { | |
val x = addTaskButton.x.toInt() + addTaskButton.width / 2 | |
val y = addTaskButton.y.toInt() + addTaskButton.height / 2 | |
val startRadius = (Math.hypot( | |
overlayFragmentContainer.width.toDouble(), | |
overlayFragmentContainer.height.toDouble() | |
)).toFloat() | |
val endRadius = 0.0f | |
val anim = | |
ViewAnimationUtils.createCircularReveal(overlayFragmentContainer, x, y, startRadius, endRadius).apply { | |
interpolator = FastOutLinearInInterpolator() | |
duration = 500 | |
} | |
anim.addListener(object : AnimatorListenerAdapter { | |
override fun onAnimationEnd(animation: Animator?) { | |
overlayFragmentContainer.visibility = View.INVISIBLE | |
} | |
}) | |
anim.start() | |
isNewTaskOpened = false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment