scaleX, scaleY
A very simple animation (to simple - but it's just to show how it works so forgive me for how simple it is). How about you make something better and we can update the promo.
Video Transcript
00:00We have only one item left here one problem left
00:03Which is not really a problem and our last item was we said that we wanted to take our visuals to come from a blob
00:09To come from far away and slowly slowly get closer to the screen
00:13To do that we have to figure out a way where first of all, where will we put that logic?
00:17I kind of decided in advance that I want my main app to be empty
00:21but if I wanted to we could have created some sort of a
00:25Dispatchment event every time the time changed and listen in our app and work externally with our app making our timeout display more
00:32Flexible because not every timeout display is going to animate backwards, right?
00:37so
00:39The reason why I'm not doing it is just because I want to save time if I do expose it then I have to start exposing
00:44Different type of variables because I know I'm building out a little banner and this banner is only going to be used for one
00:50Thing if ever create another timeout display
00:52I'm probably going to create a new one or I could take the one I have and modify it
00:56So I'm going to keep that functionality of zooming from out further away in words inside of my timeout display
01:02But I do recommend as a way for you to practice and work with events and working with objects and getting used to working with
01:07Different classes why not do that yourself and try to figure out how to add that logic in your app
01:14So the next step that I want to do is first of all
01:16I want to do two things
01:17One is I want to save the time that I'm actually
01:20Initializing with because I want to know what was the beginning time and the time that was left to do that
01:24I'm going to create another private variable
01:27And I'm going to call it total time and don't worry about these color hints, you know
01:36A lot of these colors are just basically telling us that there are functions in flash or properties in flash that have the same
01:42Names, it doesn't mean that they're reserved names. It just means that these names exist to other classes
01:48It's kind of confusing and I wish there was a better way of flash is just not doing these color hints whenever we don't want them
01:54And doing them maybe only when they're related directly to a specific but in our scenario, we're just going to ignore them
02:00We're going to grab our total time
02:02And as soon as we initialize our application as soon as we know how many seconds our application will have when it starts up
02:08I'm going to set it up and put it in my total time
02:11The next thing I need to do is figure out a way to get a percentage where it will tell me between
02:180 to 1 of how much progress did we make in our time changed to do that?
02:24I'm just going to do a little trace first to try to figure that out
02:27So first of all, we know that we have our total time and we know we're going to divide it by our total time
02:31But we also created earlier a function. It was called get total which was the first function we created
02:38Get total seconds
02:41Get total seconds is going to return the amount of seconds left in total now
02:46We also want to take our total time, which is our original time
02:49Now if we take this value and we divide it just face
02:54Value and just divide it and see it we're going to get from 1 and it's going to slowly
02:58Not that slowly because we only have 3 seconds
03:00So if we go back here and add a little bit more time so we could have a bigger horizon
03:07whoop 60 times 60 times
03:1124 times 5 days
03:14All right, so we have a really really long amount of time and if we run our application one more time
03:19We're going to get our one and then the smaller value and it's slowly slowly slowly going to get smaller and smaller
03:24Which is exactly the opposite effect of what we actually want our application to do
03:29Now we have only one problem. We never want our message to be so far away that we can't see it
03:35We don't want it to ever be zero. So we actually want to start our sizing by in around 25
03:41Let's say 25% so to do that. I'm going to take my scale X and my scale Y
03:47I'm going to first set it to 0.25
03:49No matter what and then I want to add a value that could be max of dot 75, right?
03:55Because that's the maximum value that could be between our values only I want to take this value that's coming back. I
04:02Want to take the exact opposite of that value? So I'm going to grab that value and just take the value of 1 minus
04:09that value
04:10so what I'm doing here is I'm making sure that I'm actually starting from 0 instead of from 1 and
04:15duplicating it by 0.75 making sure that the max that it could be would be
04:2175 and that's a dot 75 plus 25 which will be 1
04:25now all I really have to do in this scenario to make sure that it's done because this our timer is not going to
04:31Be called that last last second and we want to make sure that it's going to reach exactly
04:35100% and to do that I'm going to send my x scale and y scale to 1 when our animation is complete when our
04:40Timer is complete as well
04:43Now if we want our application now, we should be getting that effect that we want and we don't need this trace anymore
04:47I could delete that and if we want our application one more time. Our application is going to start 25% away
04:54so it's going to be 25% of its
04:57Intended size and as time goes by it's going to get closer now because we have five days
05:01It's going to take a really long time for it to come closer, but that's kind of cool
05:04So if you leave it on your application and you go away for three hours and you come back
05:08It's going to look a little bit closer
05:10But because we're setting it up based on the time that we start up that application basically every time you come in
05:17Baby every time you refresh the screen every time you come to our site
05:21It's going to the animation is going to be quicker because it's always always going to be dependent on how much time it has
05:27From the beginning to the end
05:28So for example if you come in only when there's 24 out when there's 24 hours left and it's not five days
05:34The animation movement is going to be so much bigger
05:37still not very noticeable and
05:40Later on when you come in our site, and there's only one hour left until we're going to go live with this course
05:45Our animation is going to be even quicker
05:47Which is still not very noticeable because there's a lot of frames going on here, right?
05:51And as our as we get even closer, and there's only five minutes, and you come into our site
05:56And there's let's say only 400 seconds left and
06:00In these 400 seconds the animation is going to start getting a little bit more noticeable
06:06So you could see right here that it's growing just a bit
06:09And just to make it really really sharp if you just come in 30 seconds before our site is going to go live before the
06:15Course is going to go live. It's really going to make these big leaps
06:19Which most likely are most users will never really see because most chances are that you're going to come into the site
06:25Quite a while before the application goes live, so it's not going to look very engaging and that's fine. It was this is
06:32Was our purpose
