Table of Contents
- ModuleApi - GameLib Ratio
- Example
- Methods
- bezier
- invert
- steps
- toAbsolute
- toPercentage
- easeInSine
- easeInCubic
- easeInQuint
- easeInCirc
- easeInElastic
- easeOutSine
- easeOutCubic
- easeOutQuint
- easeOutCirc
- easeOutElastic
- easeInOutSine
- easeInOutCubic
- easeInOutQuint
- easeInOutCirc
- easeInOutElastic
- easeInQuad
- easeInQuart
- easeInExpo
- easeInBack
- easeInBounce
- easeOutQuad
- easeOutQuart
- easeOutExpo
- easeOutBack
- easeOutBounce
- easeInOutQuad
- easeInOutQuart
- easeInOutExpo
- easeInOutBack
- easeInOutBounce
ModuleApi - GameLib Ratio
Class used to perform calculation with a ratio.
Example
//Create test ratio.
var ratio = api.GameLib.Timing.toRatio(0.25);
//Use it to calculate the x position through an easing.
var culatedX = ratio.invert().easeInSine().toAbsolute(1920);
Methods
bezier
Calculate the ratio with the bezier curve easing function.
ratio = ratio.bezier(x1, y1, x2, y2);
| Argument | Type | Description |
|---|---|---|
| x1 | number | The x coordinate of the first control point. |
| y1 | number | The y coordinate of the first control point. |
| x2 | number | The x coordinate of the second control point. |
| y2 | number | The y coordinate of the second control point. |
Return Ratio Ratio instance._
invert
Invert the ratio.
ratio = ratio.invert();
Return Ratio Ratio instance._
steps
Calculate the ratio with the steps easing function.
ratio = ratio.steps(steps);
| Argument | Type | Description |
|---|---|---|
| steps | number | The number of steps. |
Return Ratio Ratio instance._
toAbsolute
Calculate the ratio of an absolute value.
ratio = ratio.toAbsolute(total);
| Argument | Type | Description |
|---|---|---|
| total | number | The total possible value. |
Return number Calculated absolute number
toPercentage
Convert the ratio to a percentage.
ratio = ratio.toPercentage();
Return number Calculated percentage
easeInSine
Calculate the ratio with the easing function.
ratio = ratio.easeInSine();
Return Ratio Ratio instance._
easeInCubic
Calculate the ratio with the easing function.
ratio = ratio.easeInCubic();
Return Ratio Ratio instance._
easeInQuint
Calculate the ratio with the easing function.
ratio = ratio.easeInQuint();
Return Ratio Ratio instance._
easeInCirc
Calculate the ratio with the easing function.
ratio = ratio.easeInCirc();
Return Ratio Ratio instance._
easeInElastic
Calculate the ratio with the easing function.
ratio = ratio.easeInElastic();
Return Ratio Ratio instance._
easeOutSine
Calculate the ratio with the easing function.
ratio = ratio.easeOutSine();
Return Ratio Ratio instance._
easeOutCubic
Calculate the ratio with the easing function.
ratio = ratio.easeOutCubic();
Return Ratio Ratio instance._
easeOutQuint
Calculate the ratio with the easing function.
ratio = ratio.easeOutQuint();
Return Ratio Ratio instance._
easeOutCirc
Calculate the ratio with the easing function.
ratio = ratio.easeOutCirc();
Return Ratio Ratio instance._
easeOutElastic
Calculate the ratio with the easing function.
ratio = ratio.easeOutElastic();
Return Ratio Ratio instance._
easeInOutSine
Calculate the ratio with the easing function.
ratio = ratio.easeInOutSine();
Return Ratio Ratio instance._
easeInOutCubic
Calculate the ratio with the easing function.
ratio = ratio.easeInOutCubic();
Return Ratio Ratio instance._
easeInOutQuint
Calculate the ratio with the easing function.
ratio = ratio.easeInOutQuint();
Return Ratio Ratio instance._
easeInOutCirc
Calculate the ratio with the easing function.
ratio = ratio.easeInOutCirc();
Return Ratio Ratio instance._
easeInOutElastic
Calculate the ratio with the easing function.
ratio = ratio.easeInOutElastic();
Return Ratio Ratio instance._
easeInQuad
Calculate the ratio with the easing function.
ratio = ratio.easeInQuad();
Return Ratio Ratio instance._
easeInQuart
Calculate the ratio with the easing function.
ratio = ratio.easeInQuart();
Return Ratio Ratio instance._
easeInExpo
Calculate the ratio with the easing function.
ratio = ratio.easeInExpo();
Return Ratio Ratio instance._
easeInBack
Calculate the ratio with the easing function.
ratio = ratio.easeInBack();
Return Ratio Ratio instance._
easeInBounce
Calculate the ratio with the easing function.
ratio = ratio.easeInBounce();
Return Ratio Ratio instance._
easeOutQuad
Calculate the ratio with the easing function.
ratio = ratio.easeOutQuad();
Return Ratio Ratio instance._
easeOutQuart
Calculate the ratio with the easing function.
ratio = ratio.easeOutQuart();
Return Ratio Ratio instance._
easeOutExpo
Calculate the ratio with the easing function.
ratio = ratio.easeOutExpo();
Return Ratio Ratio instance._
easeOutBack
Calculate the ratio with the easing function.
ratio = ratio.easeOutBack();
Return Ratio Ratio instance._
easeOutBounce
Calculate the ratio with the easing function.
ratio = ratio.easeOutBounce();
Return Ratio Ratio instance._
easeInOutQuad
Calculate the ratio with the easing function.
ratio = ratio.easeInOutQuad();
Return Ratio Ratio instance._
easeInOutQuart
Calculate the ratio with the easing function.
ratio = ratio.easeInOutQuart();
Return Ratio Ratio instance._
easeInOutExpo
Calculate the ratio with the easing function.
ratio = ratio.easeInOutExpo();
Return Ratio Ratio instance._
easeInOutBack
Calculate the ratio with the easing function.
ratio = ratio.easeInOutBack();
Return Ratio Ratio instance._
easeInOutBounce
Calculate the ratio with the easing function.
ratio = ratio.easeInOutBounce();
Return Ratio Ratio instance._
Getting Started
Module Development
- Introduction
- V2 Module Structure
- V1 Module Structure
- Development environment/Building
- Module Config
- Module Debugging
- GetiyoModuleTool
- Bug/Feature Reporting
- Contact Details
ModuleServerAPI
ModuleServerAPI GameLib
ModuleClientAPI
ModuleApi Shared
© Vix Entertainment 2023 - © Mooren Productief 2023 - All rights reserved