Exemple #1
0
EaseBezierAction* EaseBezierAction::create(cocos2d::ActionInterval* action)
{
    EaseBezierAction *ret = new (std::nothrow) EaseBezierAction();
    if (ret && ret->initWithAction(action))
    {
        ret->autorelease();
        return ret;
    }

    delete ret;
    return nullptr;
}
EaseBezierAction* EaseBezierAction::create(cocos2d::ActionInterval* action)
{
	EaseBezierAction *ret = new (std::nothrow) EaseBezierAction();
	if (ret)
	{  
		if (ret->initWithAction(action))
		{
			ret->autorelease();
		}
		else
		{
			CC_SAFE_RELEASE_NULL(ret);
		}
	}

	return ret; 
}
EaseBezierAction* EaseBezierAction::reverse() const
{
	EaseBezierAction* reverseAction = EaseBezierAction::create(_inner->reverse());
	reverseAction->setBezierParamer(_p3,_p2,_p1,_p0);
	return reverseAction;
}
ActionInterval* ActionFrame::getEasingAction(ActionInterval* action)
{
	if (action == nullptr)
	{
		return nullptr;
	}

	switch (_easingType)
	{
	case FrameEaseType::Custom:
		{
			EaseBezierAction* cAction = EaseBezierAction::create(action);
			cAction->setBezierParamer(_Parameter[0],_Parameter[1],_Parameter[2],_Parameter[3]);
			return cAction;
		}
		break;
	case FrameEaseType::LINERAR:
		return action;
		break;
	case FrameEaseType::SINE_EASEIN:
		return EaseSineIn::create(action);
		break;
	case FrameEaseType::SINE_EASEOUT:
		return EaseSineOut::create(action);
		break;
	case FrameEaseType::SINE_EASEINOUT:
		return EaseSineInOut::create(action);
		break;
	case FrameEaseType::QUAD_EASEIN:
		return EaseQuadraticActionIn::create(action);
		break;
	case FrameEaseType::QUAD_EASEOUT:
		return EaseQuadraticActionOut::create(action);
		break;
	case FrameEaseType::QUAD_EASEINOUT:
		return EaseQuadraticActionInOut::create(action);
		break;
	case FrameEaseType::CUBIC_EASEIN:
		return EaseCubicActionIn::create(action);
		break;
	case FrameEaseType::CUBIC_EASEOUT:
		return EaseCubicActionOut::create(action);
		break;
	case FrameEaseType::CUBIC_EASEINOUT:
		return EaseCubicActionInOut::create(action);
		break;
	case FrameEaseType::QUART_EASEIN:
		return EaseQuarticActionIn::create(action);
		break;
	case FrameEaseType::QUART_EASEOUT:
		return EaseQuadraticActionOut::create(action);
		break;
	case FrameEaseType::QUART_EASEINOUT:
		return EaseQuarticActionInOut::create(action);
		break;
	case FrameEaseType::QUINT_EASEIN:
		return EaseQuinticActionIn::create(action);
		break;
	case FrameEaseType::QUINT_EASEOUT:
		return EaseQuinticActionOut::create(action);
		break;
	case FrameEaseType::QUINT_EASEINOUT:
		return EaseQuinticActionInOut::create(action);
		break;
	case FrameEaseType::EXPO_EASEIN:
		return EaseExponentialIn::create(action);
		break;
	case FrameEaseType::EXPO_EASEOUT:
		return EaseExponentialOut::create(action);
		break;
	case FrameEaseType::EXPO_EASEINOUT:
		return EaseExponentialInOut::create(action);
		break;
	case FrameEaseType::CIRC_EASEIN:
		return EaseCircleActionIn::create(action);
		break;
	case FrameEaseType::CIRC_EASEOUT:
		return EaseCircleActionOut::create(action);
		break;
	case FrameEaseType::CIRC_EASEINOUT:
		return EaseCircleActionInOut::create(action);
		break;
	case FrameEaseType::ELASTIC_EASEIN:
		{
			return EaseElasticIn::create(action);
		}
		break;
	case FrameEaseType::ELASTIC_EASEOUT:
		{
			return EaseElasticOut::create(action);
		}
		break;
	case FrameEaseType::ELASTIC_EASEINOUT:
		{
			return EaseElasticInOut::create(action);
		}
		break;
	case FrameEaseType::BACK_EASEIN:
		return EaseBackIn::create(action);
		break;
	case FrameEaseType::BACK_EASEOUT:
		return EaseBackOut::create(action);
		break;
	case FrameEaseType::BACK_EASEINOUT:
		return EaseBackInOut::create(action);
		break;
	case FrameEaseType::BOUNCE_EASEIN:
		return EaseBounceIn::create(action);
		break;
	case FrameEaseType::BOUNCE_EASEOUT:
		return EaseBounceOut::create(action);
		break;
	case FrameEaseType::BOUNCE_EASEINOUT:
		return EaseBounceInOut::create(action);
		break;
	default:
		return action;
		break;
	}
}