void CAniVScroller::AnimateLinearScroll (Metric rRate)

//	AnimateLinearScroll
//
//	Sets an animation timeline to scroll through all lines

{
    CLinearMetric *pScroller = new CLinearMetric;
    Metric cyViewport = m_Properties[INDEX_VIEWPORT_HEIGHT].GetMetric();
    pScroller->SetParams(-cyViewport, m_cyEnd, rRate);

    AnimateProperty(PROP_SCROLL_POS, pScroller);
}
void CTextCrawlSession::CreateCrawlAnimation (const CString &sText, const RECT &rcRect, IAnimatron **retpAni)

//	CreateCrawlAnimation
//
//	Creates the prologue and epilogue animation

	{
	int i;

	const CVisualPalette &VI = m_HI.GetVisuals();
	const CG16bitFont &SubTitleFont = VI.GetFont(fontSubTitle);
	CG32bitPixel rgbColor = VI.GetColor(colorTextAltHighlight);

	//	Adjust because scroller does not clip at the bottom

	int cyHeight = RectHeight(rcRect) - SubTitleFont.GetHeight();

	//	Create a scroller

	CAniVScroller *pAni = new CAniVScroller;
	pAni->SetPropertyVector(PROP_POSITION, CVector((Metric)rcRect.left, (Metric)rcRect.top));
	pAni->SetPropertyMetric(PROP_VIEWPORT_HEIGHT, (Metric)cyHeight);
	pAni->SetPropertyMetric(PROP_FADE_EDGE_HEIGHT, (Metric)(cyHeight / 8));

	//	Add the text

	TArray<CString> Lines;
	SubTitleFont.BreakText(sText, RectWidth(rcRect), &Lines);

	for (i = 0; i < Lines.GetCount(); i++)
		{
		IAnimatron *pText;

		CAniText::Create(Lines[i],
				CVector(0.0, pAni->GetHeight()),
				&SubTitleFont,
				0,
				rgbColor,
				&pText);
		pAni->AddLine(pText);
		}

	//	Scroll from the bottom until the text is centered.
	//	Compute the center position (remember that coordinates are cartessian; down is negative)

	int yPos = -((RectHeight(rcRect) - (SubTitleFont.GetHeight() * Lines.GetCount())) / 2);

	CLinearMetric *pScroller = new CLinearMetric;
	pScroller->SetParams(-cyHeight, yPos, CRAWL_SPEED);
	pScroller->AddListener(EVENT_ON_ANIMATION_DONE, this, CMD_SHOW_OK_BUTTON);
	pAni->AnimateProperty(PROP_SCROLL_POS, pScroller, 0);

	//	After the scrolling is done, fade-out

	CLinearFade *pFader = new CLinearFade;
	pFader->SetParams(pScroller->GetDuration() + CRAWL_DURATION, 0, 30);
	pAni->AnimateProperty(PROP_OPACITY, pFader, 0);

	//	Done

	*retpAni = pAni;
	}