1
00:00:00,870 --> 00:00:07,800
Time again we use animation blocks to block every piece of our animation inside of one block of code

2
00:00:07,890 --> 00:00:14,190
which gives us a lot of flexibility in controlling the animation as well as knowing when the animation

3
00:00:14,220 --> 00:00:15,170
ends.

4
00:00:15,170 --> 00:00:17,510
So let's go ahead and see that in ex-cult.

5
00:00:17,580 --> 00:00:22,500
I want to go ahead and start a new application called animation block

6
00:00:25,420 --> 00:00:29,980
and I have to make the same set of outlets again and I apologize for that.

7
00:00:29,980 --> 00:00:33,850
I know for a lot of you is repetitious but I just might be.

8
00:00:33,850 --> 00:00:39,400
I actually know there are users who would watch these lessons in all their eyes so they wouldn't really

9
00:00:39,400 --> 00:00:46,090
know where things are happening so that's why I have to kind of read these things every time.

10
00:00:46,090 --> 00:00:47,320
So that's that.

11
00:00:47,320 --> 00:00:50,360
I'll try my best to make it as fast as I can.

12
00:00:50,380 --> 00:00:52,130
You I view.

13
00:00:52,420 --> 00:00:57,760
Let's say this is going to be the read the one.

14
00:00:57,800 --> 00:01:00,900
So this is the read view.

15
00:01:00,950 --> 00:01:02,380
This one is the orange.

16
00:01:04,580 --> 00:01:08,360
Just like the last time and this time I'm going to use the assistant editor.

17
00:01:08,390 --> 00:01:12,020
So maybe this time it would happen a little bit faster.

18
00:01:12,040 --> 00:01:14,580
So red box.

19
00:01:14,770 --> 00:01:24,910
And then after the red box I have the orange box and then after those I will have my own innate function

20
00:01:25,350 --> 00:01:30,700
animate action and that's an action that's about it.

21
00:01:30,700 --> 00:01:39,580
So we have all of these now and when we go back to my shift file and here is how you build that animation

22
00:01:39,580 --> 00:01:41,610
block essentially.

23
00:01:41,620 --> 00:01:51,520
So let me get myself a little bit of formatting you I view dot animate duration of let's say two science

24
00:01:52,240 --> 00:01:59,680
and animations and a closure and the animation that I want to use is I want to have Redbox data center

25
00:02:00,160 --> 00:02:06,330
to become CGI point of the two values just like the last time.

26
00:02:06,490 --> 00:02:18,250
I'm going to say red box center should become red box Start center dot X and red marks dot center dot

27
00:02:18,260 --> 00:02:18,960
y.

28
00:02:18,970 --> 00:02:26,150
Plus let's say 300 Let's run this animation see what we get up until this point.

29
00:02:26,410 --> 00:02:28,440
We are a very important point.

30
00:02:28,450 --> 00:02:31,640
I totally forgot we are retaining a closure.

31
00:02:31,720 --> 00:02:34,200
So we have to use the self in here.

32
00:02:34,390 --> 00:02:40,870
So it says using a red box with closure you need to make it make sense for it.

33
00:02:40,870 --> 00:02:45,620
So self self self.

34
00:02:45,710 --> 00:02:48,220
So then let's go ahead and run it.

35
00:02:51,380 --> 00:02:57,110
And now if I press the animate but then my red box essentially does that animation.

36
00:02:57,140 --> 00:02:59,530
So that's the basic animation block.

37
00:02:59,540 --> 00:03:04,360
Let's go ahead and then other animation block which does things a little differently.

38
00:03:04,490 --> 00:03:13,010
I'm going to say you got animate and this time I'm going to use the animate Vitt duration as well as

39
00:03:13,010 --> 00:03:14,480
completion.

40
00:03:14,480 --> 00:03:16,830
So this is very soon of the previous one.

41
00:03:16,850 --> 00:03:21,680
It gets a time let's say two cycads it has an animation set.

42
00:03:21,740 --> 00:03:25,230
We want to do something and it has a completion set.

43
00:03:25,400 --> 00:03:27,760
So here's how we're going to use that.

44
00:03:27,770 --> 00:03:34,410
And when I actually get myself a little better for my gear so they can see things easier and Mikol the

45
00:03:34,430 --> 00:03:37,380
result result for instance.

46
00:03:37,790 --> 00:03:42,990
And I want to push all of these a little bit further around there.

47
00:03:44,470 --> 00:03:50,420
This format thing usually it's quite important so that you know how things are happening essentially.

48
00:03:53,080 --> 00:03:55,600
So this first part is obviously our animation block.

49
00:03:55,600 --> 00:04:02,440
Let's say you want to have orange box dot Alfar to become a point too.

