R RMarra Member Licensed User Longtime User Oct 17, 2019 #1 I want to slide a panel to the left when a button is pressed. I created an AnimationPlus object: B4X: BoatAnimation.InitializeTranslate("AnimationLeft", 0dip, 0, -130dip, 0) BoatAnimation.Duration = 700 BoatAnimation.RepeatCount = 0 BoatAnimation.RepeatMode=BoatAnimation.INTERPOLATOR_LINEAR BoatAnimation.PersistAfter = True BoatAnimation.Start(BoatPanel1) and I have a AnimationEnd routine: B4X: Sub AnimationLeft_AnimationEnd BoatAnimation.Stop(BoatPanel1) End Sub It works up until I do the BoatAnimation.Stop and the panel jumps back to where it started, even though I have BoatAnimation.PersistAfter = True Can anyone see what I'm doing wrong?
I want to slide a panel to the left when a button is pressed. I created an AnimationPlus object: B4X: BoatAnimation.InitializeTranslate("AnimationLeft", 0dip, 0, -130dip, 0) BoatAnimation.Duration = 700 BoatAnimation.RepeatCount = 0 BoatAnimation.RepeatMode=BoatAnimation.INTERPOLATOR_LINEAR BoatAnimation.PersistAfter = True BoatAnimation.Start(BoatPanel1) and I have a AnimationEnd routine: B4X: Sub AnimationLeft_AnimationEnd BoatAnimation.Stop(BoatPanel1) End Sub It works up until I do the BoatAnimation.Stop and the panel jumps back to where it started, even though I have BoatAnimation.PersistAfter = True Can anyone see what I'm doing wrong?
rraswisak Active Member Licensed User Longtime User Oct 17, 2019 #2 Try this code: B4X: Sub AnimationLeft_AnimationEnd BoatAnimation.Stop(BoatPanel1) BoatPanel1.Left=-BoatPanel1.Width '<-- add this line End Sub Usualy for this purpose i use SetLayoutAnimated as follow: B4X: BoatPanel1.SetLayoutAnimated(700,-BoatPanel1.Width,BoatPanel1.Top, BoatPanel1.Width, BoatPanel1.Height) Sleep(700) BoatPanel1.Left = -BoatPanel1.Width Upvote 0
Try this code: B4X: Sub AnimationLeft_AnimationEnd BoatAnimation.Stop(BoatPanel1) BoatPanel1.Left=-BoatPanel1.Width '<-- add this line End Sub Usualy for this purpose i use SetLayoutAnimated as follow: B4X: BoatPanel1.SetLayoutAnimated(700,-BoatPanel1.Width,BoatPanel1.Top, BoatPanel1.Width, BoatPanel1.Height) Sleep(700) BoatPanel1.Left = -BoatPanel1.Width
Erel B4X founder Staff member Licensed User Longtime User Oct 18, 2019 #3 There is almost no good reason to use the Animation library. Use the internal animation methods instead. They are simpler and in many cases more powerful, especially together with calls to Sleep. Upvote 0
There is almost no good reason to use the Animation library. Use the internal animation methods instead. They are simpler and in many cases more powerful, especially together with calls to Sleep.
R RMarra Member Licensed User Longtime User Oct 18, 2019 #4 For what I'm doing, the internal animation is so much cleaner and easier!!! Thank you. Upvote 0