Android Question Transition of 1st, 2nd image and back

microbox

Active Member
Licensed User
Longtime User
I can only make the forward transition (effects.TransitionAnimated(1500,OriginalBmp,OriginalBmp2,ImageView1)) but crashes when I tried to swap (effects.TransitionAnimated(1500,OriginalBmp2,OriginalBmp,ImageView1)).
The code below is what I'm using for forward transition but I removed the code when trying to reverse.

B4X:
Sub Globals

    'These global variables will be redeclared each time the activity is created.

    Private xui As XUI

    Private ImageView1 As B4XView

    Private OriginalBmp,OriginalBmp2 As B4XBitmap

    Private effects As BitmapCreatorEffects

    Private Button2 As Button

    Private flag1 As Boolean

End Sub



Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    effects.Initialize
End Sub

Sub Button1_Click
    OriginalBmp = LoadBitmap(File.DirAssets,"dogtwo.png")

    effects.ImplodeAnimated(1500, OriginalBmp,ImageView1,50)
End Sub

Private Sub Button2_Click
    If flag1 = False Then
        OriginalBmp = LoadBitmap(File.DirAssets,"dogtwo.png")
        OriginalBmp2 = LoadBitmap(File.DirAssets,"myQR.png")
        effects.TransitionAnimated(1500,OriginalBmp,OriginalBmp2,ImageView1)
        flag1 = True
    Else
        flag1 = False
    
    End If
End Sub
My next question is , I notice that dogtwo.png file is larger than myQR.png this double the image(like tile) how can I make this FIT?
Hope anybody can help out.

Best regards.
 

Attachments

  • Transition.zip
    356.7 KB · Views: 275
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
To make things simpler, use images with the same ratio and the ratio should be the same ratio as the ImageView.

Now load them with:
B4X:
OriginalBmp = xui.LoadBitmapResize(File.DirAssets,"dogtwo.png", ImageView1.Width, ImageView1.Height, False)
OriginalBmp2 = xui.LoadBitmapResize(File.DirAssets,"myQR.png", ImageView1.Width, ImageView1.Height, False)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…