50
00:04:02,470 --> 00:04:05,330
So you want to become almost transparent.

51
00:04:05,600 --> 00:04:08,820
And I have to mention self again I forgot.

52
00:04:08,820 --> 00:04:12,870
So self that orange box that Althorp becomes 0.2.

53
00:04:13,060 --> 00:04:19,270
And then in the closure of the compilation I want to know when the animation ended.

54
00:04:19,270 --> 00:04:24,940
So when the animation ends in the two seconds are gone I wanted to print that for me.

55
00:04:24,970 --> 00:04:30,150
I went to see Prince animation is done.

56
00:04:31,210 --> 00:04:34,380
And let's run this application.

57
00:04:34,400 --> 00:04:42,700
So this time when I press and now we got that little text saying animation is done this changed he said

58
00:04:42,710 --> 00:04:44,890
it'll be so it makes more sense.

59
00:04:44,890 --> 00:04:45,460
Right.

60
00:04:45,460 --> 00:04:53,980
So I'm going to say when the animation runs when the orange box Alfar changes to point to when it is

61
00:04:53,980 --> 00:04:54,700
done.

62
00:04:54,910 --> 00:04:58,640
Let's run this or that animation and then cut that out.

63
00:04:58,670 --> 00:05:03,560
Place it here and I don't see the first animation block anymore.

64
00:05:03,850 --> 00:05:11,590
So my new animation does this in two seconds runs our animation of making that orange box out for becoming

65
00:05:11,620 --> 00:05:13,310
somehow transparent.

66
00:05:13,390 --> 00:05:18,270
Once it is done it makes the red box push down.

67
00:05:18,310 --> 00:05:25,180
So let's enjoy the game now the way will work right now is when I press the animate button it's going

68
00:05:25,180 --> 00:05:30,100
to make the Orange Box almost disappear within two seconds.

69
00:05:30,400 --> 00:05:35,770
And then in a split second the red box is going to jump down.

70
00:05:35,770 --> 00:05:41,560
There's the red box is not going to animate itself simply because we really didn't call for another

71
00:05:41,680 --> 00:05:42,940
animation here.

72
00:05:43,120 --> 00:05:46,350
Let's see animate disappears.

73
00:05:46,870 --> 00:05:48,240
It jumps down there.

74
00:05:48,280 --> 00:05:52,880
Now if you wanted the red box to also animate we had to have another animation block.

75
00:05:52,900 --> 00:05:54,630
So let's go ahead and do that.

76
00:05:54,640 --> 00:05:57,770
Let me reformat everything as much as I can.

77
00:05:57,940 --> 00:05:59,700
So I have more space.

78
00:05:59,830 --> 00:06:03,190
So this is the animation block maybe I make it like that.

79
00:06:03,190 --> 00:06:05,460
So it's a bit easier to see.

80
00:06:05,890 --> 00:06:08,060
Even though it really isn't.

81
00:06:08,080 --> 00:06:16,420
Now here in the completion block I'm going to save you my view that animate without a completion this

82
00:06:16,420 --> 00:06:17,240
time.

83
00:06:17,430 --> 00:06:24,160
And the animation this time is let's say three seconds and the animation I want to see is this the red

84
00:06:24,160 --> 00:06:26,550
box doing something.

85
00:06:26,890 --> 00:06:28,960
Let me reformat everything again.

86
00:06:28,990 --> 00:06:31,170
It becomes a little bit of a messy code.

87
00:06:31,180 --> 00:06:33,960
I'm not really happy with that myself if you ask me.

88
00:06:34,180 --> 00:06:36,800
But unfortunately it is how it is.

89
00:06:36,850 --> 00:06:39,220
You could manually try to move things.

90
00:06:39,220 --> 00:06:45,580
You could actually try to push things back like this and like that which is something I usually do but

91
00:06:45,630 --> 00:06:49,850
I keep an eye on you know where things are actually happening.

92
00:06:49,850 --> 00:06:56,450
The auto format itself makes it something like that which is not the most expert artery situation.

93
00:06:56,710 --> 00:07:04,920
So if I run it now this time for every person that I made the orange box disappears then the red box

94
00:07:04,920 --> 00:07:10,760
moves let's see orange box disappearance and then the red one moves through.

95
00:07:11,070 --> 00:07:16,620
And that's a basic introduction on how to use animation blocks.

96
00:07:16,620 --> 00:07:23,880
There are multiple different ways of using animation blocks most notable ones or with animation as well

97
00:07:23,970 --> 00:07:28,310
as a completion block which helps you know when the animation ended.

98
00:07:28,500 --> 00:07:32,170
And on that basis you can decide something else.

99
00:07:32,250 --> 00:07:34,700
So just keep it up to here and move on to our next.
