B4A Library [Lib] AnimationMultiple v.1.22

Tayfur

Well-Known Member
Licensed User
Hello all;

I have developed the library for own project. Now I want share everone.
I hope like my lib.
if you want to more good animation lib, you use @Informatix library on LINK

********************************************
Verison : 1.22

Clear logs...



NEW METHOD

Public Sub isCompleted As Boolean
  • Return TRUE when All animations completed


NEW METHOD
Public Sub isWorking(Target As View) As Boolean
  • Animations cheking for working your target view
  • TRUE >> Target View is WORKING now
  • FALSE >> Target View is DONT WORK

UPDATED
Public Sub StartAll(Restart As Boolean)
  • all Views animations start
  • Starts the animating the given view.
  • Restart -->> True : All working animations are stopped, After All animations will start
  • Restart -->> FALSE : Only stoped animations will start
  • Note that a single animation should not be applied to more than one view at a time.
********************************************************
#Event: AnimationMultipleEnd (WorkedView as View, Coord() as Float)

  • This is very important change for multiple animations. This event will send to back processed/finished view of animation.
  • [For version 1.10] Coord variable has 4 values
    • Coord(0) =>> Float, Value is FromX or AlphaX or FromDegrees
    • Coord(1) =>> Float, Value is FromX or (0 for Alpha / Degrees)
    • Coord(2) =>> Float, Value is ToX or AlphaY or ToDegrees
    • Coord(3) =>> Float, Value is ToY or (0 for Alpha / Degrees)

#Event: AnimationMultipleError

  • Process cant find Animation in own Animation list



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

PublicSub Initialize(CallbackModule As Object, cEventName As String)
¨ Initializes the object. You can add parameters to this method if needed.
¨ animi.Initialize(Me, "animi")

PublicSub AddScaleCenter(Target As View, FromX As Float, FromY As Float,ToX As Float,ToY As Float,Duration As Long,RepeatCount As Int,RepeatMode As Int ,Center As View)
¨ Initializes a scale animation. The view will be scaled during the animation.
¨ The scaling pivot will be set to the top left corners.
¨ Target : View for animaitons
¨ FromX : The first frame horizontal scale.
¨ FromY : The first frame vertical scale.
¨ ToX : The last frame horizontal scale.
¨ ToY : The last frame vertical scale.
¨ Center : Similar to InitializeScale with a pivot set to the given views center.
¨ Duration : animation cycle time, sets the animation duration. Value is measured in milliseconds.
¨ RepeatMode : Gets Or sets the repeat mode. Relevant when RepeatCount Is larger than 0 (Or -1).
¨ The default Is REPEAT_RESTART which means that the animation will restart each time.
¨ REPEAT_REVERSE causes the animation To repeat in reverse each time.
¨ RepeatMode : REPEAT_RESTART (1) and REPEAT_RESTART(2) like original Animation lib.
¨ RepeatMode : Default is REPEAT_NULL (0)
¨ RepeatCount:Gets or sets the number of times the animation will repeat. A value of 0 means that it will play once.
¨ Set to -1 for a non stopping animation.
¨ **** This same use " InitializeTranslate " Animation [lib] in B4A IDE

PublicSub AddScale(Target As View, FromX As Float, FromY As Float,ToX As Float,ToY As Float,Duration As Long,RepeatCount As Int,RepeatMode As Int )
¨ Initializes a scale animation. The view will be scaled during the animation.
¨ The scaling pivot will be set to the top left corners.
¨ Target : View for animaitons
¨ FromX : The first frame horizontal scale.
¨ FromY : The first frame vertical scale.
¨ ToX : The last frame horizontal scale.
¨ ToY : The last frame vertical scale.
¨ Duration : animation cycle time, sets the animation duration. Value is measured in milliseconds.
¨ RepeatMode : Gets Or sets the repeat mode. Relevant when RepeatCount Is larger than 0 (Or -1).
¨ The default Is REPEAT_RESTART which means that the animation will restart each time.
¨ REPEAT_REVERSE causes the animation To repeat in reverse each time.
¨ RepeatMode : REPEAT_RESTART (1) and REPEAT_RESTART(2) like original Animation lib.
¨ RepeatMode : Default is REPEAT_NULL (0)
¨ RepeatCount:Gets or sets the number of times the animation will repeat. A value of 0 means that it will play once.
¨ Set to -1 for a non stopping animation.
¨ **** This same use " InitializeTranslate " Animation [lib] in B4A IDE

