Exemplo n.º 1
0
void Item::select( Timeline &timeline, float leftBorder )
{
	if( !mIsSelected ){
		mIsBeingSelected = true;
		
		mFadeFloat = 0.0f;
		
		float dur1 = 0.2f;
		float dur2 = 0.2f;
		
		// title position
		// set selected after initial animation
		timeline.apply( &mTitlePos, mTitleDest1, dur1, EaseInAtan( 10 ) ).finishFn( bind( &Item::setSelected, this ) );
		timeline.appendTo( &mTitlePos, mTitleDest2 - vec2( 25.0f, 0.0f ), 0.0001f, EaseNone() );
		timeline.appendTo( &mTitlePos, mTitleFinish, dur2, EaseOutAtan( 10 ) );
		// title color
		timeline.apply( &mTitleColor, Color( 1, 1, 1 ), dur1, EaseInQuad() );
		// title alpha
		timeline.apply( &mTitleAlpha, 0.0f, dur1, EaseInAtan( 10 ) );
		timeline.appendTo( &mTitleAlpha, 1.0f, dur2, EaseOutAtan( 10 ) );
		
		// desc position
		timeline.apply( &mDescPos, mDescDest, dur2, EaseOutAtan( 10 ) ).timelineEnd( -dur1 );
		// desc alpha
		timeline.apply( &mDescAlpha, 1.0f, dur2, EaseOutQuad() ).timelineEnd( -dur1*0.5f );
		
		// fadeFloat (used to adjust dropshadow offset)
		timeline.apply( &mFadeFloat, 0.0f, dur1, EaseInAtan( 10 ) );
		timeline.appendTo( &mFadeFloat, 0.0f, 0.25f, EaseNone() );
		timeline.appendTo( &mFadeFloat, 1.0f, dur2, EaseOutQuad() );
		
		// bar width
		timeline.apply( &mBarWidth, 0.0f, dur1, EaseInOutAtan( 10 ) );

		for( std::vector<Swatch>::iterator swatchIt = mSwatches.begin(); swatchIt != mSwatches.end(); ++swatchIt ) {
			swatchIt->scatter( timeline, math<float>::max( mTitleBigTex->getWidth(), 500.0f ), mTitleFinish.y + 50.0f );
		}
	}
}
Exemplo n.º 2
0
void Swatch::scatter( Timeline &timeline, float width, float height )
{
	vec2 pos1( 0.0f, mPos().y );
	vec2 pos2( 0.0f, height );
	vec2 pos3 = vec2( Rand::randFloat( width ), Rand::randFloat( height - 50.0f, height + 50.0f ) );//pos2 + rVec;
	
	float dur = Rand::randFloat( 0.25f, 0.5f );
	
	// pos
	timeline.apply( &mPos, mPos(), 0.2f, EaseInAtan( 10 ) ).finishFn( bind( &Swatch::setSelected, this ) );
	timeline.appendTo( &mPos, pos2, 0.0001f, EaseNone() );
	timeline.appendTo( &mPos, pos3, dur, EaseOutAtan( 20 ) );
	
	// alpha
	timeline.apply( &mAlpha, 0.0f, 0.2f, EaseInAtan( 10 ) );
	timeline.appendTo( &mAlpha, 1.0f, dur, EaseOutAtan( 10 ) );
	
	// scale
	float s = (float)Rand::randInt( 3, 7 );
	timeline.apply( &mScale, 1.0f, 0.2f, EaseInAtan( 10 ) );
	timeline.appendTo( &mScale, s*s, dur, EaseOutAtan( 20 ) );
}
Exemplo n.º 3
0
void Item::deselect( Timeline &timeline )
{
	mIsBeingSelected = false;
	
	float dur1 = 0.2f;
	float dur2 = 0.2f;
	
	// set title position
	// set deselected after initial animation
	timeline.apply( &mTitlePos, mTitleDest2, dur1, EaseInAtan( 10 ) ).finishFn( bind( &Item::setDeselected, this ) );
	timeline.appendTo( &mTitlePos, mTitleDest1, 0.0001f, EaseNone() );
	timeline.appendTo( &mTitlePos, mTitleStart, dur2, EaseOutElastic( 2.0f, 0.5f ) );
	
	// set title color
	timeline.apply( &mTitleColor, Color( 1, 1, 1 ), dur1, EaseInAtan( 10 ) );
	timeline.appendTo( &mTitleColor, Color( 0.7f, 0.7f, 0.7f ), 0.05f, EaseOutAtan( 10 ) );
	
	// set title alpha
	timeline.apply( &mTitleAlpha, 0.0f, dur1, EaseInAtan( 10 ) );
	timeline.appendTo( &mTitleAlpha, 1.0f, dur2, EaseOutAtan( 10 ) );
	
	// set desc position
	timeline.apply( &mDescPos, mDescStart, dur1, EaseInAtan( 10 ) ).timelineEnd();
	
	// set desc alpha
	timeline.apply( &mDescAlpha, 0.0f, dur1, EaseInQuad() ).timelineEnd( -dur1 );
	
	// set bar
	timeline.apply( &mBarWidth, 0.0f, dur1, EaseInAtan( 10 ) );
	mBarAlpha = 0.3f;
	
	mIsSelected = false;
	
	for( std::vector<Swatch>::iterator swatchIt = mSwatches.begin(); swatchIt != mSwatches.end(); ++swatchIt ){
		swatchIt->assemble( timeline );
	}
}