Android Tutorial Android views animation tutorial

luke2012

Well-Known Member
Licensed User
Longtime User
Hi @Erel.
Is it possible to make a vertical slide in / slide out animation with this library?
For example: show / hide panel with vertical slide effect?
 

fotosettore

Member
Licensed User
Longtime User
Hi erel !
Is it possible to stop animation of button3 in 180° ?
I'd need only to turn button in upside down and stop it in that position.
 

SpinBower

Member
Licensed User
Longtime User
Could someone please explain why this does not work? All I want to do is move the cloud from one edge of the screen to the other.

B4X:
Sub Globals
    Dim CloudAni As Animation
    Dim Cloud As ImageView
End Sub

Sub Clouds()
    Cloud.Initialize("main")
    Cloud.Bitmap = LoadBitmap(File.DirAssets, "Cloud.png")
    Cloud.Gravity = Gravity.FILL
    Activity.AddView(Cloud, 0, 0, 100dip, 100dip)
    CloudAni.InitializeTranslate("Cloud", 0%x, 50%y, 100%x, 50%y)
    CloudAni.Duration = 4000
    CloudAni.RepeatCount = -1
    CloudAni.RepeatMode = CloudAni.REPEAT_REVERSE
    CloudAni.Start(Cloud)
End Sub
 

iCAB

Well-Known Member
Licensed User
Longtime User
I have a question about this:
Is there a way to rotate the object without a pause in between. for example (based on the sample code attached to the first post):
B4X:
    For i = 0 To animations.Length - 1
        animations(i).Duration = 1000
        animations(i).RepeatCount = 5
        animations(i).RepeatMode = animations(i).REPEAT_RESTART
    Next

If I add the block above, the button rotates around itself repeating the action 5 times.
but the rotation is not smooth. After it completes 360 degrees, it pauses then restarts

Any ideas?
 

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Erel

What I did is this:
B4X:
  aRotate.InitializeRotateCenter(ProcessingLayerEventName, 0, iTimeoutInSecond * 360, ProcessingPanel.GetView(ProcessingPanel.NumberOfViews - 1 ) )
            aRotate.Duration = iTimeoutInSecond * 1000
            aRotate.RepeatCount = 0

it seems to do the job, except that the rotation starts slow then increases speed. Is there anything I can do about it

Thanks
 

Tayfur

Well-Known Member
Licensed User
Longtime User
I try animie . And I can found problem.
My panel top-Left cooordinate is 10dip , 10dip

But;
Panel pozitions not same creating pozitions when anime start.

I must add some offset. After its ok. (avarge "10dip" added)
Why dont same anime start pozitions and Panel pozitions??


2 Questions.

Panel moving 100dip. After compalate moving. and panel return back start pozitions.
I want to panels dont back (Start pozitions). I want to stay finish pozitions.(100dip left)
How can I do with anime.

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")
    If FirstTime Then
        lst.Initialize
        Log("lst size:"&lst.Size)
    End If
    Activity.LoadLayout("L1")
  
  
    PP2.Initialize("PP2")
    Activity.AddView(PP2,10dip,10dip,80%x,80%y)
    PP2.color=colors.yellow
  
    pp.Initialize("")
    Activity.AddView(pp,10dip,10dip,80%x,80%y)
    pp.Color=Colors.Green
    Activity.AddMenuItem("1-Touch panel Visible","x1")
    Activity.AddMenuItem("animasyon","x2")
    Activity.AddMenuItem("acitve up/down","x3")
    Activity.AddMenuItem("2--add web pages","x4")
    Activity.AddMenuItem("3--reload","x5")
    Activity.OpenMenu
End Sub


Sub x2_Click
    Log("PL:"&P.Left)
    Log("PT:"&P.Top)
    Anime.InitializeTranslate("Anime",pp.Left,pp.Top,pp.Left+100dip,pp.Top) '>>> not same coorner pozitions
'    Anime.InitializeTranslate("Anime",pp.Left-10dip,pp.Top-10dip,pp.Left+100dip,pp.Top-10dip) '>> same corner posizitons
    Anime.Duration=5000
    Anime.Start(pp)
End Sub

This is diffent of corner pozitions when start at anime.
Normaly, 2 panels are same corner pozitions.

 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…