Review comments to be value-generic
This commit is contained in:
parent
5bcddca5e1
commit
80b3c4cd2b
1 changed files with 16 additions and 13 deletions
|
@ -9,21 +9,24 @@
|
||||||
* // This requires lots of memory on system.
|
* // This requires lots of memory on system.
|
||||||
* How to use:
|
* How to use:
|
||||||
* The four inputs t,b,c,d are defined as follows:
|
* The four inputs t,b,c,d are defined as follows:
|
||||||
* t = current time in milliseconds
|
* t = current time (in any unit measure, but same unit as duration)
|
||||||
* b = starting position in only one dimension [X || Y || Z] your choice
|
* b = starting value to interpolate
|
||||||
* c = the total change in value of b that needs to occur
|
* c = the total change in value of b that needs to occur
|
||||||
* d = total time it should take to complete
|
* d = total time it should take to complete (duration)
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* float speed = 1.f;
|
*
|
||||||
* float currentTime = 0.f;
|
* int currentTime = 0;
|
||||||
* float currentPos[2] = {0,0};
|
* int duration = 100;
|
||||||
* float finalPos[2] = {1,1};
|
* float startPositionX = 0.0f;
|
||||||
* float startPosition[2] = currentPos;//x,y positions
|
* float finalPositionX = 30.0f;
|
||||||
* while(currentPos[0] < finalPos[0])
|
* float currentPositionX = startPositionX;
|
||||||
* currentPos[0] = EaseSineIn(currentTime, startPosition[0], startPosition[0]-finalPos[0], speed);
|
*
|
||||||
* currentPos[1] = EaseSineIn(currentTime, startPosition[1], startPosition[1]-finalPos[0], speed);
|
* while (currentPositionX < finalPositionX)
|
||||||
* currentTime += diffTime();
|
* {
|
||||||
|
* currentPositionX = EaseSineIn(currentTime, startPositionX, finalPositionX - startPositionX, duration);
|
||||||
|
* currentTime++;
|
||||||
|
* }
|
||||||
*
|
*
|
||||||
* A port of Robert Penner's easing equations to C (http://robertpenner.com/easing/)
|
* A port of Robert Penner's easing equations to C (http://robertpenner.com/easing/)
|
||||||
*
|
*
|
||||||
|
@ -87,7 +90,7 @@
|
||||||
#define EASEDEF extern
|
#define EASEDEF extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h> // Required for: sin(), cos(), sqrt(), pow()
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" { // Prevents name mangling of functions
|
extern "C" { // Prevents name mangling of functions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue