Image fading

madru

Active Member
Licensed User
Longtime User
good evening, I am looking for a solution to fade two images without moving
to black. I looked at the hints here in the forum and tried my own ideas...

...my stuff and the samples here are always fading to black and they are flickering due to the timer and alpha values.

Is there a way to have to screen pages and fade them - or any other solution to get smooth (fast) fading?

THX

M
 

madru

Active Member
Licensed User
Longtime User
yes, I played with the timer and the counter steps to set the alpha value but it is flickering on a 1080P screen …….

…… any ideas on fading between pictures without fading to black?

THX

M
 
Upvote 0

madru

Active Member
Licensed User
Longtime User
this has the best visual effect:

B4X:
'Activity module
Sub Process_Globals
   Dim Timer1 As Timer
End Sub

Sub Globals
   Dim a1, a2 As Animation
   Dim Panel1 As Panel
   Dim ImageView1 As ImageView
   Dim ImageView2 As ImageView
   Dim transition As Int: transition=7000
End Sub 

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   a1.InitializeAlpha("a1", 0, 1)
   ImageView1.Tag = a1
   a2.InitializeAlpha("a2", 1, 0)
   ImageView2.Tag = a2
   

   
   a2.Duration = transition
   a2.Start(ImageView2)
    a1.Duration = transition
   a1.Start(ImageView1)
   
   Timer1.Initialize("Timer1", 10000)
   Timer1.Enabled = True
   
End Sub

Sub a1_AnimationEnd
ImageView2.Background=ImageView1.Background
ImageView1.Visible=True
End Sub

Sub a2_AnimationEnd
'  not used
End Sub

Sub Timer1_Tick
   ImageView1.Visible=False
   ImageView1.Bitmap=LoadBitmap(File.DirAssets, Rnd(1,10)&".jpg")
   
   a1.InitializeAlpha("a1", 0, 1)
   a2.InitializeAlpha("a2", 1, 0)

    a1.Duration = transition
   a1.Start(ImageView1)
   a2.Duration = transition
   a2.Start(ImageView2)

End Sub


is it right way to do fading ?
 
Upvote 0
Top