02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Seconds versus frames

Up until this point, we always defined the duration of animation using seconds, but there is another way -- frames. In this lecture, we will explore the option of defining animations by frames instead of seconds by using the  useframes property.

Video Transcript

00:00For the last 40 minutes, we've been hinting that you could choose seconds or choose to
00:05animate through frames.
00:06So let's see how you create animations using frames.
00:10All you have to do is add another property, which is called use frames, and then set that
00:15to be true.
00:16The default is false.
00:18Once you do that, the value that you're putting in animation is going to be based on frames
00:24and not on seconds.
00:25So if I run this again, it's going to be a very quick animation after our delay.
00:30So it's literally just going to take us three frames, one, two, three, to get from point
00:34one to point B. Now, if you're wondering how many frames are there a second, that really
00:39just depends on your frame rate, which you'll find on your timeline itself.
00:44And you'll see on the bottom, your FPS, your frames per second, which for us is 24.
00:49So if we wanted to have our animation take one second, we would put in your 24 because
00:54it would be 24 frames that we would want for our animation.
00:58But if not, if we only left it at three, then it would take three frames literally to get
01:03from position A to position B. All right, so that's use frames.
01:08And let's move on to the next item, which is going to be about the rendering modes.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!