- Home /
are animation frame dependent?
Hi all,
I am wondering how is the speed of an animation set?
for example, 24frame animation is usually played in 1 second. But, lets say I am running the game running at 120 frames a second, does this mean the animation will last: 24/120 = 0.2 seconds?
If this is correct, who do you make frame rate independent animations?
Thanks!
anyone has an idea on this? I feal I've searched everywhere, but could not find the answer
Answer by Hoeloe · Sep 14, 2013 at 12:02 AM
I should probably point out first that the standard for games is not 24FPS - that's the film standard. Games is anywhere from 30 to 120 FPS. Regardless, Unity can run animations in one of two ways. By default, it will display animations with reference to time, tweening between frames to keep it smooth. This prevents the animations from speeding up and slowing down with fluctuations in the frame rate. You can also display animations, however, as a value between 0 and 1, with 0 being the first frame, and 1 being the last. This allows you to have more detailed control over the animation, should you need to.
Thanks for your answer. I have to say it is still a bit blurry to me. for the second part, seems quite clear. But for the first one:
"Unity can run animations in one of two ways. By default, it will display animations with reference to time, tweening between frames to keep it smooth"
I have to say, I do not really understand how do I know then how long my (for example) 24Frames animations will last
anyways, thanks for the hints
It will last the same amount of time at any framerate, I think - it's read as a sequence of frames with respect to the time at which they occur (for example, with a 24FPS animation, frame 1 is at time 0, frame 2 is at time 1/24, frame 3 is at time 2/24, etc. This is true of any framerate, not just at 24FPS). If the framerate is faster than 24FPS, Unity will automatically tween (that is, interpolate between the frames, making a "guess" as to what should be there) in between these frames so that it doesn't appear jerky.
then, i feel that having a function beeing executed on a specific frame is not the best solution is it? as if that frame is not played because Unity have 'tween' it, it may then prevent that frame to be rendered, then the function would not start?
You're misunderstanding. It's still bad practice to do that, because it may skip out frames if the renderer can't keep up, but "tweening" doesn't remove frames from your animation, it adds them in-be*tween* your existing frames to smooth it out.
Ok, I understand what you mean. But then, how would you get an action to be made in a specific time/frame of an animation?
Your answer
![](https://koobas.hobune.stream/wayback/20220613113957im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make an Animation movement happen only after certain keyframes? 0 Answers
animating multiple weapons with 2 arms 0 Answers
Target frame rate between scenes 1 Answer
Animations have been cleared, help! 0 Answers
FPS gun movement 1 Answer