Page 1 of 1

Animated GIFs as title cards.

Posted: Tue Dec 29, 2020 4:38 pm
by SLAPPYHAPPY2000
Is it possible to have animated title cards using GIFs?
Whenever I use a GIF as a title card, it never animates, it always defaults to the first frame.

P.S. Thank you Eizzoux for help on the editor music. You're a legend. :)

Re: Animated GIFs as title cards.

Posted: Wed Dec 30, 2020 8:32 pm
by Holger
I assume that you mean title screens, and I assume that you mean animated GIFs that you want to play there, right? :-)

Loading images in GIF format is fully supported by the SDL library used by R'n'D, but there is no support for loading or playing animated GIF images that I know of. But it's very easy to do what you want to do!

First, find a program that loads your animated GIF file and saves all frames of the included animation. Make sure that it does not save them as single files, but as some sort of "sprite map" with all animation frames in one large bitmap. Save this in any format supported by SDL (PNG, GIF, PCX ... doesn't matter -- when in doubt, use PNG).

Then you can just define a "global animation" that is played on the title screen of your choice!

For an easy example how to do this, have a look at the title screen animation of the level set "Original Supaplex" in the Supaplex level collection! You can find it in the file "Supaplex/gfx_supaplex_original/graphics/gic_sp_title.conf"!

This is a very simple animation that plays on the second title screen.

Re: Animated GIFs as title cards.

Posted: Wed Dec 30, 2020 8:55 pm
by Eizzoux
For that case, again, you can just make global anims on TITLE/TITLE_INITIAL event or their sub-events (TITLE_1-TITLE_5, TITLE_INITIAL_1-TITLE_INITIAL_5):

Code: Select all

gfx.global.anim_1.TITLE_1:                     sprite.png < Image file
gfx.global.anim_1.TITLE_1.x:                   0 ← X position of initial animation frame in the image file
gfx.global.anim_1.TITLE_1.y:                   0 ← Y position ~
gfx.global.anim_1.TITLE_1.width:               160 ← Width of the sprite
gfx.global.anim_1.TITLE_1.height:              120 ← Height of the sprite
gfx.global.anim_1.TITLE_1.frames:              8 ← Amount of frames used in animation (starting from initial frame to the right)
gfx.global.anim_1.TITLE_1.delay:               4 ← Delay between frames (50 frames = 1 second)
gfx.global.anim_1.TITLE_1.anim_mode:           pingpong ← Animation mode
gfx.global.anim_1.TITLE_1.draw_masked:         true ← Mask out the black background/transparent texture
global.anim_1.TITLE_1.x:                       46 ← X position in viewport
global.anim_1.TITLE_1.y:                       28 ← Y position in viewport
global.anim_1.TITLE_1.draw_order:              6 ← the "Z position" of the animation (The bigger the number - the higher it draws over others)
global.anim_1.TITLE_1.class:                   window ← Type of viewport you want to draw the animation in (The entire screen, playfield, door_1 or door_2)
Not with actual GIF, but with each frame ordered in one image file (PNG, PCX, whatever)
And that's just a small part of animating with global anims, including playing animation "in parts" by playing several parts on one anim in order, moving animations step-by-step and making animations clickable or triggerable by other animations, but listing all of them here requires writing a freakin' humongous tutorial documentary (at least I feel like so), so here's just a simple example of what can be done with global anims on title now:
just a thing full of placeholders
just a thing full of placeholders
Honeycam 2020-12-31 04-38-05.gif (222.29 KiB) Viewed 8468 times