void Branch::draw( cairo::Context ctx ) { if ( mLaunchDelay > 0 ) return; if( ( mLifespan > 0 ) && ( ! mIsRoot ) ) { float ageLerp = 1.0 - mLifespan / (float)mTotalLifespan; float radius = lerp( mStartEllipseRadius, mEndEllipseRadius, ageLerp ); ColorA drawColor = lerp( mStartColor, mEndColor, ageLerp ); ctx.setSourceRgba( drawColor.r, drawColor.g, drawColor.b, 0.075f ); ctx.circle( mPos, ( 5.0f * mScale + radius * 1.3f ) / 2 ); ctx.fill(); ctx.setSource( drawColor ); ctx.circle( mPos, radius / 2 ); ctx.fill(); } for( vector<Branch>::iterator blossomIt = mBranches.begin(); blossomIt != mBranches.end(); ++blossomIt ) { blossomIt->draw( ctx ); } }