Utilities
- DialogButtonsArg
- FileInfoType
- InternationalizationConfig
- ManifestData
- PreloadData
- PreloadEvent
- SeparatedTime
- UnitDescription
- UpdateElement
- UpdateFormat
- boxBoxCollision
- calculateAngle
- calculateDistance
- circleCircleCollision
- circlePointCollision
- createEnum
- deepClone
- getObject
- getRandomFloat
- getRandomInt
- getSeveralRandomInts
- isArray
- isBoolean
- isFunction
- isInteger
- isNumber
- isString
- numberOfDigits
- pointBoxCollision
- range
- round
- saveObject
- shuffle
- timeToString
- toDegrees
- toRadians
Ƭ DialogButtonsArg: DialogButtons
| HTMLElement
[]
Ƭ FileInfoType: keyof typeof FileInfo
Ƭ InternationalizationConfig: Object
Name | Type |
---|---|
day |
UnitDescription |
hour |
UnitDescription |
minute |
UnitDescription |
second |
UnitDescription |
time_to_string/time_to_string.ts:16
Ƭ ManifestData: { id
: string
; path
: string
; type?
: FileInfoType
}[]
Ƭ PreloadData: Object
▪ [id: string
]: any
Ƭ PreloadEvent: "complete"
| "error"
| "abort"
| "progress"
| "fileload"
Ƭ SeparatedTime: Object
Name | Type |
---|---|
days |
number |
hours |
number |
minutes |
number |
seconds |
number |
time_to_string/time_to_string.ts:4
Ƭ UnitDescription: Object
Name | Type |
---|---|
plural |
string |
single |
string |
time_to_string/time_to_string.ts:11
Ƭ UpdateElement: Object
Name | Type |
---|---|
element |
HTMLElement |
format? |
UpdateFormat |
Ƭ UpdateFormat: Omit
<TimeToStringArgs
, "time"
> | (timer
: Timer
) => string
▸ boxBoxCollision(oneX
, oneY
, oneWidth
, oneHeight
, twoX
, twoY
, twoWidth
, twoHeight
): boolean
Detects collision between 2 boxes.
Name | Type |
---|---|
oneX |
number |
oneY |
number |
oneWidth |
number |
oneHeight |
number |
twoX |
number |
twoY |
number |
twoWidth |
number |
twoHeight |
number |
boolean
collision_detection/collision_detection.ts:4
▸ calculateAngle(aX
, aY
, bX
, bY
): number
Returns the angle between 2 points in radians. Positive in clockwise direction.
Name | Type |
---|---|
aX |
number |
aY |
number |
bX |
number |
bY |
number |
number
trigonometry/trigonometry.ts:5
▸ calculateDistance(aX
, aY
, bX
, bY
): number
Distance between 2 points.
Name | Type |
---|---|
aX |
number |
aY |
number |
bX |
number |
bY |
number |
number
trigonometry/trigonometry.ts:17
▸ circleCircleCollision(x1
, y1
, radius1
, x2
, y2
, radius2
): boolean
Detects collision between two circles.
Name | Type |
---|---|
x1 |
number |
y1 |
number |
radius1 |
number |
x2 |
number |
y2 |
number |
radius2 |
number |
boolean
collision_detection/collision_detection.ts:25
▸ circlePointCollision(circleX
, circleY
, circleRadius
, pointX
, pointY
): boolean
Detects collision between a circle and a point.
Name | Type |
---|---|
circleX |
number |
circleY |
number |
circleRadius |
number |
pointX |
number |
pointY |
number |
boolean
collision_detection/collision_detection.ts:49
▸ createEnum(values
, start?
): Object
Enum - A way to associate a string name to a number.
Name | Type | Description |
---|---|---|
values |
string [] |
The enum names. Each name will have an associated number. |
start? |
number |
Starting number for the first name. The number is incremented by one for the next name. |
Object
▸ deepClone(obj
): any
Returns a deep clone/copy of the object.
Name | Type |
---|---|
obj |
any |
any
▸ getObject(key
): any
Returns an object that was obtained by parsing (with json) some data that was saved on localStorage
.
Name | Type |
---|---|
key |
string |
any
local_storage/local_storage.ts:4
▸ getRandomFloat(min
, max
): number
Returns a random float number between min
and max
(inclusive).
Name | Type |
---|---|
min |
number |
max |
number |
number
▸ getRandomInt(min
, max
): number
Returns a random integer number between min
and max
(inclusive).
Name | Type |
---|---|
min |
number |
max |
number |
number
▸ getSeveralRandomInts(min
, max
, howMany
): number
[]
Returns several different random integers, in the range between min
and max
(inclusive).
Name | Type |
---|---|
min |
number |
max |
number |
howMany |
number |
number
[]
▸ isArray(element
): boolean
Name | Type |
---|---|
element |
any |
boolean
If it is an array or not.
▸ isBoolean(element
): element is boolean
Name | Type |
---|---|
element |
any |
element is boolean
If it is a boolean.
▸ isFunction(element
): element is Function
Name | Type |
---|---|
element |
any |
element is Function
If it is a function.
▸ isInteger(value
): value is number
Name | Type |
---|---|
value |
any |
value is number
If it is an integer.
▸ isNumber(element
): element is number
Name | Type |
---|---|
element |
any |
element is number
If it is a number.
▸ isString(element
): element is string
Name | Type |
---|---|
element |
any |
element is string
If it is a string.
▸ numberOfDigits(theNumber
): number
Returns the number of digits in a number. It doesn't consider the minus signal, nor the dot (in floats) as a digit.
Name | Type |
---|---|
theNumber |
number |
number
▸ pointBoxCollision(pointX
, pointY
, boxX
, boxY
, boxWidth
, boxHeight
): boolean
Detects collision between a point and a box.
Name | Type |
---|---|
pointX |
number |
pointY |
number |
boxX |
number |
boxY |
number |
boxWidth |
number |
boxHeight |
number |
boolean
collision_detection/collision_detection.ts:72
▸ range(start
, end
): number
[]
Create an array with all the numbers in-between the 'start' and 'end' (inclusive).
Name | Type |
---|---|
start |
number |
end |
number |
number
[]
▸ round(num
, dec
): number
Rounds a number to a specified decimal case.
Name | Type |
---|---|
num |
number |
dec |
number |
number
▸ saveObject(key
, value
): void
Saves in the localStorage
a json string representation of the value
.
Name | Type |
---|---|
key |
string |
value |
any |
void
local_storage/local_storage.ts:13
▸ shuffle(array
): any
[]
Shuffle an array.
Name | Type |
---|---|
array |
any [] |
any
[]
▸ timeToString(args
): string
Converts a time (in milliseconds) to a string (with the number of days/hours...). The units available are: day/hour/minute/second.
There's 4 possible display formats.
-
daytime:
dd hh:mm:ss
orhh:mm:ss
(where d=day, h=hour, m=minute, s=second) -
partial_daytime:
ss
,mm:ss
,hh:mm:ss
or "dd hh:mm:ss", depending on the time value. -
string:
(d) days (h) hours (m) minutes (s) seconds
-
short_string:
(d)d (h)h (m)m (s)s
The number of units
can limit the number of units shown in the string/short_string formats (days/hours, or hours/minutes or minutes/seconds, and not days/hours/minutes for example (for a units
with value 2)).
The display string can be internationalized with the internationalization
argument (when using the string
or short_string
).
Defaults:
units: undefined (shows all non-zero if format is type string
or short_string
)
format: string
Name | Type |
---|---|
args |
TimeToStringArgs |
string
time_to_string/time_to_string.ts:75
▸ toDegrees(radians
): number
Converts a number in radians
to degrees
and returns it.
Name | Type |
---|---|
radians |
number |
number
trigonometry/trigonometry.ts:32
▸ toRadians(degrees
): number
Converts a number in degrees
to radians
and returns it.
Name | Type |
---|---|
degrees |
number |
number