B4A Library [B4X][XUI] AnimatedArrow - focus the user attention

Discussion in 'Additional libraries, classes and official updates' started by Erel, Jan 2, 2018.

  1. Erel

    Erel Administrator Staff Member Licensed User

    [​IMG]

    Usage:
    - Declare and initialize an AnimatedArrow object.
    - Call Show with the parent, target point and angle.

    Each object should be used once.

    It is compatible with B4A, B4i and B4J.
    Make sure to use the latest versions of XUI library.
    The number of steps is reduced in debug mode.

    The class is inside the B4J project.
     

    Attached Files:

    Last edited: Nov 21, 2018
  2. Erel

    Erel Administrator Staff Member Licensed User

    There is a useful method inside the class called DrawLineAnimated. It can be used to make all kinds of animated drawings.

    For example (the animation looks better in the real program):

    house.gif

    Relevant code:
    Code:
    Public Sub DrawHouse (Parent As B4XView, TargetX As Float, TargetY As Float, VisibleDuration As Int)
       Parent.AddView(base, TargetX, TargetY, base.Width, base.Height)
       cvs.ClearRect(cvs.TargetRect)
       
    Dim duration As Int = 300
       DrawLineAnimated(duration, 
    2010dip100dip110dip100dipTrue)
       Sleep(duration)
       DrawLineAnimated(duration, 
    20110dip100dip110dip200dipTrue)
       Sleep(duration)
       DrawLineAnimated(duration, 
    20110dip200dip10dip200dipTrue)
       Sleep(duration)
       DrawLineAnimated(duration, 
    2010dip200dip10dip100dipTrue)
       Sleep(duration)
       DrawLineAnimated(duration, 
    2010dip100dip110dip200dipFalse'It will be invalidated in the next line
       DrawLineAnimated(duration, 20110dip100dip10dip200dipTrue)
       Sleep(duration)
       DrawLineAnimated(duration, 
    2010dip100dip60dip50dipFalse)
       DrawLineAnimated(duration, 
    20110dip100dip60dip50dipTrue)
       Sleep(duration)
       Sleep(VisibleDuration)
       base.SetVisibleAnimated(
    100False)
       Sleep(
    100)
       base.RemoveViewFromParent
       cvs.Release
    End Sub
    (The base size is set to 400dip x 400dip)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice