2013-06-06 12:02:54 +08:00
|
|
|
/****************************************************************************
|
2014-01-07 11:47:11 +08:00
|
|
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __CCTWEENFUNCTION_H__
|
|
|
|
#define __CCTWEENFUNCTION_H__
|
|
|
|
|
2014-02-17 11:45:37 +08:00
|
|
|
#include "CCPlatformMacros.h"
|
2013-06-06 12:02:54 +08:00
|
|
|
#include <math.h>
|
|
|
|
|
2014-02-17 11:45:37 +08:00
|
|
|
NS_CC_BEGIN
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-11-05 11:57:20 +08:00
|
|
|
enum TweenType
|
2013-09-13 18:07:37 +08:00
|
|
|
{
|
2013-12-13 15:02:09 +08:00
|
|
|
CUSTOM_EASING = -1,
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-06-06 12:02:54 +08:00
|
|
|
Linear,
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-06-06 12:02:54 +08:00
|
|
|
Sine_EaseIn,
|
|
|
|
Sine_EaseOut,
|
2013-11-05 11:57:20 +08:00
|
|
|
Sine_EaseInOut,
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
|
2013-06-06 12:02:54 +08:00
|
|
|
Quad_EaseIn,
|
|
|
|
Quad_EaseOut,
|
|
|
|
Quad_EaseInOut,
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-06-06 12:02:54 +08:00
|
|
|
Cubic_EaseIn,
|
|
|
|
Cubic_EaseOut,
|
|
|
|
Cubic_EaseInOut,
|
|
|
|
|
|
|
|
Quart_EaseIn,
|
|
|
|
Quart_EaseOut,
|
|
|
|
Quart_EaseInOut,
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-06-06 12:02:54 +08:00
|
|
|
Quint_EaseIn,
|
|
|
|
Quint_EaseOut,
|
|
|
|
Quint_EaseInOut,
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-06-06 12:02:54 +08:00
|
|
|
Expo_EaseIn,
|
|
|
|
Expo_EaseOut,
|
|
|
|
Expo_EaseInOut,
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-06-06 12:02:54 +08:00
|
|
|
Circ_EaseIn,
|
|
|
|
Circ_EaseOut,
|
|
|
|
Circ_EaseInOut,
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-06-06 12:02:54 +08:00
|
|
|
Elastic_EaseIn,
|
|
|
|
Elastic_EaseOut,
|
|
|
|
Elastic_EaseInOut,
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-06-06 12:02:54 +08:00
|
|
|
Back_EaseIn,
|
|
|
|
Back_EaseOut,
|
|
|
|
Back_EaseInOut,
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-06-06 12:02:54 +08:00
|
|
|
Bounce_EaseIn,
|
|
|
|
Bounce_EaseOut,
|
|
|
|
Bounce_EaseInOut,
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-06-06 12:02:54 +08:00
|
|
|
TWEEN_EASING_MAX = 10000
|
|
|
|
};
|
2013-11-20 12:04:47 +08:00
|
|
|
/**
|
2013-12-13 15:02:09 +08:00
|
|
|
* @js NA
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2013-09-15 19:08:45 +08:00
|
|
|
class TweenFunction
|
2013-09-13 18:07:37 +08:00
|
|
|
{
|
2013-06-06 12:02:54 +08:00
|
|
|
public:
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float tweenTo(float time, TweenType type, float *easingParam);
|
|
|
|
|
|
|
|
static float linear(float time);
|
2014-02-17 11:45:37 +08:00
|
|
|
|
|
|
|
//tween functions for CCActionEase
|
|
|
|
static float easeIn(float time);
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float sineEaseIn(float time);
|
|
|
|
static float sineEaseOut(float time);
|
|
|
|
static float sineEaseInOut(float time);
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float quadEaseIn(float time);
|
|
|
|
static float quadEaseOut(float time);
|
|
|
|
static float quadEaseInOut(float time);
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float cubicEaseIn(float time);
|
|
|
|
static float cubicEaseOut(float time);
|
|
|
|
static float cubicEaseInOut(float time);
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float quartEaseIn(float time);
|
|
|
|
static float quartEaseOut(float time);
|
|
|
|
static float quartEaseInOut(float time);
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float quintEaseIn(float time);
|
|
|
|
static float quintEaseOut(float time);
|
|
|
|
static float quintEaseInOut(float time);
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float expoEaseIn(float time);
|
|
|
|
static float expoEaseOut(float time);
|
|
|
|
static float expoEaseInOut(float time);
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float circEaseIn(float time);
|
|
|
|
static float circEaseOut(float time);
|
|
|
|
static float circEaseInOut(float time);
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float elasticEaseIn(float time, float *easingParam);
|
|
|
|
static float elasticEaseOut(float time, float *easingParam);
|
|
|
|
static float elasticEaseInOut(float time, float *easingParam);
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float backEaseIn(float time);
|
|
|
|
static float backEaseOut(float time);
|
|
|
|
static float backEaseInOut(float time);
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float bounceEaseIn(float time);
|
|
|
|
static float bounceEaseOut(float time);
|
|
|
|
static float bounceEaseInOut(float time);
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2013-12-13 15:02:09 +08:00
|
|
|
static float customEase(float time, float *easingParam);
|
2013-06-06 12:02:54 +08:00
|
|
|
};
|
|
|
|
|
2013-09-13 18:07:37 +08:00
|
|
|
|
2014-02-17 11:45:37 +08:00
|
|
|
NS_CC_END
|
2013-06-06 12:02:54 +08:00
|
|
|
|
|
|
|
#endif /*__CCTWEENFUNCTION_H__*/
|