Ejemplo n.º 1
0
float tweenTo(float time, TweenType type, float *easingParam)
{
    float delta = 0;

    switch (type)
    {
        case CUSTOM_EASING:
            delta = customEase(time, easingParam);
            break;
            
        case Linear:
            delta = linear(time);
            break;
            
        case Sine_EaseIn:
            delta = sineEaseIn(time);
            break;
        case Sine_EaseOut:
            delta = sineEaseOut(time);
            break;
        case Sine_EaseInOut:
            delta = sineEaseInOut(time);
            break;
            
        case Quad_EaseIn:
            delta = quadEaseIn(time);
            break;
        case Quad_EaseOut:
            delta = quadEaseOut(time);
            break;
        case Quad_EaseInOut:
            delta = quadEaseInOut(time);
            break;
            
        case Cubic_EaseIn:
            delta = cubicEaseIn(time);
            break;
        case Cubic_EaseOut:
            delta = cubicEaseOut(time);
            break;
        case Cubic_EaseInOut:
            delta = cubicEaseInOut(time);
            break;
            
        case Quart_EaseIn:
            delta = quartEaseIn(time);
            break;
        case Quart_EaseOut:
            delta = quartEaseOut(time);
            break;
        case Quart_EaseInOut:
            delta = quartEaseInOut(time);
            break;
            
        case Quint_EaseIn:
            delta = quintEaseIn(time);
            break;
        case Quint_EaseOut:
            delta = quintEaseOut(time);
            break;
        case Quint_EaseInOut:
            delta = quintEaseInOut(time);
            break;
            
        case Expo_EaseIn:
            delta = expoEaseIn(time);
            break;
        case Expo_EaseOut:
            delta = expoEaseOut(time);
            break;
        case Expo_EaseInOut:
            delta = expoEaseInOut(time);
            break;
            
        case Circ_EaseIn:
            delta = circEaseIn(time);
            break;
        case Circ_EaseOut:
            delta = circEaseOut(time);
            break;
        case Circ_EaseInOut:
            delta = circEaseInOut(time);
            break;
            
        case Elastic_EaseIn:
        {
            float period = 0.3f;
            if (nullptr != easingParam) {
                period = easingParam[0];
            }
            delta = elasticEaseIn(time, period);
        }
            break;
        case Elastic_EaseOut:
        {
            float period = 0.3f;
            if (nullptr != easingParam) {
                period = easingParam[0];
            }
            delta = elasticEaseOut(time, period);
        }
            break;
        case Elastic_EaseInOut:
        {
            float period = 0.3f;
            if (nullptr != easingParam) {
                period = easingParam[0];
            }
            delta = elasticEaseInOut(time, period);
        }
            break;
            
            
        case Back_EaseIn:
            delta = backEaseIn(time);
            break;
        case Back_EaseOut:
            delta = backEaseOut(time);
            break;
        case Back_EaseInOut:
            delta = backEaseInOut(time);
            break;
            
        case Bounce_EaseIn:
            delta = bounceEaseIn(time);
            break;
        case Bounce_EaseOut:
            delta = bounceEaseOut(time);
            break;
        case Bounce_EaseInOut:
            delta = bounceEaseInOut(time);
            break;
            
        default:
            delta = sineEaseInOut(time);
            break;
    }

    return delta;
}
Ejemplo n.º 2
0
NS_CC_EXT_BEGIN

