Hi guys we continue from the previous lecture and the lecture.
We added that we go for the rotation and we set it to to 150.
And we looked at the graph just over here.
We noticed we have a beautiful graph with certain maximum values on negative and positive.
If you haven't done so please add the wiggle here so we can continue our enemy.
Our aim in this lecture is to animate the knob over here.
You want the knob to wiggle with the needle.
The needle goes on the right for example.
Then up would come over here if it goes on the left somewhere.
Let's say over here.
The knob will go over here.
So actually the knob would be whittling ways the needle could undo this.
And here we are going to interpret the rotation to position you might be asking that we did already
an interpellation over here in this animation.
We interpolated the exposition into the rotation.
So we have taken the position zero which is X interpretated return it to the rotation and that was the
only single value we needed for the rotation to operate.
Well here it's a bit different.
You are going to interpolate the rotation into the x value.
That's true.
But then you need to return to values one for the x y for the Y.
You cannot keep any of them.
Both of them must be returned how to read the expression here could be a bit tricky.
And as soon as I show you you will notice that it's so easy.
So let's that our press Alt.
If you are on the Mac press option click on the stopwatch.
We are into the expression and of course I'm going to go up and bring the linear interpolation put it
over to what is the T is the value that we want to interpret.
In this case.
It's going to be the rotation.
So I will use the big sweep to pick the rotation.
OK.
Now what is D.M..
What we know from the graph that we can discover what is Dimino let's go have a look for the rotation
here.
This is of course we are in the value graph guys.
Now if you're not this scrap through you'll see that the minimum here are the minimum value here is
minus 84 and the maximum value is a plus 67.
This is for me maybe when you are working you might have different values.
It doesn't have to be identical values to my.
So we said minus 85 or minus 84 and you know minus 60 to maybe we take minus 85 and 85.
That will be called.
So the T.M. man will be I will delete the minimum minus 85 and the maximum is going to be Plus 85.
You can put the minimum and the maximum which any value you want to find in your graph.
And if you are more precise the animation will look a bit better.
Value what is the value of the knob on the team here.
So I will select the knob and go to the beginning.
This is where I want the minimum to be and that is 246.
I'll put it at 250.
I'll put a 250 value to is the value of the knob on the x axis just over here.
OK.
Which is around one thousand sixty two.
They say 1000 it will work nicely here 1000.
Now you might say OK it's done.
Actually it's not done because here you are returning a single value just the interpellation into the
position which requires two values x and y.
You need to work on the expression here to return the two values we are going to start using variables.
The first valuable I'm going to call it X because of the exposition is equal to the linear interpolation.
Now I need to add another value within the expression which is for the y axis.
So let's go ahead we say y equal.
And actually I'm going to pick up.
If you do Equipe then you can choose the position up and down of the up.
If you do not pick up then you put a rigid value like 1000 5000 whatever you like.
Then later on you won't be able to change it.
You have to go back to the expression itself.
So now it's time to return these values.
You are going to return unary which is made of two values to return unary.
Use the square brackets.
You open the square bracket you say return x so X will go to the X not because it's called X.
But the first one will go to the position 0 and the second value will go to position 1 and you close
the bracket.
What that looks neat but it's not done yet in javascript.
You need to end the line with a semicolon.
This is for the interpreter to read this line and knows where the line end and then interprets it.
That's how it works.
So the semicolon will help identifying the end of line over here.
Also you need to put semicolons.
This is the end of line and then x y you don't need to put a semicolon here because there is nothing
after and obviously is the end of the line.
This click outside.
There's a press space bar in play here you are it's working at 100 percent.
So this lecture was about how to use variables x and y and how to return and area with two values as
simple as this.
So now you know how to interpret it between a single value to an area with two values.
Thank you very much for listening.
I hope you will use the techniques I showed you here and create some fantastic positions.
I will see you in the next lectures.