Animated GIFs as title cards.

Got a cool idea that should be in R'n'D? Let's hear it!

Moderators: Flumminator, Zomis

Post Reply
User avatar
SLAPPYHAPPY2000
Posts: 110
Joined: Wed Jun 03, 2020 10:27 am

Animated GIFs as title cards.

Post 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. :)
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Animated GIFs as title cards.

Post 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.
User avatar
Eizzoux
Posts: 567
Joined: Wed Oct 30, 2013 5:32 am
Location: Russia
Contact:

Re: Animated GIFs as title cards.

Post 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 6190 times
𒈟
Post Reply