Images Animation Sequence at Startup?

MarkBasik4Android

Member
Licensed User
Longtime User
Please Help....:sign0085:
I am not able to do it right.
I whant to have a
animation at the beginning of my app...

I have a sequence of PNG images x001.png, x002.png.... x040.png ecc
that compose my animation...

How I can show image by image at the beginning?
Hot to set up the frame time? Can I put a pause/couter to set up a 24 frame per second for example?

I used code like:

....
Dim numerazione() As String
numerazione = Array As String ("00","01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11")...


to setup sequence I need

Than in the Activity_Create:

For x = 1 To numerazione.Length
ImageView1.Bitmap=LoadBitmap(File.DirAssets, "Image"&numerazione(x)&".png")
pause/controll?
Next



How to make it loop?
It doers not work!:sign0085:
 

MarkBasik4Android

Member
Licensed User
Longtime User
Anim sequence?

Use a timer. For each tick (=when a Tick event is fired), change the image.
If you want this to run smooth, preload all images before starting the animation.

:sign0085: I am new and I have to learn!
This is what I did and I get errors can you help me?
____________________________________________

Sub Process_Globals

End Sub

Sub Globals

Dim ImageView1 As ImageView
Dim TimerMario As Timer
Dim ImageCounterVar As Int

Dim AnimationImagesNumbers() As String
AnimationImagesNumbers = Array As String ("00","01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11")
ImageCounterVar = 0
Dim AnimationImagesNumbersMax As Int

Dim labCONTROL As Label
End Sub



Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("screen1")
AnimationImagesNumbersMax = 10 'How many images is the PGN set is the same of: AnimationImagesNumbers.Length ?
For animFrames = 1 To 10
TimerMario.Initialize("TimerMario", 1000) 'show it in 1 sec
TimerMario.Enabled = True
Next
End Sub



Sub TimerMario_Tick
If ImageCounterVar <= AnimationImagesNumbersMax Then

ImageView1.Bitmap = LoadBitmap(File.DirAssets, "image-"&AnimationImagesNumbers(ImageCounterVar)&".png")
labCONTROL.Text = "Control:"&AnimationImagesNumbers(ImageCounterVar)&"!" ' This is to print the Number of the frame diplayed
ImageCounterVar = ImageCounterVar + 1

Else If ImageCounterVar > AnimationImagesNumbersMax Then

ImageCounterVar = 1 ' start again from 1

End If

TimerMario.Enabled = False

End Sub



Sub Activity_Resume

End Sub




Sub Activity_Pause (UserClosed As Boolean)

End Sub
:sign0085:
 

Attachments

  • AnimError1.jpg
    AnimError1.jpg
    92.2 KB · Views: 292
  • Itro test - immgini.zip
    1 KB · Views: 238
Upvote 0

MarkBasik4Android

Member
Licensed User
Longtime User
:sign0163:
A question about this forum...
It is good and usefull but... I am new and I have to learn....
I just posted a question about animation of a sequence of images and some nice guy anwered me ..... and said that is better to PRELOAD images....
so I searched the word PRELOAD in the forum to learn how to do it and what I find?.... My post !:BangHead:
 
Upvote 0

MarkBasik4Android

Member
Licensed User
Longtime User
Images Animation Sequence at Startup v001.zip WAS 1.6mB!
My image are in total 1.5 Mb .. Maximun upload is 350Kb!
I rescaled images (150 pixel instead of 480)... and here the file.
 
Upvote 0

MarkBasik4Android

Member
Licensed User
Longtime User
Images Animation Sequence at Startup - OK works

:sign0089::sign0089:
I did it Alone!:D
Now it works.... I just make some errors...

Can you help me with some emprovements?

1: Can you suggest me an elegant way to write:

AnimationImagesNumbers = Array As String ("00","01", "02", "03", "04", "05", "06", "07", "08", "09", "10")


.. and a faster way if I have 1000 frames?

2: It is possible to have a transition between frames.. like a cross fade?

3: The number 100 means 1 sec?
TimerMario.Initialize("TimerMario", 100) 'show it in 1 sec
This second is the same no matter the power of the hardware?
no less than a 1/100 of a sec?

4: It is so complicate?
There is not a simple way like : play images in X folder?
 
Upvote 0

MarkBasik4Android

Member
Licensed User
Longtime User
1000 = 1 sec
10000= 10 sec
60000 = 1 min
41 = 24 frames per second 1/24


TimerMario.Initialize("TimerMario", 41) '24 frames per second 1/24 * 1000
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
:sign0163:
A question about this forum...
It is good and usefull but... I am new and I have to learn....
I just posted a question about animation of a sequence of images and some nice guy anwered me ..... and said that is better to PRELOAD images....
so I searched the word PRELOAD in the forum to learn how to do it and what I find?.... My post !:BangHead:

Preload means "load before". A preloader is a program or a function loading data before they are used (in a predictive way). It's a technical term (example of use). A preloader usually feeds a cache.

The error would be to load your images while you want to display them. That would take time and so your animation would become choppy.
 
Upvote 0
Top