2 * Copyright 2008, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Alexandre Deckner <alex@zappotek.com>
9 // Some math utils, useful for animation
12 #include "MathUtils.h"
18 MathUtils::EaseInOutCubic(float time
, float start
, float distance
,
21 time
/= duration
/ 2.0;
23 return distance
/ 2.0 * time
* time
* time
+ start
;
25 return distance
/ 2.0 * (time
* time
* time
+ 2.0) + start
;
30 MathUtils::EaseInOutQuart(float time
, float start
, float distance
,
36 return distance
/ 2 * time
* time
* time
* time
+ start
;
40 return -distance
/ 2 * (time
* time
* time
* time
- 2) + start
;
45 MathUtils::EaseInOutQuint(float time
, float start
, float distance
,
50 return distance
/ 2 * time
* time
* time
* time
* time
+ start
;
52 return distance
/ 2 *(time
* time
* time
* time
* time
+ 2) + start
;
57 MathUtils::EaseInOutSine(float time
, float start
, float distance
,
60 return -distance
/ 2 * (cos(3.14159 * time
/ distance
) - 1) + start
;