PublicSub AddRotateCenter(Target As View, FromDegrees As Float, ToDegrees As Float,Duration As Long,RepeatCount As Int,RepeatMode As Int,Center As View )
¨ Initializes a rotation animation. The view will rotate between the given values.
¨ Similar to InitializeRotate, with the pivot set to the given views center.
¨ Target : View for animaitons
¨ FromDegrees : The first frame rotation value.
¨ ToDegrees : The last frame rotation value.
¨ Center : the pivot set to the given views center.
¨ Duration : animation cycle time, sets the animation duration. Value is measured in milliseconds.
¨ RepeatMode : Gets Or sets the repeat mode. Relevant when RepeatCount Is larger than 0 (Or -1).
¨ The default Is REPEAT_RESTART which means that the animation will restart each time.
¨ REPEAT_REVERSE causes the animation To repeat in reverse each time.
¨ RepeatMode : REPEAT_RESTART (1) and REPEAT_RESTART(2) like original Animation lib.
¨ RepeatMode : Default is REPEAT_NULL (0)
¨ RepeatCount:Gets or sets the number of times the animation will repeat. A value of 0 means that it will play once.
¨ Set to -1 for a non stopping animation.
¨ **** This same use " InitializeTranslate " Animation [lib] in B4A IDE
PublicSub AddRotate(Target As View, FromDegrees As Float, ToDegrees As Float,Duration As Long,RepeatCount As Int,RepeatMode As Int )
¨ Initializes a rotation animation. The view will rotate between the given values.
¨ Rotation pivot Is set To the top left corner.
¨ Target : View for animaitons
¨ FromDegrees : The first frame rotation value.
¨ ToDegrees : The last frame rotation value.
¨ Duration : animation cycle time, sets the animation duration. Value is measured in milliseconds.
¨ RepeatMode : Gets Or sets the repeat mode. Relevant when RepeatCount Is larger than 0 (Or -1).
¨ The default Is REPEAT_RESTART which means that the animation will restart each time.
¨ REPEAT_REVERSE causes the animation To repeat in reverse each time.
¨ RepeatMode : REPEAT_RESTART (1) and REPEAT_RESTART(2) like original Animation lib.
¨ RepeatMode : Default is REPEAT_NULL (0)
¨ RepeatCount:Gets or sets the number of times the animation will repeat. A value of 0 means that it will play once.
¨ Set to -1 for a non stopping animation.
¨ **** This same use " InitializeTranslate " Animation [lib] in B4A IDE
PublicSub AddAlpha(Target As View, FromAlpha As Float, ToAlpha As Float,Duration As Long,RepeatCount As Int,RepeatMode As Int )
¨ Causes a fading in or fading out effect.This animation affects the views transparency (fading effect).
¨ The alpha values are between 0 to 1 where 0 is fully transparent and 1 is fully opaque.
¨ Target : View for animaitons
¨ FromAlpha : first Frame value
¨ ToAlpha : last Frame value
¨ Duration : animation cycle time, sets the animation duration. Value is measured in milliseconds.
¨ RepeatMode : Gets Or sets the repeat mode. Relevant when RepeatCount Is larger than 0 (Or -1).
¨ The default Is REPEAT_RESTART which means that the animation will restart each time.
¨ REPEAT_REVERSE causes the animation To repeat in reverse each time.
¨ RepeatMode : REPEAT_RESTART (1) and REPEAT_RESTART(2) like original Animation lib.
¨ RepeatMode : Default is REPEAT_NULL (0)
¨ RepeatCount:Gets or sets the number of times the animation will repeat. A value of 0 means that it will play once.
¨ Set to -1 for a non stopping animation.
¨ **** This same use " InitializeTranslate " Animation [lib] in B4A IDE
PublicSub AddTranslate(Target As View, FromX As Float, FromY As Float,ToX As Float,ToY As Float,Duration As Long,RepeatCount As Int,RepeatMode As Int )
¨ Initializes a translation animation. The view will move according to the given values.
¨ Target : View for animaitons
¨ FromX : first Frame horizontal pozition
¨ FromY : first Frame vertical pozition
¨ ToX : last Frame horizontal pozition
¨ ToY : last Frame vertical pozition
¨ Duration : animation cycle time, sets the animation duration. Value is measured in milliseconds.
¨ RepeatMode : Gets Or sets the repeat mode. Relevant when RepeatCount Is larger than 0 (Or -1).
¨ The default Is REPEAT_RESTART which means that the animation will restart each time.
¨ REPEAT_REVERSE causes the animation To repeat in reverse each time.
¨ RepeatMode : REPEAT_RESTART (1) and REPEAT_RESTART(2) like original Animation lib.
¨ RepeatMode : Default is REPEAT_NULL (0)
¨ RepeatCount:Gets or sets the number of times the animation will repeat. A value of 0 means that it will play once.
¨ Set to -1 for a non stopping animation.
¨ **** This same use " InitializeTranslate " Animation [lib] in B4A IDE
PublicSub StartAll
¨ all Views animations start
¨ Starts the animating the given view.
¨ Note that a single animation should not be applied to more than one view at a time.


PublicSub StartAt(Target As View) AsBoolean
¨ Animations only start with your target view
¨ TRUE >> target view now start
¨ FALSE >> target view cant find in list

PublicSub DeleteAll
¨ delete all animations records.

PublicSub DeleteAt(Target As View) AsBoolean
¨ Animations process will delete with your target view
¨ TRUE >> target view now deleted
¨ FALSE >> target view cant find in list

PublicSub StopAll
¨ all Views animations stop

