[MUSIC].
Today we're going to talk a bit more about moving things around in graphics.
So in the first week we talked about how to draw stuff and there we could position
objects and then like rectangles, by giving the pixel positions.And for
example the white command and the ellipse command.
And, and that's fine, we can do that. And last week we talked about doing
animation, but animation with image sequences where we're playing lots of
different images all in the same position.
Today I'm going to talk about more powerful ways of moving objects around
beyond what you can do simply by putting positions into the x y coordinates to say
say, a rectangle. These techniques accord transforms, and
there are three of them. The first transform is translate, which
is a basic movement. Not too different from what you could do
by putting an X-Y position into, the position of a rectangle, so.
And that is a command for translate and you pass in an x and a y which is the
position you're moving whatever object too and it's a separate command to
whatever command drawing you're doing this.
So you can apply single translate to multiple objects.
And group objects together and move them around and I'll talk a little bit more in
detail about how you do that. And the basic premise to translate an x
and a y which gives you the position for which you'll translate.
So very similar to what we've done before.
The second one is a scale that's getting things bigger and smaller and that just
basically takes a number That is how much of scaling apply.
If that number's one you're not scaling it at all.
If it's less than one it's getting smaller.
If it's more than one it's getting bigger.
One quite useful thing about scale is you can also give it two parameters which
means you can scale separately about the x and the y.
So, you can make something wider While making it sort of the same time, having
high x scale and a small y scale. So the rotate command is used to spin
objects around. And it takes an angle as its parameter.
So that's how much you want to spin it by.
the normal way we talk about angles is in degrees 0, 360 degrees.
But in computer programming we often work with another way of dealing with angles
called radians. Now the units we shall explain in a
minute and you have to pass in that value and radiance through a take command.
If you don't want to get involved in radians, there's a very simple command
radians, that takes an angle in degrees and converts it to radians.
So I can just put radians 90 degrees, and it will do it all for me.
But if you want to know what radians are, this is it.
So radians work in terms of a circle. And we can think of an angle as cutting
out a chunk of a circle. So, like a, a, a slice of the pie.
now, if we make the circle of radius one. So, each of these two straight edges is
linked one. Then we can measure the angle by taking
the length of the arc, along the way just to be certain, so that's how much of the
edge of the circle is being cut out by my angle.
And that is a perfectly good measure of, of, of angles, and that's what's called
radians. A few things you need to know.
it's useful to know particular angles in radians, if you ever use them.