To start, I will explain how to scale a sprite (magnify and decrease). First, we need to know what parameters the definition has.

`#define AFFINEANIMCMD_FRAME(_xScale, _yScale, _rotation, _duration)`
The X and Y scale, the rotation, and the duration.

We have to know that as higher "_xScale" and "_yScale", more fast will scale our sprite, This is not the size that will be scaled. If we use a positive value as "16", the scale will be a magnify, if we use a negative one, as "-32", the scale will be of reduction.

We have to know that the value of scale, and the duration are strictly linked, and I've bothered to take out the formula.

First, I will shorten the variables to make the formula more comfortable (although it is very simple).

```d = _duration
x = _xScale
k```
d will be the value of _duration, x will be the value of _xScale (or _yScale, is the same), and finally, k will be the scale which we will give to the sprite. For example, if we want the sprite to be twice as large, k = 2. if we want the sprite to be 2/3 of the original, k = 2/3 (although I do not recommend this value much, the scale will not be too homogeneous)

Once we know that, let's see the formula (that you can clear to know the value that most interests you, or you can give values directly to know the duration)

LOOK OUT!.- If the result of the formula gives you a value with decimals, I recommend that you choose to use other values that give a similar visual result, but not decimals, since the floats will not be processed. You can play with the scale speed.

LOOK OUT! (2).- I will use the formula that you will see below, because I will work with a sprite that by default, is loaded with a size of 1x1 pixel, and there is a certain variation in the formula so that it can be scaled to its natural size, specifically the one below. But if you load the sprite directly with its original size, you have to use the previous one. Once you have applied this formula to scale it to its original size, you can apply the previous formula.

Right, now, before use AFFINEANIM, we have to know that we must use this before every new AffineAnimCmd function (at least to me without this, it does not work):

`AFFINEANIMCMD_FRAME(_xScale, _yScale, 0, 0),`
And later, We write the transformation we want to do.

For example, let's say that we have made the sprite load with dimensions of 1x1, and what we want to do is increase its size to the original, well we want that k = 1, a speed in x and y of about 16 (by default), so, let's calculate the necessary duration:

d = (240/16)*1 = 15

Right, so, now that we have all the parameters, let's write the necessary affineanims.

```static const union AffineAnimCmd gSpriteAffineAnim_85B1EA0[] =
{
AFFINEANIMCMD_FRAME(16, 16, 0, 0),
AFFINEANIMCMD_FRAME(16, 16, 0, 15),
AFFINEANIMCMD_END,
};```
And the result will be:

But Inmortal, you did not modify anything, that was already like that.
Okay, so, let's try to reduce it by half.

Now, we want that k = 1/2, and X and Y = 16, so...

d = (240/16) * 1/2 = 7.5

Oops... We obtained a result that we do not want, it have decimals, so... What we can do?

Easy, reduce the speed (_xScale and _yScale) by half, that is the needed to augment d, because they are inversely proportional

We have that k = 1/2 and x = 8...

d = (240/8) * 1/2 = 15

Nice! We have an integer value, Now, let's adapt parameters:

```static const union AffineAnimCmd gSpriteAffineAnim_85B1EA0[] =
{
AFFINEANIMCMD_FRAME(8, 8, 0, 0),
AFFINEANIMCMD_FRAME(8, 8, 0, 15),
AFFINEANIMCMD_END,
};```

Analogously to magnify it.

To rotate it, we have to know that a value of 4, is proportional to a 90º turn, and therefore, 16, is proportional to a complete turn.

Clarify that you will also use positive or negative values to choose the direction of rotation (positive, counter-clock wise, negative, clockwise)

Well, I will leave you a little sequence as an "exercise" so you can try to think what will happen:

```    AFFINEANIMCMD_FRAME(16, 16, 0, 0),
AFFINEANIMCMD_FRAME(16, 16, 0, 15),
AFFINEANIMCMD_FRAME(16, 16, 0, 16),
AFFINEANIMCMD_FRAME(-16, -16, -4, 16),
AFFINEANIMCMD_END,```
Spoiler:

And that is all, I think I have covered in a pretty decent way how animations work in pokeemerald.

Good luck, and comment any question :)