void WormHeadAppearance::tweenDiameterCoefficient(float destination, float duration) {
  // stop previous tween if any.
  Tweener::getInstance()->stopTween(diameterTween);

  float origin = diameterCoefficient;
  Tween tween = Tween(duration, [this, destination, origin](double t) {
        this->diameterCoefficient = origin*(1 - t) + destination*t;
      }, []() {
        // do nothing when done.
    });
  diameterTween = Tweener::getInstance()->startTween(tween);
}
void WormHeadAppearance::tweenArrowLength(float destination, float duration) {
  // stop previous tween if any.
  Tweener::getInstance()->stopTween(arrowLengthTween);

  float origin = arrowLength;
  Tween tween = Tween(duration, [this, destination, origin](double t) {
      this->arrowLength = origin*(1 - t) + destination*t;
      }, []() {
        // do nothing when done.
    });
  arrowLengthTween = Tweener::getInstance()->startTween(tween);
}
Example #3
0
void ActionElasticMoveTo::Update( float dt )
{
	if(!IsRunning()) return;

	m_fCurrTime += dt;

	if (m_fCurrTime > m_fTime)
	{
		SetPosition(m_vPosEnd);
		Stop();
		return;
	}

	SetPosition(Tween());
}