blob: 7ac52f9f07c52eae549cf8d4138fa2e54707bed8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include "AnimationMove.h"
#include <math.h>
ARGB
AM_Linear(const Animation* anim, PixelRendererParams a) {
struct AM_Linear ml = *(struct AM_Linear*)a.priv;
a.row = (a.row - ml.startRow - (i32)(a.frame.current * ml.dRow));
a.col = (a.col - ml.startCol - (i32)(a.frame.current * ml.dCol));
if (ml.wrapCoordinates == true) {
a.row %= anim->width;
a.col %= anim->height;
}
a.priv = ml.priv;
return ml.callback(anim, a);
}
ARGB
AM_Spin(const Animation* anim, PixelRendererParams a) {
struct AM_Spin ms = *(struct AM_Spin*)a.priv;
double radius = sqrt(a.row * a.row + a.col * a.col);
double phi = atan2(a.col, a.row);
phi += ms.theta + ms.dTheta * a.frame.current;
a.row = (ms.centerRow + (i32)(radius * cos(phi)));
a.col = (ms.centerCol + (i32)(radius * sin(phi)));
a.priv = ms.priv;
return ms.callback(anim, a);
}
|