Animate

#include "Utility\Tweener\Tweener.h"

tween::Tweener _tweener;
int counter = 0;

void TweenTest::CreateTween() {
    tween::TweenerParam param(5000);
    param.addProperty(&_displayObject->_x, 200);
    param.addProperty(&_displayObject->_y, 500);

    _tweener.addTween(param);

        _tweener.addEventListener("ON_START", std::bind(&TweenTest::ON_START_tweener, this, std::placeholders::_1));

        _tweener.addEventListener("ON_COMPLETE", std::bind(&TweenTest::ON_COMPLETE_tweener, this, std::placeholders::_1));

        _tweener.addEventListener("ON_STEP", std::bind(&TweenTest::ON_STEP_tweener, this, std::placeholders::_1));
}

void TweenTest::UpdateTween() {
    _tweener.step(counter );
    counter  += 1;
}

void TweenTest::ON_START_tweener(const Event &e) {
    //called if tween has started
}

void TweenTest::ON_STEP_tweener(const Event &e) {
    //called if tween has made a step
}

void TweenTest::ON_COMPLETE_tweener(const Event &e) {
    //called if tween is finished
}

Last edited Jun 21, 2013 at 8:36 AM by TypeOverride, version 4

Comments

No comments yet.