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

seek(), time() and progress()

seek(), time() and progress() are all methods that help us control time. There are differences between them and that's what we want to explore. In the last lecture, we've saw the differences between the seek method and time method. In this lecture, we will add to our tools a bit by controlling animations with the progress method.

Video Transcript

00:00So before I wrap up the seek and time,
00:02I just want to show one more method that is almost the same,
00:05but it gives you another option, another way to animate,
00:08and it's called progress.
00:09Progress also helps you jump in your timeline.
00:12And the only difference between seek time and progress
00:16is progress doesn't get a time, actual real time,
00:19but it actually gets a value between zero and one
00:22where zero is the beginning
00:24and one is the end of your animation.
00:26So if I call the progress instead,
00:29and I set the value,
00:30we want to put here a value between zero and one.
00:32Lucky for us, if we take our stage X at this initial value,
00:35this initial value should be between zero and one
00:37unless we go out of the stage area,
00:39which is usually only possible
00:41if we're doing it inside of flash.
00:42Now, by the way, by default,
00:44the progress will not suppress events,
00:47so that way our on text update should be called.
00:49So if we just call it this way
00:51without even duplicating the duration,
00:53we should be getting the same effect
00:56and our text should be working
00:57just as well as it did when we used the seek and the time.
01:01So there you go, you have three different ways
01:02of creating the exact same animation
01:05using the seek, the time, and the progress.
01:07And you can pick either one of them
01:09based on your preference
01:10or based on your available information that you have
01:13or based on your wishes, really.
01:15All right, so there you go.

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!