Modifying animation eases
In volume 1, we were introduced to animation using the GSAP library. We learned how to create animations, control their time and duration and control the properties that we animate. In this lecture, we will learn how to customize and personalize animations through the use of eases.
Video Transcript
00:00Chapter two. So in chapter one we discovered and worked with the tween
00:05nano library and let me just delete it as I'm talking now we're going to move
00:09into tween light so by the way we I moved everything to chapter two now so
00:15that way you could go back and see in the source files chapter one without a
00:18problem and we're going to import the tween light package. Now chapter two is
00:24going to be dedicated to all the methods that are relevant both tween
00:28nano and tween light so once chapter two is done you will know all the methods of
00:33tween nano and of tween not of all of tween light and then chapter three will
00:38be dedicated for the remainder methods that are not available in tween nano
00:44alright so all the stuff that we're going to talk about now on tween light
00:47is going to be also relevant to tween nano if you're working in actions
00:52crypt alright so let me just set up and configure everything and what I really
00:57want to do is I just want to make my text field invisible so our text field
01:02here that's called T names I'm just going to make it visible false right so
01:09we're going to just start off with just having our logo should be in the center
01:12of the stage that's going to be our beginning point so the first thing I
01:16want to do is we're going to go back into that two method and we're going to
01:19explore and by the way we're talking about to or from both methods work the
01:25exact same way the only difference between them is what they're doing
01:28while the two starts from the place that um the place where we are and it's
01:36going to the place where we want to be well from is takes us from where we are
01:41well basically takes it from where we want to be or from where we want to start
01:45from to where we are all right so the from and the two did with that was
01:50confusing let me just say this again because I know what I'm saying but it
01:53doesn't sound like I do all right so the two oh god why is it so complicated the
01:58two basically enables me if I'm at position zero and I want to go to
02:02position a hundred versus the from is if I'm at position zero the from would
02:08say hey start the animation from position hundred and move to position
02:11zero okay so let's get started we're gonna focus on the two but we'll flip
02:15around between the two and the from as we're going along to make this
02:18crystal clear and by the way as a side note in chapter three we're gonna work
02:22with the from two which combines the two together but the logic is very very
02:27similar so it's gonna be a very easy function to review once we get there so
02:31let's get started very much the same way as we did with the tween nano the tween
02:36light will just call the to function directly as a static property we're gonna
02:40call the element that we want to animate once we were there we're gonna
02:45set the duration if we wanted to be in seconds or frames in our case for now
02:49we're gonna set it to be as in seconds it's gonna be one second and then we're
02:54gonna start setting the different properties and time for us to start
02:57reviewing the different properties that we didn't review earlier but let's do a
03:01quick recap of the ones that we saw we saw that we could edit we could
03:05basically play around with any of the numeric values of our element on the
03:12stage so if I wanted I could move my X to be at position 50 and I could move
03:17my Y to be at position 100 and I could change my alpha to be 0.6 let's say so
03:24it's gonna be 60% of its opacity and any other property that I wanted to do such
03:28as we saw as rotation or rotate and I think it was rotation yep rotation and
03:35we could set rotation to be minus 90 so I just run this for a second just to
03:39make sure that everything is working we should see a lot of different animations
03:43happening at the same time or a lot of different properties being animated at
03:46the same time and we could see that that was a very quick animation well there we
03:50go this one looks much better all right so it's animating to its position this is
03:55exactly what we hoped wanted it to do we also saw when we were quickly when we're
04:00working on the tween nano that we could add the property delay and a delay
04:05will enable us will enable us to delay the animation in a certain amount of
04:10time so if we're gonna delay it we let's give it a delay of a half a
04:13second so when the application begins only a half a second later then the
04:17animation would start so again we'll do that a half a second and then the
04:20animation would complete or start all right so that was the basic properties
04:27that we already saw earlier so let's continue on and see what other values so
04:33let's start with the ease which is the one that we haven't seen yet and one
04:38that we could use also with the tween nano and we're gonna stop saying that we
04:40could do it between nano because everything that we're gonna do in this
04:42chapter is gonna be relevant for tween nano as well so I'm just gonna say the
04:46word tween nano anymore because it's a hard word to say all right good so now
04:51the property ease enables me to create different custom eases so what I want
04:56to do is I want to import first the ease that I would want to work with so
04:59again I'm gonna find in my green sock package and you'll find there an ease
05:03folder or easing folder there you go and you could choose which ease you
05:07want so let's say we're gonna do the bounce ease and the ease itself we're
05:10gonna go for a bounce and we're gonna pick which one do we want do we want to
05:14ease in do we want to ease out or do we want to ease in and out if we choose
05:20the ease in function and by the way this is a function and you could create
05:23your own custom ease functions on your own as well just have to know
05:28how to create one of those babies so if I run this and we look at it we're
05:33gonna see that the ease itself this time starts in the beginning so we have
05:37this kind of like an ease going on in the beginning that's your ease in so it's
05:41as it's in there it's and then it's going out while the ease out happens on
05:46the end so it's the tail of the animation where the ease happens and we
05:51could see how it's bouncing there towards the end and if we wanted we
05:54could have had a bit ease in or out and by the way ease in and out you
05:58could find in most or if not all of the different easing packages and all you
06:03really have to do is just explore the different ones and find the ease that
06:06works for you the best so for example if we want to import the elastic then we
06:10could do an elastic instead of easing and do an ease in and out that is elastic
06:15so let's so we'll see that it's shaking there in the beginning it's shaking
06:19there in the end and obviously the longer duration of the animation the
06:22more time our ease would have to to be more realistic so it's one of those
06:28stuff that you want to play with and find that right configuration that feels
06:31right okay so you see within a three second animation it looks very cool it
06:36looks kind of like someone's shaking him which is kind of cool all right so
06:41that's about easing and I encourage you to stop the video right now and just go
06:46ahead and start playing around with eases in your ease no pun intended and in
06:52the next lesson we're going to continue on and explore more properties
06:56that are available beyond the delay and the ease that we are already familiar
07:01with
