1
00:00:00,330 --> 00:00:04,330
Come back again this isn't going to talk about spring animation.

2
00:00:04,380 --> 00:00:10,320
And to be honest this spring image is not something that you use it every day but it's kind of useful

3
00:00:10,320 --> 00:00:15,780
from time to time so I decided that show it to you in this lesson really quickly so you get a sense

4
00:00:15,780 --> 00:00:17,180
of how it is done.

5
00:00:17,250 --> 00:00:24,780
So this going into school I'm going to start a new project called Spring animation and for my spring

6
00:00:24,780 --> 00:00:31,020
animation I'm going to have a target that a box or a ball is going to try to reach you.

7
00:00:31,020 --> 00:00:37,470
So to do that I want to go to my storyboard in the storyboard I'm going to have a white view that I'm

8
00:00:37,470 --> 00:00:42,730
going to play some like in here and that's the one that we're going to animate so I'm going to say 64

9
00:00:42,740 --> 00:00:44,120
by 64.

10
00:00:44,130 --> 00:00:47,300
It has a red back on something like that.

11
00:00:47,460 --> 00:00:50,360
And then I'm going to have a label on that label.

12
00:00:50,410 --> 00:00:52,390
I'm going to place it somewhere here.

13
00:00:52,620 --> 00:00:57,760
I'm only going to show a cross on it as if this is the place we're trying to reach to.

14
00:00:57,800 --> 00:01:01,780
Not that sign this sign something like that.

15
00:01:01,820 --> 00:01:07,860
And of course I need an animation but then I'm going to add a button say this one that is going to run

16
00:01:07,860 --> 00:01:09,400
the animation for us.

17
00:01:09,480 --> 00:01:16,800
So I'm going to go ahead and say This one is animate and the animate has a background color such as

18
00:01:16,800 --> 00:01:20,580
that one and that's all the stuff that we need for the storyboard.

19
00:01:20,730 --> 00:01:24,020
So I want to go to the assistant editor in the assistant window.

20
00:01:24,270 --> 00:01:30,390
I'm going to go ahead and say this is the animate function animate action.

21
00:01:30,410 --> 00:01:33,780
It is an action connected.

22
00:01:33,780 --> 00:01:37,410
This is obviously the red box as usual.

23
00:01:37,870 --> 00:01:45,210
And this little fellow in here is going to be let's call it Center label is the one that shows us the

24
00:01:45,210 --> 00:01:48,920
center we are trying to reach to essentially.

25
00:01:48,960 --> 00:01:53,440
So I'm going to go back to my view control and clear things up.

26
00:01:53,480 --> 00:01:57,160
And when I have a bit there I think I don't mean you.

27
00:01:57,240 --> 00:01:58,740
I want to get rid of it.

28
00:01:58,770 --> 00:02:03,210
I only need this one function that has to actually do something for me.

29
00:02:03,390 --> 00:02:12,090
So let's go in here and say when we call the animation action do this say you why do you not animate.

30
00:02:12,180 --> 00:02:17,490
And what I'm looking for is the one that has a spring built into it and you can just go through these

31
00:02:17,490 --> 00:02:22,330
and look down in here and it will show you what are the different options in that one.

32
00:02:22,330 --> 00:02:27,690
And as they go through this one is the one that corresponds to the motion of a physical spring and that's

33
00:02:27,690 --> 00:02:28,790
the one that they want to use.

34
00:02:28,800 --> 00:02:34,390
So I'm going to say this is like all the different arguments so I can see them easier.

35
00:02:34,790 --> 00:02:40,750
And in you year I'm going to go ahead and say let's get rid of the ration of maybe five seconds and

36
00:02:40,810 --> 00:02:43,160
I'm going to give it no delay at the beginning.

37
00:02:43,190 --> 00:02:50,500
I'm going to say the animation damping or that's the screen damping how it decays and how it dies.

38
00:02:50,700 --> 00:02:57,860
When I say it I'd say 20 to five and then I'm going to say give it an initial velocity of maybe three.

39
00:02:58,200 --> 00:03:00,490
And then I will have more options.

40
00:03:00,660 --> 00:03:04,110
And in the animation I will have only one thing.

41
00:03:04,200 --> 00:03:12,220
So I'm going to say self not red box start center becomes center labeled Dart Center and that means

42
00:03:12,220 --> 00:03:15,200
the self as well because we are within the closure.

43
00:03:15,430 --> 00:03:18,600
I don't want to have anything on the completion just now.

44
00:03:18,780 --> 00:03:22,380
So that's all we have to do for a spring animation.

45
00:03:22,470 --> 00:03:29,480
He's going to try to DK The animation attenuate the animation with a rate of point to five.

46
00:03:29,530 --> 00:03:34,200
Let's see how it shows up when we actually run it on the on the simulator.

47
00:03:34,200 --> 00:03:39,500
You can play on the numbers like I said it's something interesting to know.

48
00:03:39,510 --> 00:03:42,600
Pi is not something you would be using it every day.

49
00:03:42,660 --> 00:03:47,710
So that's like a down animation they joys off as it tries to reach there.

50
00:03:47,800 --> 00:03:50,560
Just increase the initial velocity to ten.

51
00:03:50,700 --> 00:03:55,710
So they give it a quick you know try to see how they actually affect the animation.

52
00:03:55,770 --> 00:04:03,340
And now if they run it again we see that it has a stronger beginning and then it DKs with the same rate.

53
00:04:03,390 --> 00:04:10,860
And if I increase the decay to say point eight or a larger number with a larger damping I expect it

54
00:04:10,860 --> 00:04:13,140
to die off faster.

55
00:04:13,260 --> 00:04:15,720
So it goes and comes and that's it.

56
00:04:15,720 --> 00:04:22,520
So a larger damping cause is less of a bounciness essentially Iran this spring.

57
00:04:22,740 --> 00:04:25,090
So that's a very simple one.

58
00:04:25,110 --> 00:04:27,430
Keep it in mind in case one day you need it.

59
00:04:27,570 --> 00:04:32,510
We have another physics engine that we will be talking about it that is the dynamics.

60
00:04:32,520 --> 00:04:38,560
We also have another much more advanced physics engine which is the sprite kit and the scene kit.

61
00:04:38,710 --> 00:04:45,000
Both of these have come in quite a few sections from now and I'll see you in the next lesson as well

62
00:04:45,000 --> 00:04:45,960
as those.
