B4A Library [Lib] AnimationPlus

MaCaveAVin

Member
Licensed User
Longtime User
Hi,

Nice library.

On my current project I'm doing rotation on a picture depending of north (compass), if user click on picture then I hold roation and picture is move and size is increased. Then I wish to allow rotation again dpending of north position.

Issue is even if I set PersistAfter, when I allow rotation again, picture come back to initial position and decrease to original size.

I'm wondering what is the best way when animationset ends to get view end position ?
I would like to set end position view as new default position. Then I could do rotation again.

May be in a near future a small library update could add a function to do that ?


Does anyone have any idea ?

Thanks
 

Informatix

Expert
Licensed User
Longtime User
Please see posts #102 and #116
 

Informatix

Expert
Licensed User
Longtime User
The only possibilities with Animation or AnimationPlus are a pivot set to top left or a pivot set to center. For more flexibility, see NineOldAndroids.
 

azzam223

Active Member
Licensed User
Longtime User
Hello informatix I want to move view when I touch it And move To another Position How can I do this
 

mehransafavy

New Member
Hi there
i wanna create a simple animation that rotate a button
and i got the following error on line 36
" java.lang.NullPointerException: Attempt to read from field 'int android.view.ViewGroup$LayoutParams.width' on a null object reference "



B4X:
  Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("check")
    Button1.Initialize("")
    A1.InitializeRotateCenter("A1",0,360,Button1)    LINE 36 ---------------> here is error
    A1.SetInterpolator(animPlus.INTERPOLATOR_LINEAR)

    A2.InitializeTranslate("A2",-90dip,-110dip,0,0)
    A2.SetInterpolator(A2.INTERPOLATOR_OVERSHOOT)

    animPlus.Initialize(False)
    animPlus.AddAnimation(A1)
    animPlus.AddAnimation(A2)
    animPlus.Duration=3000
End Sub
 

mehransafavy

New Member
Remove that, if you have Button1 in your layout "check".

Otherwise, after initializing it, you need to add it to the Activity:
Activity.AddView (Button1, 0, 0, 100dip, 50dip)

Tip: create B4XPages projects.
Thx
Do i have to do this for all view’s or Only the ones I want to had animation?
 

mehransafavy

New Member
Remove that, if you have Button1 in your layout "check".

Otherwise, after initializing it, you need to add it to the Activity:
Activity.AddView (Button1, 0, 0, 100dip, 50dip)

Tip: create B4XPages projects.
B4X:
    Activity.LoadLayout("check")
    Activity.AddView (Button1, 0, 0, 100dip, 50dip)

    A1.InitializeRotateCenter("A1",0,360,Button1)
    A1.SetInterpolator(animPlus.INTERPOLATOR_LINEAR)

    A2.InitializeTranslate("A2",-90dip,-110dip,0,0)
    A2.SetInterpolator(A2.INTERPOLATOR_OVERSHOOT)

    animPlus.Initialize(False)
    animPlus.AddAnimation(A1)
    animPlus.AddAnimation(A2)
    animPlus.Duration=3000

i still have error on line 2
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
?
 

LucaMs

Expert
Licensed User
Longtime User
i still have error on line 2
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
Remove that, if you have Button1 in your layout "check".

Otherwise...
If Button1 is in your layout, you don't need to do anything else; you don't have to write Button1.Initialize or Activity.AddView.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…