当前位置: 首页>>代码示例>>C++>>正文


C++ Tween::play方法代码示例

本文整理汇总了C++中Tween::play方法的典型用法代码示例。如果您正苦于以下问题:C++ Tween::play方法的具体用法?C++ Tween::play怎么用?C++ Tween::play使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tween的用法示例。


在下文中一共展示了Tween::play方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Animation

Intro::Intro(){
#ifndef WIN32
	JNIUtil::jni_music_play("title.ogg");
#endif

	#ifdef FONT
	width1_=(m_pFontAtlas->GetFont(AHB_36)->GetWidth("TOUCH TO START"));
	#endif

	numframes=sizeof(intro_sequence)/sizeof(const unsigned int);

	loadTextures();

	loops=0;

	Animation* animation=new Animation();
	animation->currentFrame=0;
	animations.push_back(animation);	

	pos=Vector2D<float>(0,0);

	myTween.setup(120, 0.3f, -0.7f, Easing::SineEaseInOut,0,2);
	myTween.play();	
	//myTween2.setup(30, 0.5f, -0.5f, Easing::SineEaseInOut,0,2);
	//myTween2.play();	
}
开发者ID:valdirSalgueiro,项目名称:SGS,代码行数:26,代码来源:Intro.cpp

示例2: play

void ArmatureAnimation::play(const std::string& animationName, int durationTo,  int loop)
{
    if (animationName.empty())
    {
        CCLOG("_animationData can not be null");
        return;
    }
//    CCASSERT(_animationData, "_animationData can not be null");

    _movementData = _animationData->getMovement(animationName);
    if (nullptr == _movementData)
    {
        CCLOG("_movementData can not be null");
        return;
    }
//    CCASSERT(_movementData, "_movementData can not be null");

    //! Get key frame count
    _rawDuration = _movementData->duration;

    _movementID = animationName;

    _processScale = _speedScale * _movementData->scale;

    //! Further processing parameters
    durationTo = (durationTo == -1) ? _movementData->durationTo : durationTo;

    int durationTween = _movementData->durationTween == 0 ? _rawDuration : _movementData->durationTween;

    cocos2d::tweenfunc::TweenType tweenEasing = _movementData->tweenEasing;
    loop = (loop < 0) ? _movementData->loop : loop;

    _onMovementList = false;

    ProcessBase::play(durationTo, durationTween, loop, tweenEasing);


    if (_rawDuration == 0)
    {
        _loopType = SINGLE_FRAME;
    }
    else
    {
        if (loop)
        {
            _loopType = ANIMATION_TO_LOOP_FRONT;
        }
        else
        {
            _loopType = ANIMATION_NO_LOOP;
        }
        _durationTween = durationTween;
    }

    MovementBoneData *movementBoneData = nullptr;
    _tweenList.clear();

    const Map<std::string, Bone*>& map = _armature->getBoneDic();
    for(auto& element : map)
    {
        Bone *bone = element.second;
        movementBoneData = static_cast<MovementBoneData *>(_movementData->movBoneDataDic.at(bone->getName()));

        Tween *tween = bone->getTween();
        if(movementBoneData && movementBoneData->frameList.size() > 0)
        {
            _tweenList.push_back(tween);
            movementBoneData->duration = _movementData->duration;
            tween->play(movementBoneData, durationTo, durationTween, loop, tweenEasing);

            tween->setProcessScale(_processScale);

            if (bone->getChildArmature())
            {
                bone->getChildArmature()->getAnimation()->setSpeedScale(_processScale);
            }
        }
        else
        {
            if(!bone->isIgnoreMovementBoneData())
            {
                //! this bone is not include in this movement, so hide it
                bone->getDisplayManager()->changeDisplayWithIndex(-1, false);
                tween->stop();
            }

        }
    }

    _armature->update(0);
}
开发者ID:funseek,项目名称:TransitionExample,代码行数:91,代码来源:CCArmatureAnimation.cpp


注:本文中的Tween::play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。