Search In
• More options...
Find results that contain...
Find results in...
• 0

# Counting amount of ticks per frame in a GIF

## Question

I know this sounds a little off topic, but what's the best way to get the number of ticks per frame in a GIF?

The reason I'm asking is because I want to make sure weapon animations in a mod I'm working on are smooth without needing to rely on guesswork for how long each frame is on the screen.

## Recommended Posts

• 1

1 tic = 1/35th of a second, so you have to multiply times in seconds per 35, to get the equivalent in tics.

• 1

GIF frames last for a integer amount of milliseconds. You will lose precision needed to get an accurate 35 frames per second.

Ideally, on a set of 35 frames, you'd alternate durations between 28 and 29 milliseconds, like such:

29, 28, 29, 28, 29, 28, 29,

29, 28, 29, 28, 29, 28, 29,

29, 28, 29, 28, 29, 28, 29,

29, 28, 29, 28, 29, 28, 29,

29, 28, 29, 28, 29, 28, 29

That'll give you exactly 1000 milliseconds for 35 frames (20 frames of 29 milliseconds, and 15 of 28).

On the other way around, if you look at an already made GIF. Then look at how long one of its frame lasts (each frame can have its own length!). Remember that one tic lasts 28.571428571428571428571428571429 milliseconds. So if the frame lasts 100 milliseconds, it represents 3.5 tics. If it lasts 60 milliseconds, it represents 2.1 tics. And since you can't have decimal tic lengths for animations, you'll most likely have to go with approximations.

• 0
1 hour ago, Maes said:

1 tic = 1/35th of a second, so you have to multiply times in seconds per 35, to get the equivalent in tics.

Pyrolex is asking about the frame rate of GIFs, not Doom. I have never made an animated GIF, so I don't know the answer, but I think it would be quite a coincidence if the frame rate of a GIF is the same as the frame rate of Doom.

• 0

Whatever the frame rate of the GIFs (which can also be variable) , he must convert it to seconds anyway.

Of course, it's possible to directly use the formula tics=35/f, where f is the fixed frame rate of the GIF in Hz.