Just to wrap up this thread, I did a bunch more testing tonight and verified that FlexDMD does not handle transparent animated GIFs (I verified in a photo editor that part of each image in the GIF was transparent). It does handle transparent (still) PNGs - animated PNGs are not supported at all.
So I wrote a function to animate a set of PNGs with transparent backgrounds and return a scene that can be added to any FlexDMD scene - seems to work! Thanks everyone for the quick responses!
For anyone who cares, here's the code:
' Create a scene from a series of images. The only reason to use this
' function is if you need to use transparent images. If you don't, use
' an animated GIF - much easier. However, this does have one other advantage over
' an animated GIF: FlexDMD will loop animated GIFs, regardless of what the loop attribute is set to in the GIF
' name - name of the scene object returned
' imgdir - directory inside the FlexDMD project folder where the images are stored
' num - number of images, numbered from image1..image<num>
' fps - frames per second - a delay of 1/fps is used between frames
' hold - if non-zero, how long to hold the last frame visible. If 0, the last scene will end with the last frame visible
' repeat - boolean: whether to loop the entire sequence
' count - How many times to repeat. Ignored if repeat is false
Function NewSceneFromImageSequence(name,imgdir,num,fps,hold,repeat,count)
Dim scene,i,actor,af,blink,total,delay
total = num/fps + hold
delay = 1/fps
Set scene = FlexDMD.NewGroup(name)
For i = 1 to num
Set actor = FlexDMD.NewImage(name&i,imgdir&"\image"&i&".png")
actor.Visible = 0
Set af = actor.ActionFactory
Set blink = af.Sequence()
blink.Add af.Wait((i-1)*delay)
blink.Add af.Show(True)
blink.Add af.Wait(delay*1.2) ' Slightly longer than one frame length to ensure no flicker
if i=num And hold > 0 Then blink.Add af.Wait(hold)
if repeat or i<num Then
blink.Add af.Show(False)
blink.Add af.Wait((num-i)*delay)
End If
If repeat Then actor.AddAction af.Repeat(blink,count) Else actor.AddAction blink
scene.AddActor actor
Next
Set NewSceneFromImageSequence = scene
End Function
Sub TestScene3
Dim scene
Set scene = FlexDMD.NewGroup("testscene")
scene.AddActor FlexDMD.NewLabel("lbl1",FlexDMD.NewFont("FlexDMD.Resources.udmd-f7by13.fnt", vbWhite, vbBlack, 1),"20X")
scene.GetLabel("lbl1").SetAlignedPosition 64,16,FlexDMD_Align_CENTER
scene.AddActor NewSceneFromImageSequence "img1","bonusx",50,20,2,false,0
DMDEnqueueScene scene,0,4000,6000,2000,""
End Sub
Edited by skillman, 10 November 2021 - 08:53 AM.