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

What are and how to use Plugins in TweenLite

What are and how to use Plugins in TweenLite

Video Transcript

00:00So now let's create that plug-in like Pavel was hinting at, and this is literally one
00:05of the stuff that are very much, very, very much a thing of Flashlight and up.
00:15So we're, sorry, not Flashlight, Twinlight or up.
00:17So plug-ins basically enables us to improve or expand functionalities in the library.
00:24And we're going to find them inside of the plug-ins library folder, sorry.
00:30And there's quite a lot of plug-ins.
00:31And I'm going to talk with you about two different plug-ins.
00:34One is called the Auto Alpha plug-in, and the other one is called Visible plug-in.
00:39So Visible plug-in, and I'm going to start with Visible plug-in.
00:43The first thing you need to do whenever you're adding a plug-in is first you
00:47need to load or import that item, that plug-in that you want to use.
00:51In this case, we want to use the Visible plug-in.
00:54The next step is we want to actually activate it.
00:57And to activate it, we have to call in another library, another class here.
01:01So I'm going to import it as well.
01:07And this one is located, oh, let me see, let me see, let me see.
01:12It's called the tween plug-in.
01:19OK, so it's inside of the plug-ins, and we'll find your tween plug-in.
01:25Tween plug-in is basically the engine that adds plug-ins to our tweens in general.
01:31So I'm going to add your tween plug-in, and I'm going to activate a new plug-in
01:35by sending an array of the plug-ins that I want to activate.
01:38In this case, I just want to activate one, which is the tween plug-in,
01:41and I literally just add that class into that array.
01:45So again, I'm calling the tween plug-in, I'm activating it,
01:49and then I'm sending inside an array with all the classes
01:52that I want to activate, all the plug-ins I want to activate.
01:54In this case, just one Visible plug-in.
01:58Now, once I've done that, I don't really need this anymore.
02:02So I could comment all this out, and it's literally just a shortcut.
02:07So I could just, you know, I'm going to comment that all thing out,
02:12and all I have to do is add the property Visible false.
02:19Now, what would that do is it's not going to make it Visible false automatically,
02:23but instead of that, it will automatically make the Visible false
02:27once the animation is complete.
02:29So in this case, if I run my animation one more time,
02:31we're going to see that once our animation is complete,
02:34it's going to fade out, although we can't see this.
02:35So how about we leave that on complete there, and we'll have a trace here.
02:43So instead of setting our MC logo Visible,
02:48I'm just going to do a little trace here to see what is our visibility.
02:53I guess we're going to copy that Visible, and there we go.
02:59So it fades out, and notice how it turned automatically to be false.
03:02And, you know, we're jumping around between the chapters,
03:04so it's completely fine, because it's kind of like this lecture together
03:08is kind of like an overview of an overview of everything
03:10to get you guys excited about animating.
03:13So the Visible plugin basically enables you without creating an autocomplete
03:18to automatically switch your element to be visible off when the animation completes.
03:23And by the way, even if we animate it to, let's say, 0.5,
03:26it doesn't really matter.
03:27So it's going to animate to 0.5, and then it's going to plop off to the stage.
03:30So once you set the Visible false,
03:32it will just automatically remove itself or set its visibility to 0
03:36whenever the animation is done automatically,
03:39without you needing to create that on complete.
03:41Now, I want to talk to you about one more plugin.
03:43We talked about the Visible plugin, which one is this one
03:45I don't really use really ever.
03:48And the one that I actually do use and I like using
03:51is the Com Greenstock plugins, which is very similar.
03:55It's called Auto Alpha plugin.
03:58On the Auto Alpha plugin, contrary to the Visible plugin,
04:02again, I have to activate it.
04:03So I'm going to go to the Activate function and add it in there.
04:06Contrary to the Visible false, and I'm just going to get rid of that,
04:12it works in this way.
04:13If the alpha reaches 0 at the end of the animation,
04:16it will automatically change the visibility to 0.
04:20And anytime we animate it back up, it's going to automatically switch it back on.
04:24So for example, if we're animating our element all the way to 0.5,
04:29which is 50%, it's not going to fade it out.
04:31It's not going to make the visibility false.
04:33But if I set my visibility to 0, sorry, I set my alpha to 0,
04:38at the end of our animation, we sure will see that our up.
04:42And it didn't.
04:43How weird.
04:45I was sure it would work.
04:46Look at that.
04:50Yeah, never mind.
04:51Ignore me.
04:53Well, it's basically, in general, I don't know why it's not working right now.
04:56The Auto Alpha plugin should, when it reaches 0,
04:59probably doing something wrong here.
05:01Looking through, I was just kind of unprepared here.
05:04I'm not going to even dig more into it.
05:05The Visible Alpha plugin automatically switches off at the end,
05:09no matter what.
05:10The Auto Alpha, in theory, should automatically set visibility to 0.
05:15It might just take a little bit longer for it to get to that visibility 0
05:19than the Auto Complete actually has a chance to actually show.
05:22Maybe that's the reason why we're not seeing it.
05:24But in general, the Auto Alpha plugin, based on the Alpha level,
05:28should automatically switch the visibility on or off.
05:32So hopefully, that answered your question problem really in detail.
05:35Unfortunately, this demo didn't work out.
05:37The last point is as cool as we would hope for it.
05:42Awesome.

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!