-
Notifications
You must be signed in to change notification settings - Fork 6
/
types.ts
101 lines (95 loc) · 1.61 KB
/
types.ts
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { SharedValue } from "react-native-reanimated";
type ShapeVariant = "Circle" | "Paddle" | "Brick";
export interface ShapeInterface {
id: number;
/**
* `x` position of the shape on the canvas
*/
x: SharedValue<number>;
/**
* `y` position of the shape on the canvas
*/
y: SharedValue<number>;
/**
* The mass of the shape
*/
m: number;
/**
* The acceleration of x
*/
ax: number;
/**
* The acceleration of y
*/
ay: number;
/**
* The velocity of x
*/
vx: number;
/**
* The velocity of y
*/
vy: number;
/**
* Type
*/
type: ShapeVariant;
}
export interface CircleInterface extends ShapeInterface {
type: "Circle";
/**
* The radius of the shape
*/
r: number;
}
export interface PaddleInterface extends ShapeInterface {
type: "Paddle";
/**
* The height of the shape
*/
height: number;
/**
* The width of the shape
*/
width: number;
}
export interface BrickInterface extends ShapeInterface {
type: "Brick";
/**
* The height of the shape
*/
height: number;
/**
* The width of the shape
*/
width: number;
/**
* State that determindes whether a ball can collide with a brick
*/
canCollide: SharedValue<boolean>;
}
/**
* Object representing the collision between two objects
*/
export interface Collision {
/**
* The first shape
*/
o1: ShapeInterface;
/**
* The second shape
*/
o2: ShapeInterface;
/**
* Distance between the two x values
*/
dx: number;
/**
* Distance betweeb the two y values
*/
dy: number;
/**
* Total distance
*/
d: number;
}