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

Walking through the animation library

A quick intro to the GSAP library. In the library you will find many classes/files as such lets walk through the basic packages and classes you will find in the package. We will explain the main animation libraries: TweenNano,TweenLite,TweenMax, TimelineLite and TimelineMax.

Video Transcript

00:00Awesome, so what I'm going to do now. I'm going to give you a quick intro to the first thing you're going to do after you download
00:06The it's called the GSAP library
00:10The first thing first thing is you're you're going to see in that in that library is going to be a lot of files
00:16And it could be like a file overload. So I want to just do a quick overview of the main classes inside of the library
00:24There's a few other classes that we're not going to talk about it all which are such as the loader or some
00:30explicitly only green
00:33Greenstock member
00:35Which which are but but the core library is the animation library
00:40Where you're going to find the tween nano tween light tween max timeline light and timeline max
00:45So what I want to do is just do a quick overview of what they are
00:49What do you what should you expect from them?
00:51then I'll just make sure that everyone's with me if there's any questions on it, and then we'll start just
00:56animating until we run out of time
00:59So the first thing is the tween nano and the tween nano is the smallest library and it's also the smallest in size
01:05It's only two kilobytes
01:08Which is really small. It's not intended to be used and by the way tween nano doesn't exist in JavaScript
01:15So you're for a job if you are a JavaScript animator or working with JavaScript
01:19It doesn't exist in JavaScript in general the library is more or less 99% the same in action script or
01:27JavaScript which is one of the really cool benefits of using this library because you know how to animate in
01:33One language you know how to animate in the other as long as you know how to work with that specific language in our lecture
01:40right now we're going to be inside of flash, but really it's really small my new differences is different to
01:46Well, I don't think that's even a word between flash and JavaScript
01:50So tween nano is the first difference and tween nano doesn't exist in JavaScript
01:54It was created mainly for banner creators where if any of you worked in the banner industry a lot of times
02:01There's really really low kilobyte requirements from banners. They can't be more than 20 kilobytes 30 kilobytes sometimes 40 kilobytes and
02:10Animators slash programmers that are creating banners have to use the most lightweight that they could
02:16Animation tool and that's where tween nano comes in. It's stripped down to the core minimum
02:22Which is needed to be able to create any animation
02:24It's only 2k and then it doesn't support a lot of features that this library has so in many ways
02:31This isn't really part of the library. It's in the library, but it's really kind of like a standalone minimized version of the library
02:40Contrary to all the rest all the rest is kind of
02:43Interdependent on each other and each one is a layer higher in control than the one before between nano
02:48Although it has less features in between light
02:51It doesn't do a few critical things that tween light could do so in general if you're creating animations
02:58And you're not very concerned about size when we're talking about not very them tween light all it all together is about
03:06Four that seven kilobytes more so you're talking about it six that seven kilobytes
03:09If you get a four six that seven kilobytes added into your project to just start off in the tween mind
03:15If you're very concerned about file size
03:17Then you are not going to be able to use all the features that exist inside of the library
03:22You're only going to be able to use the basic animation
03:26Features that we're going to look at very very shortly
03:28Okay, so that's tween on oh only exists in action script doesn't exist in JavaScript when you move down to the tween light
03:34That's the first tool. That's actually part of the whole package of the whole library where the main features of it
03:41It has more sophisticated
03:44Controls for interactiveness which basically enables you to create better
03:49Interactive animations than you could with tween on oh with less code
03:53And it also adds more functions to it, and it also adds more capability. Which is in
03:59The green sock world is called plug-ins
04:02Which enables you to add features and capabilities that don't aren't inside the tween light and default so for example if you want to
04:09Tint something you wouldn't be able to do that
04:11Built in with tween on oh, but you could do it routine light by adding a plug-in that does tense
04:17Now the difference between tween light and tween max is similar as well
04:21It's just a much bigger library it preloads a lot of plug-ins so such such as tinting and a lot of other things so
04:28Automatically the tween max loads up a lot more things in the tween light
04:32And it comes with a few more features such as
04:34repeat and yo-yo and things of the nature that just make it a lot easier for even more interactiveness and
04:40another layer of
04:42capability of listening to built-in
04:46ActionScript events or JavaScript events while tween light doesn't work with the event model it works with a callback model
04:52We're gonna see that throughout the next hour. We're gonna be working with callbacks, but if you're really into really hard typing and
05:00Things of that nature then you would probably want to work with tween max
05:04Now tween light is even cooler
05:07It's a well. It's basically a wrapper for tween light or tween max it enables you to basically
05:14Create a timeline and put your tweens inside of that timeline instead of creating threading animations on your own
05:20You're basically threading them inside of the tween
05:23Inside of the timeline light what that does it enables you to pause everything to play it back to change the speed of your animations
05:31to even play backwards to reverse to yo-yo with like we were talking about earlier
05:36Well, not yo-yo the actual function yo-yo only exists in the max line, but the idea is similar, so it's basically
05:43it basically enables you to control all your animations in a kind of a
05:49More I'm talking to all the animations at the same time. It's a really cool
05:53I don't think it's even possible to do without a lot of code without the timeline light
05:57So it really cuts a lot of your work if you are planning on creating any animation that is going to be
06:02Repeating itself in different intervals or if it's going to be going backwards and forwards and stuff of that nature now the timeline
06:09Max is on the same idea like the tween light and tween max just adds more control and more capability like the yo-yo
06:16And other stuff of that nature
06:19But really that's one of those stuff you want to just like get yourself familiar with
06:22There's quite a few extra functions that are added inside of the timeline max
06:26We're not going to get to that in this hour
06:28We're not going to get into the timeline light or max at all in this hour
06:31But what you're learning now is going to give you the the motivation to look into the timeline light or max as well
06:38They're very similar they work in the same time
06:40But the type of kind of thought process and just last words about that the tween max and the timeline max are both
06:47They capable of interacting with the built-in flash event so they dispatch flash
06:53Events if you're working in action script and also in JavaScript the JavaScript event, so it's really
06:59This is bigger files bigger files
07:01But give you more control and more kind of programming kind of style less to think you just have access to everything
07:07So that's it that was the intro to all the different types of the core libraries
07:11You're going to find in the g-staff library bundle. I'm going to give the stage just for a quick
07:17Make sure that everyone's cool, and if there's any questions, and then we'll start
07:23animating
07:27Well the table of features to be honest like if even if you just go into green sock comm
07:34As docs you're going to get like a breakdown of the the big
07:38Differences between them, but really once you start animating
07:42And I would just start from the lowest library
07:45And then you'll see that you're missing features, and you're going to go deeper and deeper into them
07:49The differences between them are not very big so when you're looking at the difference between tween light and tween max
07:56Tween light just doesn't come with anything pre-loaded
07:59So if for example you know it's like any any plugins when you go into the end to their documentation
08:07There's like maybe 50 different plugins if it's sound plugins and 10 plugins and physics plugins and motion blur plugins
08:14And and and all these type and and all the different built-in plugins in general that are inside of flash
08:20They're just not there by default and then when you go in and actually go to the tween max the tween max by default
08:27Pre-loads almost not all of them, but it pre-loads quite a lot of them
08:30So you don't have to actually load them up, so it's really just a matter of file control once
08:35You know how to use a tween light library, and you learn how to add plugins
08:40Then you could just switch around and decide are you going to use a tween light or the tween max if you're using more
08:46Than X amount of plugins which I don't know by heart which one it is
08:49Then it doesn't make sense even to use the tween light because then you would just want to use tween max because also comes with a few
08:55Extra functions and those extra functions we talked about are kind of just like making your life easier
09:01We're talking about three things one is dispatching it dispatches actions to three events
09:07there's
09:09For example pause all pause
09:12Your capability of pausing all the different properties your capability of repeating your capability of creating
09:19a yo-yo effect
09:20But it's really just like extra buzz more than like the core essentials that are just needed
09:26It definitely does mean for file size, so let me see let me just go question by question here
09:35You know it does you know David is asking let me just see that there's any other question before that
09:42Okay, so David is asking is
09:44The question is that does it matter with higher bandwidth these days in context of flash
09:50I could understand for JS. Well. You know what it is when if you worked ever in advertising
09:58And it's not true also by the way. I think like you always should be concerned about file sizes
10:02I know that 2k or or 7k is not a big deal
10:05But if you're loading up tween max and you're adding all the all the capabilities that have it could go up to 40
10:12I'm not sure exactly them out, but you're talking about like four or five hundred times bigger
10:16If you're loading everything up when you don't need it now 40k might not seem like a lot
10:21But if you have a server and your server has let's say 10,000 users
10:25And all those 10,000 users a day are downloading an extra 40k that they don't need to
10:31Then you're creating a lag on your server aka you're creating or slower experience for your users
10:37Or you're creating a bigger cost for your server. It might not be that important to
10:42The speed of the user one-to-one with your server, but your server has to send that communications
10:46So the smaller your files are it's always better
10:49You always want to go for the least that you could and and exactly Pablo nano is mainly for banners
10:55You know like unless you know for sure that you're creating a really really simple application
11:00And you're only going to be using a fade a fade in or something really simple that you probably go for the nano
11:05But in general nano solves the problem of banners and and really I personally prefer
11:10Just always using the tween light unless you have to use the tween max because the tween max will
11:15Automatically load up a lot of stuff that you might not actually need
11:19Okay, so next question
11:23See I think I think that I think that answered that question right David perfect
11:34Awesome, so let's start animating. Let's get our feet wet. Yeah, they're coming. They overlap each other in many ways
11:40But these are really important questions because when you're I'm a big believer in you know
11:44If you could slice your project in 10 20 K then do it obviously if it doesn't make you work more
11:50so it's really just fine that that you know that compromise between keeping your files small and
11:55Saving you a lot of time and this step. This is what this library does and does it really well
11:59So if you work with your tween light and timeline light then you're automatically saving a lot
12:04You know I don't think there's a big difference between 2k and maybe 6k
12:08But there's a big difference between tween light and tween max
12:12So but in general I would say if you're more comfortable in the coding
12:15I would say just learn how to how to activate plugins. It's not a big deal. Let's just get started
12:21You'll see how and how easy it is once we get started

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!