How to create Interactive Animations?
As animation online is all about interactivity we will dedicate a few moments to talk about how to create interactive animations and see live how we can get that done.
Video Transcript
00:01My throat is done.
00:08On update is called in fixed intervals.
00:10Yeah, it's called every time that between library
00:14is just about to render the stage.
00:17So once everything is ready, and it's ready to update.
00:19Now, you can't build on it as if it's
00:21like a clockwork that's going to be
00:23on the same speed all the time, because that
00:25depends on your processor.
00:27So it's not going to be always 0.02 seconds,
00:30or always the speed of, if our animations are
00:33running at 24 frames a second, that
00:35doesn't not mean that it's going to be called 24 times a second.
00:38That means it's going to try to call it 24 times a second.
00:41And it really just depends on your processor.
00:43So it's going to run on a mobile phone and on whatever.
00:45So to your answer, yes, it's going
00:47to be in a constant interval.
00:50But no, you can't depend on it like it's a Swiss watch.
00:57Let's see if there's any other questions here.
01:11No, the order does not matter at all.
01:13By the way, that's a wonderful question.
01:15And in general, by the way, that's a question
01:19that David was asking.
01:20David was asking that.
01:22In general, objects are not indexed by numbers.
01:28And if they're not indexed by numbers,
01:31that means order does not matter at all.
01:35But when you're creating an array,
01:36contrary to that, order always matters.
01:38But when you're creating an object,
01:40there is no such thing as order in objects,
01:42because it really doesn't matter when you type it.
01:46You're assuming that it doesn't have any order.
01:48So for that matter, it doesn't matter at all.
01:52You just do whatever order makes sense to you.
01:55And that's all you have to worry about.
02:01Cool.
02:01So that was the last question.
02:02Let me see if I can say anything else before we wrap things
02:05up here, because we're getting close to the end of our hour.
02:09Again, there's one thing that we haven't done at all.
02:12So I want to do it really, really quickly.
02:14I want to show you interactiveness,
02:16although we're not going to do a lot of interactiveness now
02:18because we're running out of time.
02:19So I'm just going to create a really quick click event.
02:22So I'm just going to create your own mouse,
02:24and it'll just show you that you can stop an animation even
02:26while it's going.
02:27So I'm going to create a quick mouse event.
02:29I'm going to go to MC logo.
02:31I'm going to add event listener.
02:41Guys, we're going to create an on logo click.
02:51And we're going to have we're creating our event.
02:54We're creating our handler.
02:56And it's time for us to trigger our stop for our event.
02:59But unfortunately for us, again, it's not really unfortunate.
03:02We can just go to text tween.
03:05And we could just stop.
03:08We could just, let me see what we do with that.
03:12Oh, we just kill it.
03:14Yeah.
03:17And once we send the kill command, that's it.
03:18We stopped it.
03:20It's done.
03:21It's not going to continue.
03:22So if I go to my logo and click on it
03:24before the copy is done, it'll just kill it.
03:27Done.
03:28Complete.
03:29Now, by the way, well, no, by the way, that's it.
03:32So that's it for that.
03:34Let me see if there's any questions.
03:37Hopefully, this gave you a taste for more.
03:39And you're kind of ready to start playing around
03:41with animations and tween.
03:42And just play around with that to and from a lot.
03:46Yeah, go for your questions.
