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

Adding callbacks at any point in a timeline

When working with timelines, not only can you use the built in callbacks available in the library, but you can add functions to be called at certain points in time controlled by you. In this lesson, we'll explore the call method which enables us to trigger a callback at specific point in time.

Video Transcript

00:00Welcome back. All right, let's continue. So we were talking about animations
00:04I started talking about how do you know when all these animation are complete?
00:07But really I want to dedicate a few seconds just for delayed calls
00:11So I want to show you how delayed calls work and to do that
00:14Well, you've seen that already with tween light
00:16But I want to show you how you integrate delayed calls using the timeline light instead or in conjunction
00:22So I'm gonna create a private call a function. I'm just gonna call it
00:26call me and
00:28It's private function is just gonna call trace
00:31I was called just to see when our item gets called and
00:35literally what I'm gonna do is I'm gonna go to my TL main and
00:38We're gonna add a delayed call by calling the call function
00:42And when I call the call function, all I have to do is just send a function which I could send out some parameters in my case
00:48I'm not gonna send any parameters. So all I'm gonna do here is just call call me
00:52Now once I do that if I run my application again
00:56We're gonna see that first our animations are gonna go ahead and complete and once our animations will complete them
01:02We should get our call me right here in the bottom here
01:05And we are almost done because zero to geek learning better is that
01:10And there you go. You can see that I was called. Alright, so that's how you basically call a delayed call
01:18Now I want to show just one more thing which with delayed calls
01:21You could always add those functions also directly into that instantiation array in our tweens
01:27But if you add it, for example in your last parameter
01:31Because we're creating a stagger effect
01:34The stagger effect means is that it means that this is gonna be called basically six seconds in it because it's gonna be one
01:41three seconds and then
01:44Three seconds and then six six seconds and so literally if we do it this way
01:48We'll see that way if we call six seconds
01:50We'll see that once six seconds pass for about four or five
01:54There you go, six seconds and then we get into that last part as well
01:58So that that base I'm not gonna wait again because it's a long animation
02:01So those are two different mechanisms and it really just depends on how you want to call it when you want to call it
02:07if you add in
02:09Whatever you add into the tweens happens immediately and it's affected by the stagger
02:13But every single thing that happens after that such as adding more tweens
02:18Do not are not affected by that stagger. The stagger is only with those initial tweens
02:23So if anything we do here will happen after all of these complete by default. Okay. All right
02:29So that's it in the next video. We're going to continue exploring a few other things that are related
02:35Such as how do we change this overall effect? Is there a way to change this overall effect?
02:40We're gonna look into that momentarily

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!