Android Question Rolling-unrolling B4XViews

LucaMs

Expert
Licensed User
Longtime User
Playing a game (pc-web), just to waste time (as always :() I saw this kind of animation (already known, of course):

srotola.gif



I found (web) only this VB6 code:
B4X:
Public Sub SimpleUnroll(Source As PictureBox, Target As PictureBox, Optional TubeWidth = 50)
    Dim XTube As Long, Offset As Long, XPicture As Long, RDS As Double
    Target.Cls
    RDS = 6.283185307 / (TubeWidth * 2)
    For Offset = 0 To Source.ScaleWidth - 1
        If Offset - TubeWidth >= 0 Then Target.PaintPicture Source.Picture, Offset - TubeWidth, 0, 1, Source.ScaleHeight, Offset - TubeWidth, 0, 1, Source.ScaleHeight
        For XTube = 1 To TubeWidth
            XPicture = ACos(XTube / (TubeWidth / 2)) / RDS
            If Offset + XPicture < Source.ScaleWidth Then
                Target.PaintPicture Source.Picture, Offset + XTube - TubeWidth, 0, 1, Source.ScaleHeight, Offset + XPicture, 0, 1, Source.ScaleHeight
            Else
                Target.PaintPicture Source.Picture, Offset + XTube - TubeWidth, 0, 1, Source.ScaleHeight, Offset + XTube - TubeWidth, 0, 1, Source.ScaleHeight
            End If
        Next XTube

    Next Offset

End Sub

My B4A version of this code does not satisfy me, both as a look and as a speed (but I'm not a graphic expert, so I could have mis-translated this code).


It would be nice to have a XUI class that allows you to rolling-unrolling any B4XView or at least a B4A panel.


Note that this is not a priority for me, it was and is only a curiosity (and a "good" reason to waste time :D)


If someone wanted to test himself...
 
Top