Looking to create a sliding effect

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Everyone,

I would like to move a view around based on a timer tick. For example, I will be taking a panel and sliding it down so the user does not see it any more. Next I will slide up another panel for the user to see.

I was thinking a timer would control the speed of sliding.

Can you show me code that I need to use to make this effect possible?

Thanks.

I started to code it like this but don't know how to pass a panel to the timer.

B4X:
Sub SlidePanelDownAndUp(pCurrentPanelToSlide As Panel, _
                   pNewPanelToSlide As Panel)

   tmrSlidePanelDown.Initialize("tmrSlidePanelDown", 1)
   tmrSlidePanelDown.Enabled = True

End Sub

Sub tmrSlidePanelDown_Tick
   
   PanelMain.Top = PanelMain.Top + 20

    If PanelMain.Top > Activity.Height Then
       tmrSlidePanelDown.Enabled = False

      PanelMain.Visible = False
      PanelNewStory.Visible = True
   End If
End Sub

How do I get an actual panel to slide for panelToSlide.Top?

I could make a timer for each panel but I would like to keep it more generic if possible.
 
Last edited:
Top