I read this document by Google: Manage motion and widget animation with MotionLayout I have also read a few more doc such as Getting Started with the Motion Editor in Android Studio 4.0
The problem is they both talk about how to start the animation when we click on a View/Button. I want to simulate loading animation but I want to start the anime automatically when I display my view.
I realized that I am able to run the animation using the code below. However, the problem is, transitionToEnd()
run the animation once.
So, my questions are:
how to run the animation and put it in the loop? (to have it forever until I stop it.)
Is it possible to run the animation from startToEnd, then endToStart, loop the anime in this way?
private fun displayDamLoadingAnimation() {
val view = layoutInflater.inflate(R.layout.viewgroup_dam_loading, binding.flDamContainer)
view.motionContainer.transitionToEnd()
}
This is probably bad for users phone but you can do it. One way is to create two transitions :
But if you want it to Loop not go back and forth