Well, Ok. Either that or, in my case, another line 90% of the time.And what if I don't want to have a sleep? Then I always have one parameter more.
xPage.SetVisibleAnimated(100, True, 0)And what if I don't want to have a sleep?
It would be better to have to add that extra parameter than to add a line (Sleep) each time.Then I always have one parameter more.
You can do this, then you safe one linein my case, another line 90% of the time.
Root.SetLayoutAnimated(250,0,0,0,0) : Sleep(250)
.... or create your own B4XLib, with version 2 of all the default animation methods.You can do this, then you safe one line
SetVisibleAnimated2
I wrote this class (and test project) in just a few minutes (just because it's very easy and it's even easier thanks to B4X ), so I put in the first animations I found, without thinking too much..... or create your own B4XLib, with version 2 of all the default animation methods.
Public Sub SetVisibleAnimatedAndSleep(v As B4XView, Visible As Boolean, Duration) As ResumableSub
v.SetVisibleAnimated(Visible, Duration)
Sleep(Duration)
Return True
End Sub
'use it:
Wait For (Utils.SetVisibleAnimatedAndSleep(xPage, True, 1000)) Complete (Unused As Boolean)
It is evident that you have not downloaded the project I have attached, ErelThere is an opportunity here to explain a bit about resumable subs and why it is not really possible to create a simple SetVisibleAnimatedAndSleep method. It is possible with ugly compiler changes or by calling it with: Wait For (v.SetVisibleAnimatedAndSleep(...)) Complete
I will leave the explanation task for @agraham.
This got me thinking that I should have suggested that you create such a sub yourself:
B4X:Public Sub SetVisibleAnimatedAndSleep(v As B4XView, Visible As Boolean, Duration) As ResumableSub v.SetVisibleAnimated(Visible, Duration) Sleep(Duration) Return True End Sub 'use it: Wait For (Utils.SetVisibleAnimatedAndSleep(xPage, True, 1000)) Complete (Unused As Boolean)
Thanks, Erel(s). I did something similar. I am going for the "movie credit" effect and could not find something like that. I also want the Star Wars Intro scrolling, shrinking, leaving the display, text.There is an opportunity here to explain a bit about resumable subs and why it is not really possible to create a simple SetVisibleAnimatedAndSleep method. It is possible with ugly compiler changes or by calling it with: Wait For (v.SetVisibleAnimatedAndSleep(...)) Complete
I will leave the explanation task for @agraham.
This got me thinking that I should have suggested that you create such a sub yourself:
B4X:Public Sub SetVisibleAnimatedAndSleep(v As B4XView, Visible As Boolean, Duration) As ResumableSub v.SetVisibleAnimated(Visible, Duration) Sleep(Duration) Return True End Sub 'use it: Wait For (Utils.SetVisibleAnimatedAndSleep(xPage, True, 1000)) Complete (Unused As Boolean)