• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Tween类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: loadTextures

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: ofAddListener

///--------------------------------------------------------------
void Scene2::updateEnter()
{
    leaveSceneTimer.reset();
    leaveSceneTimer.setup(SettingsManager::getInstance().sceneIdleTimeToArtists * 1000);
    ofAddListener(leaveSceneTimer.TIMER_COMPLETE , this, &Scene2::leaveSceneTimerCompleteHandler);
    leaveSceneTimer.start(false);

    currentClipIndex = (artistIndex * artistOffset) + (artistOffset/2) + SettingsManager::getInstance().abletonFirstClipIndex;

    ofAddListener(TUIOHandler::getInstance().eventTouchDown, this, &Scene2::tuioPressed);
    ofAddListener(TUIOHandler::getInstance().eventTouchUp, this, &Scene2::tuioReleased);
    ofAddListener(TUIOHandler::getInstance().eventTouchDrag, this, &Scene2::tuioDragged);

    ofAddListener(TUIOHandler::getInstance().eventTouchDownCursor, this, &Scene2::tuioReceiverPressed);
    ofAddListener(TUIOHandler::getInstance().eventTouchUpCursor, this, &Scene2::tuioReceiverReleased);
    ofAddListener(TUIOHandler::getInstance().eventTouchDragCursor, this, &Scene2::tuioReceiverDragged);

    // Request tempo in order to set it on objects
    ofAddListener(AbletonManager::getInstance().eventTempoChanged, this, &Scene2::tempoChanged);
    AbletonManager::getInstance().requestTempo();
    AbletonManager::getInstance().requestVolumeUpdates();
    AbletonManager::getInstance().requestGridUpdates();

    switch(backgroundMode)
    {
        case SceneBgModeVideo:
        {
            videoPlayer.play();
            break;
        }
        case SceneBgModeImages:
        {
            float delay = 0.0f;
            float duration = 8.0f;
            float minScale = 1.0f;
            float maxScale = 1.02f;
            Tweenzor::add(&bgImageScale, minScale, maxScale, delay, duration, EASE_IN_OUT_SINE);
            Tween *tweenScale = Tweenzor::getTween(&bgImageScale);
            tweenScale->setRepeat(-1, true);
            float minAlpha = 255.0f;
            float maxAlpha = 0.0f;
            duration *= 0.7f;
            Tweenzor::add(&bgImageAlpha, minAlpha, maxAlpha, delay, duration, EASE_IN_OUT_SINE);
            Tween *tweenAlpha = Tweenzor::getTween(&bgImageAlpha);
            tweenAlpha->setRepeat(-1, true);

            break;
        }
        case SceneBgModeNone:
        default:
            break;
    }

    for (unsigned int i=0; i< numObjects; ++i)
        objects[i]->setup();

    AbletonManager::getInstance().playScene(currentClipIndex);

    BaseScene::updateEnter();
}
开发者ID:miquelsoler,项目名称:ConductrEnter,代码行数:61,代码来源:Scene2.cpp


示例3: new

Tween *Tween::create(Bone *bone)
{
    Tween *pTween = new (std::nothrow) Tween();
    if (pTween && pTween->init(bone))
    {
        pTween->autorelease();
        return pTween;
    }
    CC_SAFE_DELETE(pTween);
    return nullptr;

}
开发者ID:bonlai,项目名称:3kaigame,代码行数:12,代码来源:CCTween.cpp


示例4: Update

void TweenManager::Update() {
	Tween *tween;
	for(int i=0;i<tweens.size();i++) {
		if(tweens[i]->isComplete()) {
			if(tweens[i]->repeat) {
				tweens[i]->Reset();
				return;
			} else {
				tween = tweens[i];
				tweens.erase(tweens.begin()+i);
				tween->doOnComplete();
//				delete tween;
				return;
			}
		}
	}
}
开发者ID:Flapstah,项目名称:Polycode,代码行数:17,代码来源:PolyTweenManager.cpp


示例5: while

bool Intro::update(float time) {

	std::vector<Animation*>::iterator iter = animations.begin();
	while (iter != animations.end())
	{
		if(loops%2==0){
			(*iter)->currentFrame++;
		}

		if((*iter)->currentFrame>=numframes){
			(*iter)->currentFrame=0;
		}
		iter++;
	}

	myTween.update();
	//myTween2.update();
	loops++;

	return true;
}
开发者ID:valdirSalgueiro,项目名称:SGS,代码行数:21,代码来源:Intro.cpp


示例6: CCLOG

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


示例7: readDouble

