Positioning animations in the timeline
In the last lesson we created our first timeline. Each time we added in an animation, it would be added to the end of the timeline. But what would happen if you needed to adjust that positioning? You might’ve guessed that at this stage, there are ways of positioning controllers. By the end of this lesson, you will know how to position elements in the timeline.
Video Transcript
00:00Chapter 6, we're still just scraping the capabilities of using Timeline Light.
00:07And I think you're already starting to get the power of it.
00:10And the biggest power of it is you're stringing your animations together,
00:15making it a lot easier for you then later on to make minor tweaks
00:19without needing to worry about every single other animation in the chain.
00:23In many ways, you're creating chains between animations.
00:26That way, if you change a specific chain, it automatically changes all the rest.
00:31Contrary to the way that it works between Light, if you're doing them separately,
00:35there is no chaining. You're in charge of the chaining.
00:38And when you're in charge of the chaining, it means you have to add a lot more.
00:42Basically, you have to manage a lot more than you would have while contrary to you.
00:47Well, right. Okay, that makes sense.
00:49So in this video, what I want to do is I want to create a real live kind of scenario example,
00:53completely going random here.
00:55It might be more complicated than I'm expecting.
00:57So I'm just going to go for it. Join with me.
00:59What we're going to do now is I'm just going to go into our basic FLA file.
01:03And I was just thinking in my head, wouldn't it be wonderful?
01:06Let me just give it a label. Chapter 6B.
01:09And wouldn't it be wonderful if we created some sort of a transitional animation for our logo?
01:14So how about we have there something like Zero to Geek,
01:17Learning Better is Better, which is our brand copy, or Zero to Skills,
01:21Learning doesn't have to be a cheap thrill.
01:23Let's do Zero to Geek. So Zero to Geek, Learning Better is Better.
01:26So let's lay down our copy and then decide how do we want it to animate.
01:30So let me just get that copy in there. So Zero to Geek.
01:33Let me just make sure that it's a dynamic text field.
01:37And let me make the copy way bigger because we have a lot of room on the stage.
01:43So okay, so Zero to Geek.
01:46And let me just center this.
01:49So I'm going to go here and center it on the stage.
01:53Let me just center it.
01:55And I'm going to push it now a little bit up because I really want to create another copy here
01:59right underneath it. And it's going to say here, Learning Better is Better.
02:03So let me just type that.
02:05Learning Better is Better.
02:10And let me again make this copy way smaller so we could actually see it.
02:16And getting warmer.
02:19So we'll make it even smaller.
02:22That's too small.
02:26Okay, so we're very close, which I think this probably could be a tad bigger.
02:32So let's just push it to be 105.
02:35Let's see how that looks. Beautiful.
02:37So they're more or less aligned.
02:39Let me just delete all the extra text fields I've plopped around here by mistake.
02:43Let's type our ship up a bit.
02:46And let me just also, I'm going to go to my view and I'm going to add a ruler
02:52because I really want to make sure that I'm not floating because it always looks bad
02:57when you have copy that's overflowing.
02:59So I'm just going to tinker with it a little bit and just push our text a little bit in.
03:04Let me just zoom in here.
03:07Just to make sure that our copy is just about flushed in here.
03:14Okay, and I could see here that I could if I could just squeeze that just a bit now
03:19because you know in flash you can't really go beyond like one pixel.
03:23So we could play around with the letter spacing, but we see that literally when we're going
03:27when we're pushing it more than somewhere that spacing is between the two.
03:31I could try to squeeze it in, but really now that I'm not going to have a way to sort it out.
03:36So what I'm going to do is I'm just going to push it a little bit.
03:39Make sure that it's a little bit going on each end a little bit more than it should.
03:43Perfect. So we have our graphic.
03:45What I'm going to do now is I'm just going to grab it here for a second.
03:49I'm going to go into my modify and I'm going to convert it into a symbol.
03:53And I'm going to just call this MC lead for our MC lead copy.
03:58And I am going to export it to action script because we're actually going to add it onto the stage.
04:03And I'm also going to go ahead and call it LMC lead.
04:06I like calling anything that's actually a linkage,
04:08which this is what it is when we're working on flash.
04:10To start my class name with L to make me aware that this is not a real class, but it's a linkage class.
04:15So that's perfect.
04:16And my registration point is in the middle there, which is perfect as well.
04:19So I'm going to tell me that this class doesn't exist,
04:23which I know because we're creating it dynamically.
04:25And I'm going to go ahead here and I'm just going to turn this layer into a guide layer.
04:31That way, if someone is coming from an earlier chapter,
04:34they wouldn't actually see anything.
04:36And I'm going to go back into my code.
04:38And what I'm going to do next is I'm actually going to create that element
04:41and I'm going to push it into the right spot on the stage.
04:43So first of all, my MC logo, my visible is going to be false as well.
04:48And we're going to create here a new variable private var.
04:51It's going to be MC lead and it's going to be a movie clip.
04:56And I'm going to go ahead to my MC lead.
04:58And I'm going to tell it you are equals new LMC lead,
05:03which was the name of our movie clip.
05:05And I'm going to add that to this child MC lead.
05:09I'm just going to see that it's on the stage.
05:11And if it is, then we'll continue it.
05:12It sure is.
05:13And it's exactly in the wrong position that we don't want it to be in.
05:16So next step, I'm just going to go ahead and just position it.
05:18So I'm going to go ahead and call my tween light.
05:22And I'm going to just set its position for our MC lead.
05:26And I'm going to set its original.
05:28Oh, actually, you know what?
05:29Let's just start animating, right?
05:31So let's start animating.
05:32And we're going to use that tween light, the TTL, the TLL, the timeline light.
05:39And the first animation I want to do is I wanted to basically just animate into its spot.
05:44To make that happen, I'm just going to add another animation.
05:48And I'm going to create send inside of it a new tween light.
05:51So I'm just going to call there that tween light.
05:54And I'm going to tween to.
05:55Well, actually, I'm going to tween from because I want to set where is,
05:59oh, actually, two.
06:03We're going to use the two from the from two.
06:08We haven't done that in a very long time.
06:10So I'm going to take the from two.
06:12And we're going to first set our target.
06:14So first of all, our target is our MC lead.
06:18Next is the duration.
06:19We want it to take 0.5 seconds.
06:23We want it to do from where do we want it to go?
06:25We want it to be start from a scale X, a really big scale.
06:28Let's say a five, a scale Y of five as well.
06:32It's like five times as big as it should be.
06:35We want to start from an alpha of, let's say, 0.8.
06:39So it's not fully opaque.
06:42And what else do we want it?
06:43We want to start from that seems about right.
06:45So it's really big.
06:46Oh, and we also want to set its position.
06:48So that's going to be in our X is going to be staged at stage with divide by two.
06:55And our stage and our Y is going to be staged at stage height divided by two.
07:03All right.
07:04So let's first give it a roll.
07:05I'm just going to paste it the way it is.
07:07Send it into our animation, fix whatever typos we have there.
07:11So let's see.
07:12We're expecting four arguments.
07:14So let's see where are we failing here.
07:16So first of all, my guess is that we're probably not closing something.
07:19So I'm just going to make sure that I've closed my two.
07:23Let's see.
07:24Okay.
07:25So we got here.
07:26Oh, because we're doing a from two.
07:27So we only told it from where we didn't really tell it where it's going to.
07:30So we need to put here another property.
07:32So let me just break a line here because it's getting a little bit too cluttery and too
07:36big.
07:37And I'm going to go ahead and just copy all these animations and just tell it where do
07:40we want it to go to.
07:42Okay.
07:44So for our scale, we want to scale down to one.
07:47We want to scale our Y down to one and we want our alpha to be one as well.
07:53And for our X and Y, we don't really want to change it.
07:55We're happy with that original position where it's at.
07:59All that's left for us to do is again, run it now and hopefully we won't have an error.
08:03And there we go.
08:04Our first of all, our zero to geek learning better is better drops right in.
08:08This is exactly what we want it to happen.
08:11Now let's take it a layer deeper.
08:13So how about we go inside of our this new movie clip that we've created and add also
08:18some masks.
08:20So how about we add a mask where zero to geek is first and that's fine.
08:24And then we want to have maybe the learning better is better to be animated in through
08:29a mask.
08:30All right.
08:31So let's go ahead and in the traditional way of working with action script in general,
08:36what I'm going to do is I'm just going to create a new layer here and I'm going
08:39to create a mask layer.
08:40So I'm just going to go ahead and what I'm going to do is I'm going to separate between
08:44the learning better and is better.
08:46So I could actually put it in a mask.
08:48So this will be zero to geek and this is going to be better.
08:53And I'm just going to highlight that frame and then just paste in place.
08:57So it's going to be in the right same spot, lock up zero to geek so we don't play
09:01with it by mistake.
09:02And I'm just going to go ahead and create a mask layer for it.
09:05So I'm just going to go select a red color, turn that into the square tool or
09:16the rectangle tool and I'm just going to go ahead and just mark everything here
09:20that we want to actually be masked.
09:22Now I'm going to go ahead and turn that into a movie clip by double clicking on
09:26it to select it all.
09:27And by the way, we don't need the framing around it so we can delete it.
09:30It doesn't really matter, but we don't want it.
09:32And I'm going to go ahead and turn that into a movie clip.
09:34So I'm going to convert that symbol into a mask, MC mask.
09:40And we don't have to export it for action script because we have direct access
09:43to it because we only need to add our MC lead.
09:47So I'm going to go ahead and give this a name.
09:48So I'll call this MC mask.
09:51Now last but not least, I could actually define it to be our mask.
09:54So I'll just call this mask and I'll go ahead and set it as a mask by selecting
10:00the mask option.
10:02And there you go.
10:03And you can see that learning better is better is masked now, which is perfect,
10:07which gives me the opportunity to now animate the learning better is better or
10:11animate the mask either or.
10:13So let's start with animating the learning better is better.
10:15And what I'm going to do is I want to push the copy to be above the mask in the
10:19beginning and then animate its way in right after that.
10:24So let's see what I mean.
10:25So I'm going to go ahead and first of all, to do that, I'm going to have to
10:28make sure that also my copy itself has basically a property.
10:32So we could actually interact with it, have a name.
10:35So I'm going to call this T tagline and going to go back into my action
10:41script and we're ready to add a new timeline animation.
10:44So I'm going to call that ad again, and I'm going to call a new tween, a
10:49new tween light tween light.
10:55And it's going to be from only because we know it's exactly where it needs to
11:00be, but we actually want it to be to start off from a little bit above,
11:05which basically only our Y property we want to change.
11:07So I'm going to just say to what do we want to change?
11:10We want to go ahead to our MC lead and we want to go to our T tagline,
11:15which I think that was lowercase.
11:16Let me just double check.
11:22Yep. Tagline T tagline.
11:24So I'm just going to, uh, the T tagline is what we want to animate.
11:28How long do we want the animation to take?
11:30How about a zero dot four seconds?
11:33And noted, don't forget that this is going to happen only after this
11:36animation completes.
11:38So I'm going to go ahead and I'm going to set what property do I
11:40want it to start from?
11:41Is that why?
11:42And what I want to do is I just want to push it up, uh, let's say a hundred
11:46pixels.
11:47So that way it's going to be out of frame and I'm just going to add a frame of
11:51our mask.
11:52And if I just say that, close that, close that, save that, run it.
11:56Let's see what happens.
12:01And I don't know if it just happened.
12:02Oh yeah, it just happened too quickly.
12:03So you see our logo comes in, our copy comes down.
12:06Logo comes in, copy comes down.
12:08Beautiful.
12:09Now let's continue further.
12:10How about we wanted that zero to geek and then we'll see the copy learning
12:14better.
12:14And only after that is better.
12:16We'll animate in to do that.
12:18We're going to approach our mask itself that exists already.
12:21And I'm going to go ahead for my mask, which we called MC mask.
12:24Just make sure that we definitely called it that.
12:27So if I select it, we'll see that it's called MC mask.
12:31And literally what I want to do is I want to kind of like, I'll play
12:34around with the size in the beginning to see what works best, but let's go
12:37ahead and just start creating that animation.
12:39I'm just going to copy this and I'm going to add this animation and
12:43really what I want this animation to happen after.
12:45And again, I want it to be with the from.
12:48So I'm going to go into my MC lead and I want to contact my MC mask.
12:55And I want this animation to take maybe 0.6 seconds.
12:59And I want instead of the Y, I want my actual scale X to start from a different value.
13:06Let's start from 0.5 and see if this is the right position.
13:09And if it's not the right position, that we could go back and
13:11try to figure out how to improve it.
13:12So literally what we're expecting is our animation to come fully in, then for this
13:17to drop in and only after that for this to drop to continue animating in.
13:22So our scale X will grow and we just want to make sure that the
13:25positionings are right.
13:26So, so you can see that our problem right now is that our, our
13:29mask itself is scaling in both directions.
13:33And the reason that's happening is because our mask, if we go into it
13:36is centered, our X zero position is right here.
13:39What we really want to do is we want to push our, our content for X to be
13:44actually starting from here.
13:45That way it's going to, even if both sides scales, you're only going to
13:49see it from this side because that's how it works.
13:52So I'm just going to push this all the way back to its right position.
13:56And again, let's run it, give it another chance.
13:58So our learning better is better.
14:00And then it continues fading in all I have to do is, oopsie.
14:03All I have to do is play.
14:05All I have to do is play around with our actual mask value and try
14:10to find that right as it's almost there.
14:12So zero to 65, probably zero to geek learning better is better.
14:18Okay.
14:19Now I want to do one more or two more animations.
14:21And what I want to do is I want to do two things.
14:24One is I want at this stage for my actual logo that was invisible
14:29to become visible and to animate itself in.
14:33Now I could, and because I'm working between light, it won't automatically
14:39import it, but remember we were talking about plugins.
14:42We could import the plugin that automatically turns on our alpha
14:46using that auto alpha.
14:49So I'm going to go ahead and I'm going to import my com green sock
14:54plugins, auto alpha plugin.
14:57And we also want to import our com green sock plugins.
15:03And we want to also, uh, our plugin engine, which I don't remember by
15:07heart its name, so let's find it really, uh, really quickly.
15:11Plug in, I think it's plugin.
15:13No.
15:14All right.
15:14So let's just find it really quickly.
15:17There's quite a lot of plugins in here.
15:18Uh, Oh, here we go.
15:19Tween, tween plugin.
15:22All right.
15:23Uh, next is we actually want to activate that tween.
15:25So I'm going to go to that tween plugin.
15:28And again, that's because we're using tween light.
15:30It doesn't automatically activate it.
15:32We haven't used tween max.
15:34So we don't have that automatic activation.
15:36And all I have to do is create an array, send it into the array, the actual
15:41plugins we want to activate.
15:42In this case, we just want the auto alpha plugin to activate.
15:45Perfect.
15:46So let's continue to go down to our animation and I want to add another
15:49animation and now I want to get our logo back in.
15:52So to do that, I'm just going to animate a two for our logo and I'm
15:56going to call my MC logo and I am just going to set how long do I want it to
16:01be. Let's say let's just start with one second and, um, yeah, why not?
16:05Let's scale our X.
16:06Let's do it to one dot one.
16:07Let's scale our Y set it to one dot one auto.
16:13And we want to make sure that our alpha is one to kind of turn on the
16:16actual visibility because right now it's actually invisible falls.
16:19As soon as we animate the visibility on it should automatically display it.
16:23And less than that, at least let's put a little of ease in here.
16:26So let me just, um, import an ease.
16:31Okay.
16:35Ease.
16:35Let's do, uh, something like a elastic or bounds.
16:40Let's start with elastic.
16:41And if we don't like it, then we could, uh, switch it around.
16:43So I'm going to go here and add my ease.
16:47I'll do an ease in and out.
16:50If I don't like it, we could always switch it around.
16:53Uh, so let's just run it for a second, see what it's actually doing.
16:56See if it's in the direction of what we want, uh, which it isn't.
17:01Uh, so let's just make sure, so I'll just set here visible to be true.
17:06Let's run this one more time.
17:09Okay.
17:09So we were forcing the visibility to be true.
17:12That's good.
17:12Um, so now I set my visibility true.
17:14So I probably don't need the alpha as well.
17:16I'm just basically forcing that attribute to turn in to be true.
17:19That's great.
17:20Next item for me, which basically, by the way, that means I didn't really need
17:23to use the auto alpha plugin in this scenario.
17:25I could just set my visibility to be true.
17:27Cause I wasn't really changing my alpha at any point.
17:30Next step that I want to do is I want my text, um, to actually animate out.
17:34So my MC lead itself, I want to basically bounce out of our screen.
17:39So what I'm going to do here is I'm just going to go to my MC lean lead.
17:43I'll have it animate for zero to four seconds and I'll just have it scale
17:47X to let's say 10 scale Y again to 10.
17:52And I'll just set my alpha to be, um, zero cause I don't want to
17:55create an on complete now, but we could create an on complete and then
17:58just set our alpha, um, to be zero, or we could set our visible
18:02to be false, to be false.
18:05But for that, we would have to import our plugin that helps us do that,
18:10which was the plugin visibility.
18:12I believe plugins visible, visible plugin.
18:17And I was just going to add that into our chain here in our activate that
18:21way, when our animation completes, it will turn the visibility off for MC lead.
18:25Let's give it a roll.
18:26See what it does.
18:28So, so, oh, I should have let it play before I complained.
18:33Um, so that is completely berserk.
18:37That's definitely not what we want.
18:38So let me just, oh, I want to do your two, not a from, and remember when we do
18:42a from it automatically puts that in the beginning, so it literally made
18:45our visibility, it basically did that before anything else happened.
18:49Um, so we're basically, we're creating a two, which basically will make sure
18:52that it doesn't do any changes to our element, um, only later down the chain.
18:56Okay.
18:56So let's, this is one more time.
18:58So zero to geek learning better is better.
19:00Our logo comes in and our text flies out.
19:02See this one more time.
19:05Perfect.
19:05Now our only problem is, is one is I could definitely see that
19:08the scale is not enough.
19:09Let's bump it up even more.
19:11We want it to be like in your face, really, really big.
19:15Next thing that I don't like is this ease cause it's completely invisible.
19:18So let me just do one ease.
19:20Let's do an ease out and see how the ease out actually looks like.
19:23And we might need to pro longer animation.
19:25Cause maybe the ease is just not, uh, it doesn't have enough time.
19:28So we might even go here and set our animation to take maybe two seconds.
19:33Um, and let's try an ease in, but I'm not seeing, I'm not seeing
19:36anything in my elastic so far.
19:40Now it might be cause I have, there's some sort of typo.
19:42Let's see if I have a typo, maybe ease.
19:44No, that's ease that that's, that's good.
19:46So let's try a different ease.
19:48Um, so easing, let's do a bounce.
19:52So I'm going to go ahead and send it a bounce ease in.
19:56And I'm just, I'm going to make this animation way longer.
20:00And I'm just going to comment this out for a second, just to see if we could see
20:03anything there before we move on to our next animation.
20:09So our problem and I'm now I'm kind of catching what's going on is that our
20:14visibility of our item only flips after the animation is complete.
20:19So when we set our visible true, it just didn't help us cause we didn't
20:22actually see our animation.
20:24So what I, what I'm going to have to do is I'm going to try, I'm going to
20:28have to figure out a way to get my item to become visible before I
20:32actually do anything else.
20:34So what I'm going to do now is I'll just add a kind of a step in between.
20:39I could have, if I wanted to add an on complete here and only then
20:42toggle my visibility, but I really don't want to do that.
20:45So I'm going to try and figure out if I have a way to actually change
20:49here, um, our MC logo, and I'm just going to put here like a 0.1 second,
20:55just to make sure that it takes it a little bit of time to do it.
20:58Uh, and, and all I'm going to do is I'm going to set my visibility to true
21:01and that, so there you go.
21:02I'm going to just set that to be true.
21:04So it's going to take us 0.1 seconds.
21:06I can even make that even less than that.
21:07So it'll be really, really fast animation that just switches our element on.
21:12So let me just test this out, see if it works and we have to close that twice.
21:17Let's run it one more time.
21:19So literally what I was doing is I made sure it's on and then I turned it on.
21:23Beautiful.
21:24And now that animation is working again, so we could go down here and make it
21:27one second and let's see if in one second, our bounce is nice.
21:31So we definitely have here a nice pulse.
21:33And what I want this pulse to supposedly do is basically push out
21:37our content out supposedly.
21:39So let's turn on our animation again.
21:41Let's see if that, if they work together, if they make sense now.
21:45So they absolutely do.
21:46The only problem that we have right now is that as soon as this starts moving,
21:51we want our copy to start flinging out.
21:53So we don't want this delay that's actually happening to happen
21:57or we want a much shorter delay.
21:59And remember, we talked about this in the previous video, although
22:01we didn't have a chance to see it.
22:02We said that add property of the timeline light as a property
22:07that enables us to tweak the actual when will it come in?
22:10In our case, I could go right into that animation, say, hey,
22:13I want to tweak you and put an absolute value.
22:16So I could see 10 seconds into this whole timeline and do this animation.
22:20But really, what I want to say is I want a current timeline
22:23where our our timeline is right now.
22:26I just want to go minus equal that whatever that is.
22:29Let's say one second, which basically would be exact same time
22:32when this item comes in, because I want these two animations
22:35to happen at the same time.
22:37I could have done a plus equal as well, saying, hey, push it a little bit further.
22:40And by the way, I could have also added here a delay of one second,
22:43which would do the same.
22:44But in my case, I really wanted to be exactly
22:46in the same time for them to overlap each other.
22:49So I'm just going to save that and run that.
22:51And now our item will come in and fling out
22:53as soon as this animation starts running.
22:56Now, let's start tweaking our animation before we wrap up this video.
22:59If we're watching this zero to geek and I really want users
23:02to be able to see zero to geek before any copy comes in.
23:05So when I'm looking at this zero to geek, I need another second,
23:08another second delay before the next animation comes in.
23:12So to make that happen, I'm just going to again go to that last property
23:15and just add here a plus equals one,
23:18making sure let's just add here for a second one
23:20and then see if it's zero to geek.
23:23Learning better is better. Perfect.
23:24So first of all, zero to be great.
23:25Now, another thing is that tagline mask, that learning better.
23:30I think it's maybe a little bit too fast.
23:32So maybe I'll make it a little bit slower
23:35and it will automatically push everything further.
23:37So I don't have to worry about tweaking all these animations
23:40just for this change.
23:42So again, zero to geek animation is slower learning better.
23:46Now, again, now it's taking after this animation completes.
23:50I don't want really this to happen that quickly.
23:52So I'm going to go ahead and add here another.
23:55Let's try another second delay again just to see how that works.
23:59So zero to geek, learning better.
24:02Oh, you see that.
24:03So first of all, I did your plus one by mistake and I need plus equals one.
24:07So let's do that one more time.
24:10Learning better is better and that's taking way too long.
24:14So let's give this learning better zero dot five delay.
24:18And I don't really want this to be a second after.
24:21Maybe I really want this to happen at the same time.
24:24But let's let's forget about that.
24:25Let's assume that we're fine with it.
24:27Let's just look at this for a second.
24:29And I'm just going to add here a delay here as well,
24:31because I don't want anything to be here before we have this visibility.
24:36So I'm just going to set here another plus equals one
24:39to kind of like give our stage a second to breathe before anything else happens.
24:43Learning better is better.
24:45Now we're waiting for a bit.
24:47Logo comes in and look at how much cleaner this transition is now.
24:52And I didn't have to worry about anything.
24:53So even if at some point in stage, a client comes and says, hey,
24:57we really need the zero to geek tagline to be longer.
25:00It could just come ahead here, bam, make it three seconds longer, the delay.
25:05And now all the rest will move along with it.
25:07So I'll have your zero to geek, one, two, three.
25:10And all the rest will continue the way it was working before.
25:14So that's it.
25:15So that's it about the basics of timeline light.
25:19And that's really the power, the core behind timeline light.
25:22In the next video, we're going to explore some of the features
25:24that should be more or less familiar to you already,
25:27because you've seen them in action when we were playing with the tween light
25:30and tween and with the tween max.
25:34But obviously, this is very, very controlled, very, very cool.
25:38The control and level that you would have using tween light timeline.
25:42Right. See you in the next video, where we will explore those methods.
