B4A Library [Lib] AnimationPlus

Hello everybody,

Here's my new baby. The AnimationPlus library extends the Animation library by adding:
  • the interpolators (Bounce, Accelerate, Overshoot, Cycle, etc.)
  • two parameters:
    PersistAfter (boolean): if True, the animation does not revert to its initial state
    StartOffset (long): delay before the animation really starts
  • AnimationSet (animations on the same view are played together)
  • four new Drawables:
    AnimationDrawable: image-by-image animation
    ClipDrawable: drawable with automatic clipping (ideal for progress bars)
    LayerDrawable: multi-layer drawable
    TransitionDrawable: cross-fade between two drawables
  • for translation animations:
    PauseTranslation/ResumeTranslation/IsPaused: new functions to pause/resume the animation
    AnimationRepeat: new event
List of properties and methods

If you want a library with more possibilities, and easy to use, give a try to NineOldAndroids.

Examples : https://drive.google.com/file/d/0B-kneWWcCy7PUTNERGJIamlzSjA/view?usp=sharing&resourcekey=0-LK97oJs9aV-UHK4CWY0utw
 

Attachments

  • AnimationPlus v2.3.zip
    12.7 KB · Views: 4,616
Last edited:

Informatix

Expert
Licensed User
Longtime User
I need it to anchor one value for every AnimationPlus Object.

Ex:

AnimationObject(Counter).InitializeTranslate("AnimationEnd1", 0, 0, 0, -600)
AnimationObject(Counter).tag = Counter
LabelAnchor(Counter).ecc ecc

I need refer a Counter specific for the item when AnimationObject(Counter) is finished.

Sub AnimationEnd1_AnimationEnd
Dim Animation as AnimationPlus
Animation = Sender
Animation.stop(LabelAnchor(Animation.Tag))
LabelAnchor(Animation.Tag).RemoveView
end sub

Tag = Counter
That won't work because it's not my class that triggers AnimationEnd, but its ancestor (Animation). Thus "Sender" in AnimationEnd won't hold the value stored in the subclass. Tag will always be null. That's why I never added this property.
The best workaround is to create a class that calls the AnimationPlus functions. You can add as many properties as you need in this class, and fires an AnimationEnd event with the required parameters.
 

Vincenzo Fabiano

Member
Licensed User
Longtime User
I have one Big problem.. If one Object (Ex: Label) is "Animated" by this library is impossibile to remove them by the view. I have every time crash report by the app. (Javanullpointexception)

Any solution?

UPDATE: Only if the item.removeview is on the Sub AnimationEnd or in AnimationEnd call a sub and into sub is present item.removeview

item is declared in Globals
 
Last edited:

rafaelbr20

Member
Licensed User
Longtime User
Hi,

I would keep an object in infinite loop. I did, but was not smoothly, because the object is returning to the starting position and starting the animation again, the right would be that it was REVERSE, so continue where it ended, to make the animation smoother. How can i do it ?

I Tried AnimPlus.RepeatMode = AnimPlus.REPEAT_REVERSE , but it is not working !

Follow my code

AnimPlus.InitializeTranslate("AnimPlus", 0dip, 15dip, 0dip, 0dip)
AnimPlus.Duration = 3000
AnimPlus.SetInterpolator(AnimPlus.INTERPOLATOR_OVERSHOOT)
AnimPlus.RepeatMode = AnimPlus.REPEAT_REVERSE
If AnimPlus.IsInitialized Then
AnimPlus.Stop(imgGrd)
Activity.Invalidate
AnimPlus.Start(imgGrd)
End If


Sub AnimPlus_AnimationEnd
AnimPlus.Start(imgGrd)
End Sub


Thanks so Much !!
 

Informatix

Expert
Licensed User
Longtime User
Hi,

I would keep an object in infinite loop. I did, but was not smoothly, because the object is returning to the starting position and starting the animation again, the right would be that it was REVERSE, so continue where it ended, to make the animation smoother. How can i do it ?

I Tried AnimPlus.RepeatMode = AnimPlus.REPEAT_REVERSE , but it is not working !

Follow my code

AnimPlus.InitializeTranslate("AnimPlus", 0dip, 15dip, 0dip, 0dip)
AnimPlus.Duration = 3000
AnimPlus.SetInterpolator(AnimPlus.INTERPOLATOR_OVERSHOOT)
AnimPlus.RepeatMode = AnimPlus.REPEAT_REVERSE
If AnimPlus.IsInitialized Then
AnimPlus.Stop(imgGrd)
Activity.Invalidate
AnimPlus.Start(imgGrd)
End If


Sub AnimPlus_AnimationEnd
AnimPlus.Start(imgGrd)
End Sub


Thanks so Much !!
For an infinite loop: RepeatCount = REPEAT_INFINITE
Depending on the animation to play, PersistAfter = true may be useful too. But a cyclic animation should be rather done with an AnimationDrawable (with the donationware version).
 

Eliezio

Member
Licensed User
Longtime User
Hello Informatix,

How do I get the 2.3 version, I currently have version1.0.
I found the ARCMENU on the forum and would like to use, but it says I need the AnimationPlus 2.3

Thank you for attention
 

Informatix

Expert
Licensed User
Longtime User
Important: I decided that from April 4 AnimationPlus will be completely free (the donationware will become a freeware and will be posted in the forum). In exchange for your donation, you will receive my version of the NineOldAndroids lib, which offers more possibilities of animation than AnimationPlus. The source code in Java will be included. Past donors will receive a free copy of the library on request.
 

thedesolatesoul

Expert
Licensed User
Longtime User
Important: I decided that from April 4 AnimationPlus will be completely free (the donationware will become a freeware and will be posted in the forum). In exchange for your donation, you will receive my version of the NineOldAndroids lib, which offers more possibilities of animation than AnimationPlus. The source code in Java will be included. Past donors will receive a free copy of the library on request.
Why April 4th?
Btw...this is a great library :) Now I can share my code with more people.
 

kiki78

Active Member
Licensed User
Longtime User
Thank you Informatix for future conversion from donationware to freeware of this library :).

When I use lot of animation, it will be some time more easy to use single Sub for AnimationEnd event.
But how can I get reference of animated view related to this event ?
I suggest to add View read-only property or event parameter, or why not Tag property.

Kind Regards
 

Informatix

Expert
Licensed User
Longtime User
Thank you Informatix for future conversion from donationware to freeware of this library :).

When I use lot of animation, it will be some time more easy to use single Sub for AnimationEnd event.
But how can I get reference of animated view related to this event ?
I suggest to add View read-only property or event parameter, or why not Tag property.

Kind Regards
It's not possible currently. The workaround is to use a class as Erel suggested.

Note that is no longer an issue with the NineOldAndroids lib.
 

ilan

Expert
Licensed User
Longtime User
hi informatix i have also paid for the animation plus lib can i get the oldnine library too please??

thanx
 
Top