float CCTweenFunction::tweenTo(float time, CCTweenType type, float *easingParam)
{
    float delta = 0;

    switch (type)
    {
    case CUSTOM_EASING:
        delta = customEase(time, easingParam);
        break;

    case Linear:
        delta = linear(time);
        break;

    case Sine_EaseIn:
        delta = sineEaseIn(time);
        break;
    case Sine_EaseOut:
        delta = sineEaseOut(time);
        break;
    case Sine_EaseInOut:
        delta = sineEaseInOut(time);
        break;

    case Quad_EaseIn:
        delta = quadEaseIn(time);
        break;
    case Quad_EaseOut:
        delta = quadEaseOut(time);
        break;
    case Quad_EaseInOut:
        delta = quadEaseInOut(time);
        break;

    case Cubic_EaseIn:
        delta = cubicEaseIn(time);
        break;
    case Cubic_EaseOut:
        delta = cubicEaseOut(time);
        break;
    case Cubic_EaseInOut:
        delta = cubicEaseInOut(time);
        break;

    case Quart_EaseIn:
        delta = quartEaseIn(time);
        break;
    case Quart_EaseOut:
        delta = quartEaseOut(time);
        break;
    case Quart_EaseInOut:
        delta = quartEaseInOut(time);
        break;

    case Quint_EaseIn:
        delta = quintEaseIn(time);
        break;
    case Quint_EaseOut:
        delta = quintEaseOut(time);
        break;
    case Quint_EaseInOut:
        delta = quintEaseInOut(time);
        break;

    case Expo_EaseIn:
        delta = expoEaseIn(time);
        break;
    case Expo_EaseOut:
        delta = expoEaseOut(time);
        break;
    case Expo_EaseInOut:
        delta = expoEaseInOut(time);
        break;

    case Circ_EaseIn:
        delta = circEaseIn(time);
        break;
    case Circ_EaseOut:
        delta = circEaseOut(time);
        break;
    case Circ_EaseInOut:
        delta = circEaseInOut(time);
        break;

    case Elastic_EaseIn:
        delta = elasticEaseIn(time, easingParam);
        break;
    case Elastic_EaseOut:
        delta = elasticEaseOut(time, easingParam);
        break;
    case Elastic_EaseInOut:
        delta = elasticEaseInOut(time, easingParam);
        break;


    case Back_EaseIn:
        delta = backEaseIn(time);
        break;
    case Back_EaseOut:
        delta = backEaseOut(time);
        break;
    case Back_EaseInOut:
        delta = backEaseInOut(time);
        break;

    case Bounce_EaseIn:
        delta = bounceEaseIn(time);
        break;
    case Bounce_EaseOut:
        delta = bounceEaseOut(time);
        break;
    case Bounce_EaseInOut:
        delta = bounceEaseInOut(time);
        break;

    default:
        delta = sineEaseInOut(time);
        break;
    }

    return delta;
}
Ejemplo n.º 3
0
float TweenFunction::tweenTo(float from, float change, float time, float duration, TweenType tweenType)
{
    float delta = 0;

    switch (tweenType)
    {
    case Linear:
        delta = linear(time, 0, 1, duration);
        break;

    case Sine_EaseIn:
        delta = sineEaseIn(time, 0, 1, duration);
        break;
    case Sine_EaseOut:
        delta = sineEaseOut(time, 0, 1, duration);
        break;
    case Sine_EaseInOut:
        delta = sineEaseInOut(time, 0, 1, duration);
        break;

    case Quad_EaseIn:
        delta = quadEaseIn(time, 0, 1, duration);
        break;
    case Quad_EaseOut:
        delta = quadEaseOut(time, 0, 1, duration);
        break;
    case Quad_EaseInOut:
        delta = quadEaseInOut(time, 0, 1, duration);
        break;

    case Cubic_EaseIn:
        delta = cubicEaseIn(time, 0, 1, duration);
        break;
    case Cubic_EaseOut:
        delta = cubicEaseOut(time, 0, 1, duration);
        break;
    case Cubic_EaseInOut:
        delta = cubicEaseInOut(time, 0, 1, duration);
        break;

    case Quart_EaseIn:
        delta = quartEaseIn(time, 0, 1, duration);
        break;
    case Quart_EaseOut:
        delta = quartEaseOut(time, 0, 1, duration);
        break;
    case Quart_EaseInOut:
        delta = quartEaseInOut(time, 0, 1, duration);
        break;

    case Quint_EaseIn:
        delta = quintEaseIn(time, 0, 1, duration);
        break;
    case Quint_EaseOut:
        delta = quintEaseOut(time, 0, 1, duration);
        break;
    case Quint_EaseInOut:
        delta = quintEaseInOut(time, 0, 1, duration);
        break;

    case Expo_EaseIn:
        delta = expoEaseIn(time, 0, 1, duration);
        break;
    case Expo_EaseOut:
        delta = expoEaseOut(time, 0, 1, duration);
        break;
    case Expo_EaseInOut:
        delta = expoEaseInOut(time, 0, 1, duration);
        break;

    case Circ_EaseIn:
        delta = circEaseIn(time, 0, 1, duration);
        break;
    case Circ_EaseOut:
        delta = circEaseOut(time, 0, 1, duration);
        break;
    case Circ_EaseInOut:
        delta = circEaseInOut(time, 0, 1, duration);
        break;

    case Elastic_EaseIn:
        delta = elasticEaseIn(time, 0, 1, duration);
        break;
    case Elastic_EaseOut:
        delta = elasticEaseOut(time, 0, 1, duration);
        break;
    case Elastic_EaseInOut:
        delta = elasticEaseInOut(time, 0, 1, duration);
        break;


    case Back_EaseIn:
        delta = backEaseIn(time, 0, 1, duration);
        break;
    case Back_EaseOut:
        delta = backEaseOut(time, 0, 1, duration);
        break;
    case Back_EaseInOut:
        delta = backEaseInOut(time, 0, 1, duration);
        break;

    case Bounce_EaseIn:
        delta = bounceEaseIn(time, 0, 1, duration);
        break;
    case Bounce_EaseOut:
        delta = bounceEaseOut(time, 0, 1, duration);
        break;
    case Bounce_EaseInOut:
        delta = bounceEaseInOut(time, 0, 1, duration);
        break;

    default:
        delta = sineEaseInOut(time, 0, 1, duration);
        break;
    }

    return delta;
}