Utility

Utility

Gamify 라이브러리 제작에 필요한 각종 함수들을 모아놓은 클래스

Constructor

new Utility()

Source:

Methods

arrangePixiZOrder(pixi)

PIXI의 zOrder를 통해 정렬

static 함수

Parameters:
Name Type Description
pixi PIXI PIXI 오브젝트
Source:

findAngleBetweenTwoPoints(p1, p2) → {object}

두 지점 사이의 각도를 구함

static 함수

Parameters:
Name Type Description
p1 object 1번 지점
p2 number 2번 지점
Source:

findDistanceBetweenTwoPoints(p1, p2) → {object}

두 지점 사이의 거리를 구함

static 함수

Parameters:
Name Type Description
p1 object 1번 지점
p2 number 2번 지점
Source:

findNewPointByAngleWithDistance(point, angle, distance) → {object}

한 지점에서 각도와 거리를 통해 새로운 지점을 구함

static 함수

Parameters:
Name Type Description
point object 시작지점
angle number 각도
distance number 거리
Source:

gcd(a, b) → {number}

최대공약수를 구해줌

static 함수

Parameters:
Name Type Description
a number 최대공약수를 구할 수 1
b number 최대공약수를 구할 수 2
Source:

hex2string(hex) → {string}

0x000000 형태의 hex값을 '0x000000'의 문자열로 변경시켜줌

static 함수

Parameters:
Name Type Description
hex number hex 값
Source:

increaseBrightness(hex, percent) → {string}

지정된 색상에서 지정된 % 만큼 밝은 값을 구함

static 함수

Parameters:
Name Type Description
hex number 색상 값
percent number %
Source:

loadScript(src) → {Promise}

javascript 상에서 다른 script를 로드시켜줌

static 함수

Parameters:
Name Type Description
src string 로드할 script 주소
Source:

makePixi(option, pointerEvents) → {PIXI}

PIXI object 자동 생성

static 함수

Parameters:
Name Type Description
option object Gamify에서 생성한 option 화면의 최대사이즈 때문에 필요
pointerEvents boolean pointerEvents의 유무
Source:

rgb2hex(rgb) → {number}

[r,g,b] 형태의 rgb값을 hex값으로 변경시켜줌

static 함수

Parameters:
Name Type Description
rgb array [r,g,b]
Source: