Beispiel #1
0
        float PathAnimation::progress()
        {
            float progress = AbstractAnimation::progress();
            switch(easing_)
            {
                case Easing::Linear:
                {
                    return progress;
                    break;
                }
                case Easing::InOutQuint:
                {
                    return easeInOutQuint(progress, 0.0f, progress, 1.0f);
                    break;
                }
                case Easing::InQuint:
                {
                    return easeInQuint(progress, 0.0f, progress, 1.0f);
                    break;
                }
                case Easing::OutQuint:
                {
                    return easeOutQuint(progress, 0.0f, progress, 1.0f);
                    break;
                }
                case Easing::OutElastic:
                {
                    return easeOutElastic(progress);
                    break;
                }
            }

            // "backup" return value
            return progress;
        }
Beispiel #2
0
void Asteroids::Update(float elapsed) {
	playerStartAnimationTime += elapsed;
	if (playerStartAnimationTime < 1.0f) {
		float animationAValue = mapValue(playerStartAnimationTime, 0.4f, 2.0f, 0.0f, 1.0f);
		player->scale_x = easeOutElastic(0.0, 1.0, animationAValue);
		player->scale_y = easeOutElastic(0.0, 1.0, animationAValue);
	}

	for (size_t i = 0; i < entities.size(); i++) {
		entities[i]->Update(elapsed);
	}

	for (size_t i = 0; i < MAX_BULLETS; i++) {
		bullets[i].Update(elapsed);
	}

	for (size_t i = 0; i < particleEmitters.size(); i++) {
		particleEmitters[i].Update(elapsed);
	}

	shootTimer += elapsed;
	enemySpawnTimer += elapsed;
}
Beispiel #3
0
 qreal value(qreal t)
 {
     qreal p = (_p < 0) ? 0.3f : _p;
     qreal a = (_a < 0) ? 1.0f : _a;
     switch(_t) {
     case In:
         return easeInElastic(t, a, p);
     case Out:
         return easeOutElastic(t, a, p);
     case InOut:
         return easeInOutElastic(t, a, p);
     case OutIn:
         return easeOutInElastic(t, a, p);
     default:
         return t;
     }
 }
Beispiel #4
0
 double valueForProgress ( double a_fProgress ) const
 {
     double fPeriod = (m_fPeriod < 0) ? 0.3 : m_fPeriod;
     double fAmplitude = (m_fAmplitude < 0) ? 1.0 : m_fAmplitude;
     switch ( m_eType )
     {
     case In:
         return easeInElastic ( a_fProgress, fAmplitude, fPeriod );
     case Out:
         return easeOutElastic ( a_fProgress, fAmplitude, fPeriod );
     case InOut:
         return easeInOutElastic ( a_fProgress, fAmplitude, fPeriod );
     case OutIn:
         return easeOutInElastic ( a_fProgress, fAmplitude, fPeriod );
     default:
         return a_fProgress;
     }
 }
Beispiel #5
0
static qreal easeOutElastic(qreal t)
{
	const qreal a = 0;
	const qreal p = 0.3;
	return easeOutElastic(t, a, p);
}