Sub FunnyImage (iv As B4XView, bmp As B4XBitmap)
'create the target BC
Dim target As BitmapCreator
target.Initialize(iv.Width, iv.Height)
'create the source BC
bmp = bmp.Resize(iv.Width - 20, iv.Height, False)
Dim bmpbc As BitmapCreator
bmpbc.Initialize(bmp.Width, bmp.Height)
bmpbc.CopyPixelsFromBitmap(bmp)
Dim counter As Int
Dim r As B4XRect
r.Initialize(0, 0, bmpbc.mWidth, 0)
'loop
Do While True
counter = counter + 1
'clear
target.FillRect(xui.Color_Transparent, target.TargetRect)
'go over each of the lines, update the offset and draw it on the target.
For y = 0 To bmpbc.mHeight - 1
Dim offset As Int = 10 * Sin(y / 10 + counter / 10)
r.Top = y
r.Bottom = y + 1
target.DrawBitmapCreator(bmpbc, r, 10 + offset, y, True)
Next
'update the bitmap
iv.SetBitmap(target.Bitmap)
Sleep(16)
Loop
End Sub