B4A Library SD ScheduledAnimations

This library creates animations of the views and performs them step by step. Originally this library was based on an idea by @LordZenzo, which was fundamentally different from the current one. But not wanting to use an idea that is not mine, for the correctness of @LordZenzo I modified the library in a generator with more step-by-step animations.

The animations are added to a list of STEP and are executed one after the other. You can set to stop the execution of the animations for each animation step made or you can perform all the steps of the animations to follow.

Obviously it is a panel and like every panel it is possible to add some views inside it

SD_ScheduledAnimations

Author:
Star-Dust
Version: 0.03
  • AnimatedPanel
    • Events:
      • Click
      • ClickInfo (ID As String, Position As Int)
      • EndAnimation
      • EndSingleMove (ID As String, Position As Int)
    • Fields:
      • TimeLapse As Int
    • Functions:
      • AddPause (ID As String, Time As Long) As AnimatedPanel
      • AddView (View As View, Left As Int, Top As Int, Width As Int, Height As Int) As String
      • BringToFront As String
      • Class_Globals As String
      • ClearMove As String
      • ContinueAnimation As String
      • DesignerCreateView (Base As Panel, Lbl As Label, Props As Map) As String
      • GetAllViewsRecursive As List
      • GetBase As Panel
      • GetView (IndexView As Int) As View
      • Initialize (Callback As Object, EventName As String) As String
      • InitializeAddtoParent (Callback As Object, EventName As String, Parent As Panel, Left As Int, Top As Int, Width As Int, Height As Int) As String
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • MoveTo (ID As String, X As Float, Y As Float, Time As Long) As AnimatedPanel
      • MoveToWards (ID As String, V As View, Time As Long) As AnimatedPanel
      • RemoveAllViews As String
      • RemoveView As String
      • RequestFocus As String
      • ReSetEvent (Callback As Object, EventName As String) As String
      • Rotate (ID As String, DegreeX As Float, DegreeY As Float, DegreeZ As Float, Time As Long) As AnimatedPanel
      • SendToBack As String
      • Start As String
      • StartFromID (ID As String) As String
      • StartFromPosition (Position As Int) As String
      • Stop As String
    • Properties:
      • Enable As Boolean
      • Height As Int
      • Left As Int
      • Tag As Object
      • Top As Int
      • Visible As Boolean
      • Width As Int

This is an example of how you can set up some animation steps.

This will be the result
 

Attachments

  • Sample1.zip
    64.1 KB · Views: 365
  • SD_ScheduledAnimations 0.03.zip
    7.1 KB · Views: 345
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Another example:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    Button1.RemoveView
    AnimatedPanel1.AddView(Button1,10dip,10dip,Button1.Width,Button1.Height)
 
    AnimatedPanel1.AddPause(1,3000).MoveTo(2,100%x-AnimatedPanel1.Width/2,10dip,400)
    AnimatedPanel1.AddPause(3,500).MoveTo(4,100%x-AnimatedPanel1.Width/2,75%y,400)
    AnimatedPanel1.AddPause(5,500).MoveTo(6,10dip+AnimatedPanel1.Width/2,75%y,400)
    AnimatedPanel1.AddPause(7,500).MoveTo(8,10dip+AnimatedPanel1.Width/2,10dip,400)
    AnimatedPanel1.Rotate(9,0,0,360,700).AddPause(10,100).Start
End Sub

Video2.gif
 

Attachments

  • Sample2.zip
    9.2 KB · Views: 314
Last edited:

asales

Expert
Licensed User
Longtime User
[EDIT]
Solved with this code:
B4X:
Sub AnimatedPanel1_EndAnimation
    AnimatedPanel1.Stop
    AnimatedPanel1.ClearMove
End Sub

- - - - - - - - - - - - - - - - -

If I put the code below of Sample2 in a button and click in this button, the animate acumulated the clicks and repeat the steps 2,3,4 times...

I tried to use the AnimatedPanel1.Stop, but don't works.

How I can run the animate once time in every click and stop it?

Thanks.
B4X:
Sub Button1_Click 
    AnimatedPanel1.AddPause(1,1000).MoveTo(2,100%x-AnimatedPanel1.Width/2,10dip,400)
    AnimatedPanel1.AddPause(3,500).MoveTo(4,100%x-AnimatedPanel1.Width/2,75%y,400)
    AnimatedPanel1.AddPause(5,500).MoveTo(6,10dip+AnimatedPanel1.Width/2,75%y,400)
    AnimatedPanel1.AddPause(7,500).MoveTo(8,10dip+AnimatedPanel1.Width/2,10dip,400)
    AnimatedPanel1.Rotate(9,0,0,360,700).AddPause(10,100).Start
End Sub
 

Star-Dust

Expert
Licensed User
Longtime User
It's a Bug, I'll fix it at the next update.

Thanks for the tip
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Update rel. 0.03
 
Top