Function
Static Public Summary | ||
public | Clamp a value between a minimum and a maximum | |
public | cloneObject(object: *): * | |
public | degToRad(val: float): * Converts degrees to radians | |
public | dist(x1: float, y1: float, x2: float, y2: float): * Calculates the distance between two 2D points | |
public | encode64(inputStr: *): * Method to convert a string to Base64. | |
public | error() | |
public | getElementPosition(el: Element): Object Get an element's position within the document taking into account the scroll positions | |
public | getFileExtension(url: *): * | |
public | getMimeType(url: String): String Extract the MimeType from the URL string of image files. | |
public | getUrlParameter(sParam: *): String function to get the parameters of the url | |
public | info() | |
public | intersectionPoint(line1: Array, line2: Array): {"x": *, "y": *} Intersection Point between 2 points | |
public | Simple object check. | |
public | lerp(value: float, dest: float, amount: float): * Lerps a value to the destination value with the given amount | |
public | log() | |
public | map(value: float, low1: float, high1: float, low2: float, high2: float): * Maps a number between 2 sets of float values | |
public | A function that return null as a value | |
public | pointIsInside(x: Number, y: Number, points: Vector2 Array): * Finds if a point is inside an array of vertices | |
public | radToDeg(val: float): * Converts radians to degrees | |
public | randomFromTo(from: float, to: float): * Generates a random number between 2 float values | |
public | stringToArrayBuffer(str: DOMString): ArrayBuffer Converts a DOMString to an ArrayBuffer (raw data binary). | |
public | Returns a throttled version of a function The returned function will only call the original function at most once per the specified threshhold | |
public | Generate a random uuid | |
public | warn() |
Static Public
public clamp(value: Number, min: Number, max: Number): * source
import {clamp} from '@mobilizing/library/js/Mobilizing/core/util/Math.js'
Clamp a value between a minimum and a maximum
Return:
* |
public cloneObject(object: *): * source
import {cloneObject} from '@mobilizing/library/js/Mobilizing/core/util/Misc.js'
Params:
Name | Type | Attribute | Description |
object | * |
Return:
* |
public degToRad(val: float): * source
import {degToRad} from '@mobilizing/library/js/Mobilizing/core/util/Math.js'
Converts degrees to radians
Params:
Name | Type | Attribute | Description |
val | float |
Return:
* |
public dist(x1: float, y1: float, x2: float, y2: float): * source
import {dist} from '@mobilizing/library/js/Mobilizing/core/util/Math.js'
Calculates the distance between two 2D points
Params:
Name | Type | Attribute | Description |
x1 | float | ||
y1 | float | ||
x2 | float | ||
y2 | float |
Return:
* |
public encode64(inputStr: *): * source
import {encode64} from '@mobilizing/library/js/Mobilizing/core/util/Misc.js'
Method to convert a string to Base64. Used internally to convert loaded raw data to img. Wrote by phil@philten.com - http://www.philten.com
Params:
Name | Type | Attribute | Description |
inputStr | * | the string to encode |
Return:
* |
public error() source
import {error} from '@mobilizing/library/js/Mobilizing/core/util/Debug.js'
public getElementPosition(el: Element): Object source
import {getElementPosition} from '@mobilizing/library/js/Mobilizing/core/util/Dom.js'
Get an element's position within the document taking into account the scroll positions
Params:
Name | Type | Attribute | Description |
el | Element | The DOM element |
Return:
Object | the position of the element as {x, y} |
public getFileExtension(url: *): * source
import {getFileExtension} from '@mobilizing/library/js/Mobilizing/core/util/Misc.js'
Params:
Name | Type | Attribute | Description |
url | * |
Return:
* |
public getMimeType(url: String): String source
import {getMimeType} from '@mobilizing/library/js/Mobilizing/core/util/Misc.js'
Extract the MimeType from the URL string of image files. Used internally for texture loading
Params:
Name | Type | Attribute | Description |
url | String |
Return:
String | mimeType from the url |
public getUrlParameter(sParam: *): String source
import {getUrlParameter} from '@mobilizing/library/js/Mobilizing/core/util/Misc.js'
function to get the parameters of the url
Params:
Name | Type | Attribute | Description |
sParam | * | the string of the parameter to get from the url |
Return:
String | the parameter if found, undefined elsewhere |
public info() source
import {info} from '@mobilizing/library/js/Mobilizing/core/util/Debug.js'
public intersectionPoint(line1: Array, line2: Array): {"x": *, "y": *} source
import {intersectionPoint} from '@mobilizing/library/js/Mobilizing/core/util/Math.js'
Intersection Point between 2 points
Return:
{"x": *, "y": *} |
public isObject(item: any): boolean source
import {isObject} from '@mobilizing/library/js/Mobilizing/core/util/Misc.js'
Simple object check.
Params:
Name | Type | Attribute | Description |
item | any | The item |
Return:
boolean | True if object, false otherwise. |
public lerp(value: float, dest: float, amount: float): * source
import {lerp} from '@mobilizing/library/js/Mobilizing/core/util/Math.js'
Lerps a value to the destination value with the given amount
Params:
Name | Type | Attribute | Description |
value | float | ||
dest | float | ||
amount | float |
Return:
* |
public log() source
import {log} from '@mobilizing/library/js/Mobilizing/core/util/Debug.js'
public map(value: float, low1: float, high1: float, low2: float, high2: float): * source
import {map} from '@mobilizing/library/js/Mobilizing/core/util/Math.js'
Maps a number between 2 sets of float values
Params:
Name | Type | Attribute | Description |
value | float | the value to map | |
low1 | float | the 1st origin value | |
high1 | float | the 2nd destination value | |
low2 | float | the 1st destination value | |
high2 | float |
Return:
* |
public noop(): null source
import {noop} from '@mobilizing/library/js/Mobilizing/core/util/Misc.js'
A function that return null as a value
Return:
null | null |
public pointIsInside(x: Number, y: Number, points: Vector2 Array): * source
import {pointIsInside} from '@mobilizing/library/js/Mobilizing/core/util/Math.js'
Finds if a point is inside an array of vertices
Return:
* |
public radToDeg(val: float): * source
import {radToDeg} from '@mobilizing/library/js/Mobilizing/core/util/Math.js'
Converts radians to degrees
Params:
Name | Type | Attribute | Description |
val | float |
Return:
* |
public randomFromTo(from: float, to: float): * source
import {randomFromTo} from '@mobilizing/library/js/Mobilizing/core/util/Math.js'
Generates a random number between 2 float values
Params:
Name | Type | Attribute | Description |
from | float | ||
to | float |
Return:
* |
public stringToArrayBuffer(str: DOMString): ArrayBuffer source
import {stringToArrayBuffer} from '@mobilizing/library/js/Mobilizing/core/util/Misc.js'
Converts a DOMString to an ArrayBuffer (raw data binary).
Params:
Name | Type | Attribute | Description |
str | DOMString | a string returned by a XMLHTTPRequest (responseText) |
Return:
ArrayBuffer | the resulting ArrayBuffer |
public throttle(fn: Function, threshhold: Number, scope: Object): Function source
import {throttle} from '@mobilizing/library/js/Mobilizing/core/util/Misc.js'
Returns a throttled version of a function The returned function will only call the original function at most once per the specified threshhold
Return:
Function | The throttled function |
public uuid(len: Integer, radix: Integer): String source
import {uuid} from '@mobilizing/library/js/Mobilizing/core/util/Misc.js'
Generate a random uuid
Params:
Name | Type | Attribute | Description |
len | Integer |
| The desired number of characters |
radix | Integer |
| The number of allowable values for each character |
Return:
String | The generated uuid |
Example:
let id = uuid();
// "66209871-857D-4A12-AC7E-E9EEBC2A6AC3"
let id = uuid(5);
// "kryIh"
let id = uuid(5, 2);
// "10100"
public warn() source
import {warn} from '@mobilizing/library/js/Mobilizing/core/util/Debug.js'