int Worker::handleRequest(queue<double> &inData) {
    double d;
    int status = readDouble(coordSocketFd, d);

    if (status == 0) {
        inData.push(d);
    }

    if (inData.size() >= 3) {
        int frameNumber = (int)inData.front();
        inData.pop();
        int column = (int)inData.front();
        inData.pop();
        int numWorkers = (int)inData.front();
        inData.pop();

        // cerr << "BEFORE " << mView << endl;
        // cerr << "FRAME NUMBER " << frameNumber << endl;

        for (list<Tween*>::iterator it = mTweens.begin(); it != mTweens.end(); it++) {
            Tween* tween = *it;
            tween->init();
            // cerr << "FRAME NUMBER1 " << frameNumber << endl;
                // cerr << "FRAME NUMBER2 " << frameNumber << endl;
            if (tween->type == Tween::TRANSLATE) {
                Vector3D translateDelta = tween->getTweenDelta(frameNumber);
                // cerr << "translateDelta " << translateDelta << endl;
                mEye = mEye + translateDelta;
            } else if (tween->type == Tween::ROTATE) {
                // cerr << "BEFORE " << mView << endl;
                Vector3D rotateDelta = tween->getTweenDelta(frameNumber);
                // cerr << "DELTA " << rotateDelta << endl;
                mView = mView + rotateDelta;
                mSide = mView.cross(mUp);
                // cerr << "AFTER " << mView << endl;
            }
        }


        WorkPool workPool;
        for (int i = column; i < this->width; i += numWorkers) {
            workPool.addJob(i);
        }

        pthread_mutex_t lock;
        pthread_mutex_init(&lock, NULL);

        struct worker_thread_args args;
        args.sendLock = &lock;
        args.workPool = &workPool;
        args.renderer = this->r;
        args.height = this->height;
        args.coordSocketFd = coordSocketFd;

        vector<pthread_t *> workerThreads;

        int numThreads = numCPUs;
        for (int i = 0; i < numThreads; i++) {
            pthread_t *thread = new pthread_t();
            pthread_create(thread, NULL, &testMethod, &args);
            workerThreads.push_back(thread);
        }
        for (int i = 0; i < numThreads; i++) {
            pthread_t *thread = workerThreads[i];
            pthread_join(*thread, NULL);
            delete thread;
        }

        return 1;
    }
    return status;
}
开发者ID:kkevinchou,项目名称:CS488-A5,代码行数:72,代码来源:worker.cpp


示例8: TEST_CASE

//
//  TweenerTests.cpp
//
//
//  Created by Ricardo Amores Hernández on 12/6/16.
//
//

#include "catch.hpp"
#include "Tween.hpp"

TEST_CASE("Test Tween API", "[App]") {
    
    SECTION("Initialization setups correct values") {
        Tween t(0, 10.0, 20.0, Linear::easeIn);
        
        REQUIRE_FALSE(t.hasStarted());
        REQUIRE_FALSE(t.hasFinished());
        REQUIRE_FALSE(t.isRunning());
        
        REQUIRE(t.initialValue() == 0);
        REQUIRE(t.endValue() == 10);
        REQUIRE(t.currentValue() == 0);
        REQUIRE(t.durationMs() == 20.0);
    }
    
    
    SECTION("Tween needs to be started to work") {
        Tween t(0, 10.0, 20.0, Linear::easeIn);
        
        t.Update(100);
开发者ID:rickyah,项目名称:columnas-sdl,代码行数:31,代码来源:TweenerTests.cpp


示例9: animate

 animate(button* b) {
     but = b;
     t.bounds(-20, 20).transition(Tween::TRANSITION_QUAD | Tween::EASING_BOTH).duration(250).loop();
 }
开发者ID:evoL,项目名称:blast-prototype,代码行数:4,代码来源:main.cpp


示例10: removeTweens

//--------------------------------------------------------------
void Tweenzor::add(Tween& tween) {
	removeTweens(tween.getProperty() );
	__instance->_tweens.push_back(&tween );
}
开发者ID:jellevdster,项目名称:FALv07,代码行数:5,代码来源:Tweenzor.cpp


示例11: operator

 void operator()(int delta) {
     //but->anim = (int)t.go(delta);
     int val = (int)t.go(delta);
     but->setX(150 - (val/2));
     but->setWidth(300 + val);
 }
开发者ID:evoL,项目名称:blast-prototype,代码行数:6,代码来源:main.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Twine类代码示例发布时间:2022-05-31
下一篇:
C++ TutorialApplication类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap