Jump to content



Photo
- - - - -

How? ... Animations on Playfield : GIF, PNG, MP4

playfield vpx animation gif png mp4

  • Please log in to reply
6 replies to this topic

#1 Ltek

Ltek

    Enthusiast

  • Members
  • PipPipPip
  • 149 posts

  • Flag: United States of America

  • Favorite Pinball: TRON NEON, Swamp Thing Bayou Edition, Volkan, SW Bounty Hunter, IT, Harry Potter, Dragon's Lair

Posted 09 March 2024 - 08:02 PM

I have a 22 frame animated GIF I'd like to use on a table.  If you have experience with this please advise - thank you!!!

 

From other tables I've seen authors separate gif into individual frames and use 'select case' scripts to cycle through each frame.

... is there an easier or better way to do this -- maybe turning the GIF into an MP4 and APNG?

 

thanks for the advice!

 



#2 Fusionwerks

Fusionwerks

    Poorly recovering pinball addict

  • Platinum Supporter
  • 417 posts

  • Flag: United States of America

  • Favorite Pinball: JP (DE), Deadpool, James Bond 007

Posted 09 March 2024 - 08:26 PM

funny, i just did this yesterday.

 

i used:

a flasher named "sign"

a timer named "SignTimer"

22 images uploaded to the vpx image editor

 

Here is the script:

 

Dim SignPos, Frames
Frames = Array("sign_001", "sign_002", "sign_003", "sign_004", "sign_005", "sign_006", "sign_007", "sign_008", "sign_009", _
"sign_010", "sign_011", "sign_012", "sign_013", "sign_014", "sign_015", "sign_016", "sign_017", "sign_018", "sign_019", _
"sign_020", "sign_021", "sign_022")
 
Sub StartSign
     SignPos = 0
    SignTimer.Enabled = 1
End Sub
 
Sub SignTimer_Timer
    Sign.ImageA = Frames(SignPos)
    SignPos = (SignPos + 1) MOD 22
End Sub
 
calling the sub StartSign starts the animation. Adjust the timer interval to change the speed of the animation.

Edited by Fusionwerks, 09 March 2024 - 08:28 PM.


#3 Ltek

Ltek

    Enthusiast

  • Members
  • PipPipPip
  • 149 posts

  • Flag: United States of America

  • Favorite Pinball: TRON NEON, Swamp Thing Bayou Edition, Volkan, SW Bounty Hunter, IT, Harry Potter, Dragon's Lair

Posted 09 March 2024 - 09:45 PM

thanks for the help!

 

Its compiling correctly but the animation is not occuring.

 
Inside the table I created:
Timer 'BITpostTimer'
Flasher 'BITpost' :: assigned an image and made it visible
 
here's my code...

Dim BITpost,BIT_Frames

‹BIT_Frames = Array("TronBIT_00_0.06s","TronBIT_01_0.06s","TronBIT_02_0.06s","TronBIT_03_0.06s","TronBIT_04_0.06s","TronBIT_05_0.06s","TronBIT_06_0.06s","TronBIT_07_0.06s","TronBIT_08_0.06s","TronBIT_09_0.06s","TronBIT_10_0.06s","TronBIT_11_0.06s","TronBIT_12_0.06s","TronBIT_13_0.06s","TronBIT_14_0.06s","TronBIT_15_0.06s","TronBIT_16_0.06s","TronBIT_17_0.06s","TronBIT_18_0.06s","TronBIT_19_0.06s","TronBIT_20_0.06s","TronBIT_21_0.06s")

Sub BITpostTimer_timer
    BITpost.ImageA = BIT_Frames(BITpost)
    BITpost = (BITpost + 1) MOD 22
End Sub

Sub StartBITpostAnimation
    BITpost = 0
    BITpostTimer.Enabled = 1
End Sub

Edited by Ltek, 09 March 2024 - 09:48 PM.


#4 xenonph

xenonph

    I have Pinball Fever!

  • VIP
  • 4,131 posts
  • Location:Castle Rock, WA.

  • Flag: United States of America

  • Favorite Pinball: TRON Classic-Congo-Xenon-PINBOT-BOP-LOTR-A Real American Hero OPERATION PINBALL-Millionaire-Whirlwind-Krull-NFL-BlackKnight-FishTales

Contributor

Posted 09 March 2024 - 10:05 PM

 

thanks for the help!

 

Its compiling correctly but the animation is not occuring.

 
Inside the table I created:
Timer 'BITpostTimer'
Flasher 'BITpost' :: assigned an image and made it visible
 
here's my code...

Dim BITpost,BIT_Frames

‹BIT_Frames = Array("TronBIT_00_0.06s","TronBIT_01_0.06s","TronBIT_02_0.06s","TronBIT_03_0.06s","TronBIT_04_0.06s","TronBIT_05_0.06s","TronBIT_06_0.06s","TronBIT_07_0.06s","TronBIT_08_0.06s","TronBIT_09_0.06s","TronBIT_10_0.06s","TronBIT_11_0.06s","TronBIT_12_0.06s","TronBIT_13_0.06s","TronBIT_14_0.06s","TronBIT_15_0.06s","TronBIT_16_0.06s","TronBIT_17_0.06s","TronBIT_18_0.06s","TronBIT_19_0.06s","TronBIT_20_0.06s","TronBIT_21_0.06s")

Sub BITpostTimer_timer
    BITpost.ImageA = BIT_Frames(BITpost)
    BITpost = (BITpost + 1) MOD 22
End Sub

Sub StartBITpostAnimation
    BITpost = 0
    BITpostTimer.Enabled = 1
End Sub

 

Remove the < character from in front of BIT_Frames = Array.

 

I would also remove the "0.06s" from the file names.


CHECK OUT THIS TUTORIAL http://www.vpforums....howtopic=32515
TO USE DB2S BACKGLASS PROGRAM WITH DESKTOP TABLES ON 1 MONITOR
 

#5 Ltek

Ltek

    Enthusiast

  • Members
  • PipPipPip
  • 149 posts

  • Flag: United States of America

  • Favorite Pinball: TRON NEON, Swamp Thing Bayou Edition, Volkan, SW Bounty Hunter, IT, Harry Potter, Dragon's Lair

Posted 09 March 2024 - 10:27 PM

OK, I got it working... wow. I kept mixing up terms in the script.

 

2 more easy questions...

 

1. If I want to disable it, do I just make the flasher object .visible=false or should do i need to stop the timer?

2. What if I want to make it run only a single animation cycle /  run through all frames only once?  

 

 

thx again guys!!!

' Trust Post Flasher Animation
' note: use TrustPostFlasher.visible = False in script if you want to turn off the animation and remove image
' note: use StartTrustPostFlasher (to start the animation) in script -after- you set TrustPostFlasher.visible = true
' create in table editor:  flasher object 'TrustPostFlasher' and timer object 'TrustPostTimer'
Dim FramePos, Frames
' 22 frames (0 to 21) 0.06 seconds each


Frames = Array("TronBIT_00","TronBIT_01","TronBIT_02","TronBIT_03","TronBIT_04","TronBIT_05","TronBIT_06","TronBIT_07","TronBIT_08","TronBIT_09","TronBIT_10","TronBIT_11","TronBIT_12","TronBIT_13","TronBIT_14","TronBIT_15","TronBIT_16","TronBIT_17","TronBIT_18","TronBIT_19","TronBIT_20","TronBIT_21")


Sub StartTrustPostFlasher
    TrustPostFlasher.visible = True   ' make is show on playfield
    FramePos = 0 ' set value to 0 in the Array
    TrustPostTimer.Enabled = 1 ' enable the timer to control animation speed
End Sub


Sub TrustPostTimer_timer  ' timer to control animation speed
    TrustPostFlasher.ImageA = Frames(FramePos)
    FramePos = (FramePos + 1) MOD 22
End Sub

Edited by Ltek, 09 March 2024 - 11:05 PM.


#6 Fusionwerks

Fusionwerks

    Poorly recovering pinball addict

  • Platinum Supporter
  • 417 posts

  • Flag: United States of America

  • Favorite Pinball: JP (DE), Deadpool, James Bond 007

Posted 09 March 2024 - 11:28 PM

first, just because i used 22 frames in my example does not mean that you are limited to that... the Blade runner table uses over 325 i think... just consider the file size after you load up a bunch of images. use as small as possible images, and use the webp format. 
 
1. if you want to disable it, then just call this line in a sub somewhere:
TrustPostTimer.Enabled = 0 ' Disable the timer to stop the animation
and if you want to hide the flasher then call this line:
TrustPostFlasher.visible = False
Personally i would stop a timer anytime it is not being used.
 
2. If you want to stop it after 1 cycle and then hide it, here is you modified code:
 
Dim FramePos, Frames
 
' 22 frames (0 to 21) 0.06 seconds each
Frames = Array("TronBIT_00", "TronBIT_01", "TronBIT_02", "TronBIT_03", "TronBIT_04", "TronBIT_05", "TronBIT_06", "TronBIT_07", "TronBIT_08", "TronBIT_09", "TronBIT_10", "TronBIT_11", "TronBIT_12", "TronBIT_13", "TronBIT_14", "TronBIT_15", "TronBIT_16", "TronBIT_17", "TronBIT_18", "TronBIT_19", "TronBIT_20", "TronBIT_21")
 
Sub StartTrustPostFlasher
    TrustPostFlasher.visible = True   ' make it show on the playfield
    FramePos = 0 ' set value to 0 in the Array
    TrustPostTimer.Enabled = 1 ' enable the timer to control animation speed
End Sub
 
Sub TrustPostTimer_timer  ' timer to control animation speed
    TrustPostFlasher.ImageA = Frames(FramePos)
    FramePos = (FramePos + 1) MOD 22
 
    ' Check if the animation has reached the end of the array
    If FramePos = 0 Then
        TrustPostTimer.Enabled = 0 ' Disable the timer to stop the animation
        TrustPostFlasher.visible = False ' Optionally, hide the flasher when the animation stops
    End If
End Sub

Edited by Fusionwerks, 09 March 2024 - 11:35 PM.


#7 Ltek

Ltek

    Enthusiast

  • Members
  • PipPipPip
  • 149 posts

  • Flag: United States of America

  • Favorite Pinball: TRON NEON, Swamp Thing Bayou Edition, Volkan, SW Bounty Hunter, IT, Harry Potter, Dragon's Lair

Posted 10 March 2024 - 01:50 PM

thanks again for the help... this is far better than the way I've seen it done with Case statements. Would be great if VPX devs added support for aGIFs, aPNG and MP4.

 

its funny, the aGIF I'm using was exactly 22 frames :)







Also tagged with one or more of these keywords: playfield, vpx, animation, gif, png, mp4