PublicSub StopAt(Target As View) AsBoolean
¨ Animations only stop with your target view
¨ TRUE >> target view now stoped
¨ FALSE >> target view cant find in list

PublicSub AnimationGet(Target As View) AsAnimation
¨ This method will get Animation from own proceess list ( standart Animation Lib) with Target view
¨ Process will delete old animation if Process has same target View
¨ Target : View for animaitons
¨ Animation : This same use " InitializeTranslate " Animation [lib] in B4A IDE

PublicSub AnimationSet(Target As View,Animation AsAnimation)
¨ This method will add a new Animation ( standart Animation Lib) with Target view
¨ Process will delete old animation if Process has same target View
¨ Target : View for animaitons
¨ Animation : This same use " InitializeTranslate " Animation [lib] in B4A IDE

PublicSub Count As Int
¨ Return all animation count in own list


SAMPLE CODE


B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim a As AnimationMultiple
    Private Button1 As Button
    Private Button2 As Button
    Dim q As Panel
    Dim qq As Panel
    Dim qq3 As Panel
    Dim qq2 As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("L1")

    Button1.Initialize("Button1")
    Activity.AddView(Button1,0,100%y-40dip,150dip,40dip)
    Button1.Text="START ALL"
    Button1.Initialize("Button2")
    Activity.AddView(Button1,155dip,100%y-40dip,150dip,40dip)
    Button1.Text="START #2"

a.Initialize(Me,"a")

q.Initialize("")
Activity.AddView(q,100,100,100,100)
q.Color=Colors.Red


qq.Initialize("")
Activity.AddView(qq,200,200,100,100)
qq.Color=Colors.Yellow


qq2.Initialize("")
Activity.AddView(qq2,300,300,100,100)
qq2.Color=Colors.Cyan


qq3.Initialize("")
Activity.AddView(qq3,400,100,100,100)
qq3.Color=Colors.Gray


a.AddRotate (q, 10,155,3000,0,a.REPEAT_NULL)
a.AddTranslate(qq,200,200,10,10,7000,0,a.REPEAT_NULL)
a.AddScale(qq2,0,0,1,1,6000,0,a.REPEAT_NULL)
a.AddAlpha(qq3,0.1,0.9,5000,0,a.REPEAT_NULL)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub a_AnimationMultipleEnd(WorkedView As View,Coord() As Float)
'Sub a_AnimationMultipleEnd(WorkedView As View)
    Log("Complate:"&DateTime.Time(DateTime.Now))
    WorkedView.Color=Colors.Blue
    Log(Coord.Length)
    Log(Coord(0))
    Log(Coord(1))
    Log(Coord(2))
    Log(Coord(3))
End Sub

Sub a_AnimationMultipleError
    Log("ERROR : Cant find your view in Own list")

End Sub



Sub Button2_Click
    a.StartAt(qq)
End Sub

Sub Button1_Click
    a.StartAll(true)
    DoEvents
    DoEvents
    DoEvents
    DoEvents
    a.DeleteAt(q)
 

Attachments

Last edited:

valentino s

Active Member
Licensed User
It does its job :), thanks
 

Tayfur

Well-Known Member
Licensed User
Hello Again;

I updated lib version1.10

Changes :


#Event: AnimationMultipleEnd (WorkedView as View, Coord() as Float)

  • This is very important change for multiple animations. This event will send to back processed/finished view of animation.
  • [For version 1.10] Coord variable has 4 values
    • Coord(0) =>> Float, Value is FromX or AlphaX
    • Coord(1) =>> Float, Value is FromX or (0 for Alpha)
    • Coord(2) =>> Float, Value is ToX or AlphaY
    • Coord(3) =>> Float, Value is ToY or (0 for Alpha)
 

Tayfur

Well-Known Member
Licensed User
Hello Again;

I need new features and some improvements. and I will share with you.
New library in #1 article
Verison : 1.20




NEW METHOD

Public Sub isComplated As Boolean
  • Return TRUE when All animations complated


NEW METHOD
Public Sub isWorking(Target As View) As Boolean
  • Animations cheking for working your target view
  • TRUE >> Target View is WORKIN now
  • FALSE >> Target View is DONT WORK

UPDATED
Public Sub StartAll(Restart As Boolean)
  • all Views animations start
  • Starts the animating the given view.
  • Restart -->> True : All working animations are stopped, After All animations will start
  • Restart -->> FALSE : Only dont work animations will start
  • Note that a single animation should not be applied to more than one view at a time.
 

Rantor777

Member
Licensed User
You got some typos.

maybe an Error here

Public Sub isComplated As Boolean
  • Return TRUE when All animations complated
should be

Public Sub isCompleted As Boolean
  • Return TRUE when All animations completed
Happy to Help.
 

Tayfur

Well-Known Member
Licensed User
You got some typos.

maybe an Error here

Public Sub isComplated As Boolean
  • Return TRUE when All animations complated
should be

Public Sub isCompleted As Boolean
  • Return TRUE when All animations completed
Happy to Help.
Now, I see it.
and I fix it with version 1.21
 
Top