void Lantern::update()
{
    if(should_fade_down())
    {
        animating = true;
        tweenAlphaTo(0, 3, EasingEquations::EASE_INOUT_CUBIC);
    }
}
void Lantern::reset(ofxImageSequence * sequence)
{
    _loc.x = _original_loc.x + ofRandom(100);

    if(_loc.x < 0)  _loc.x = 0;
    if(_loc.x > ofGetWidth() - 200) _loc.x = ofGetWidth() - 200;

    _sequence = sequence;
    _start_millis = ofGetElapsedTimeMillis();
    animating = false;
    tweenAlphaTo(255, 3, EasingEquations::EASE_INOUT_CUBIC);
}
//-------------------------------------------------------------------------------------------------------------------------------------
//
void Tweenable2D::updateTweening()
{
	float tmpSec = timer.elapsedSec();
	
	// Position
	if( posTweenProps.active )
	{
		posTweenProps.update( tmpSec );
	} 
	else 
	{ 
		if ( posTweenProps.backWhenDone )
		{
			tweenPosTo(posTweenProps.startX, posTweenProps.startY, posTweenProps.tweenTime, posTweenProps.easeType, false );
		}
	}
	
	// Size
	if( sizeTweenProps.active ) 
	{
		sizeTweenProps.update( tmpSec );
	}
	else 
	{ 
		if ( sizeTweenProps.backWhenDone )
		{
			tweenSizeTo(sizeTweenProps.startX, sizeTweenProps.startY, sizeTweenProps.tweenTime, sizeTweenProps.easeType, false );
		}
	}
	
	// Alpha
	if( alphaTweenProps.active ) 
	{
		alphaTweenProps.update( tmpSec );
	}
	else 
	{ 
		if ( alphaTweenProps.backWhenDone )
		{
			tweenAlphaTo(alphaTweenProps.startX, alphaTweenProps.tweenTime, alphaTweenProps.easeType, false );
		}
	}

	// Angle
	if( angleTweenProps.active ) 
	{
		angleTweenProps.update( tmpSec );
		//angle = AngleMath::wrapAngle180( angle ); 
		if( angle > 180.0f ) { angle -= 360.0f; } else if ( angle < -180.0f ) { angle += 360.0f; }
	}
	else 
	{ 
		if ( angleTweenProps.backWhenDone )
		{
			tweenAngleTo(angleTweenProps.startX, angleTweenProps.tweenTime, angleTweenProps.easeType, false );
		}
	}	

	// Color
	if( colorTweenProps.active ) 
	{
		colorTweenProps.update( tmpSec );
		
		//AColor tmpCol = colorInterpolator.interpolateAlphaBlendingRGB( colorTweeningVal );
		//color.setRGB( tmpCol.rgb.red, tmpCol.rgb.green, tmpCol.rgb.blue );
		
		interpolateAlphaBlendingRGB( &startColor, &endColor, colorTweeningVal, &color );
		color.a = alpha;
		
		//cout << color << endl;
		
	}
	else 
	{ 
		if ( colorTweenProps.backWhenDone )
		{
			//AColor tmpCol( endColor.rgb.red, endColor.rgb.green, endColor.rgb.blue );
			//tweenColorTo( &tmpCol,	colorTweenProps.tweenTime, colorTweenProps.easeType, false );
			
			tweenColorTo( endColor, colorTweenProps.tweenTime, colorTweenProps.easeType, false );
		}
	}		
	
}