Added ratio specs
@@ -2,4 +2,378 @@
|
||||
|
||||
Class used to perform calculation with a ratio.
|
||||
|
||||
TO BE DONE!!!!
|
||||
## Example
|
||||
|
||||
```javascript
|
||||
//Create test ratio
|
||||
var ratio = api.GameLib.Timing.toRatio(0.25);
|
||||
|
||||
var culatedX = ratio.invert().easeInSine().toAbsolute(1920);
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
### bezier
|
||||
|
||||
Calculate the ratio with the bezier curve easing function.
|
||||
|
||||
```javascript
|
||||
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](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### invert
|
||||
|
||||
Invert the ratio.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.invert();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### steps
|
||||
|
||||
Calculate the ratio with the steps easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.steps(steps);
|
||||
```
|
||||
|
||||
| Argument | Type | Description |
|
||||
| -------- | ------ | -------------------- |
|
||||
| steps | number | The number of steps. |
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### toAbsolute
|
||||
|
||||
Calculate the ratio of an absolute value.
|
||||
|
||||
```javascript
|
||||
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.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.toPercentage();
|
||||
```
|
||||
|
||||
**Return** number _Calculated percentage_
|
||||
|
||||
### easeInSine
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInSine();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInCubic
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInCubic();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInQuint
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInQuint();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInCirc
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInCirc();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInElastic
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInElastic();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeOutSine
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeOutSine();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeOutCubic
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeOutCubic();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeOutQuint
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeOutQuint();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeOutCirc
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeOutCirc();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeOutElastic
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeOutElastic();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInOutSine
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInOutSine();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInOutCubic
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInOutCubic();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInOutQuint
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInOutQuint();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInOutCirc
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInOutCirc();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInOutElastic
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInOutElastic();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInQuad
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInQuad();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInQuart
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInQuart();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInExpo
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInExpo();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInBack
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInBack();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInBounce
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInBounce();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeOutQuad
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeOutQuad();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeOutQuart
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeOutQuart();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeOutExpo
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeOutExpo();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeOutBack
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeOutBack();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeOutBounce
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeOutBounce();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInOutQuad
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInOutQuad();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInOutQuart
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInOutQuart();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInOutExpo
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInOutExpo();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInOutBack
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInOutBack();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
### easeInOutBounce
|
||||
|
||||
Calculate the ratio with the easing function.
|
||||
|
||||
```javascript
|
||||
ratio = ratio.easeInOutBounce();
|
||||
```
|
||||
|
||||
**Return** [Ratio](./ModuleAPIGameLibRatio) Ratio instance.\_
|
||||
|
||||
Reference in New Issue
Block a user