13 November, 2007

Text Animation in Pascal

Uses Crt;
Var txt : String;

Procedure AnimTxt(Str : String; Sec : Integer);
Var LengthStr, lCounter : Integer;

Begin
TextColor(green);
LengthStr := Length(Str);
For lCounter := 1 to LengthStr Do Begin
GotoXy(1 + lCounter,12);
Write(Str[lCounter]);
Delay(Sec);
End;
End;

Begin
Write('Enter text to be animated: ');
Readln(txt);
GotoXy(1,12);
AnimTxt(Txt,200); {The '200' is the delay of time to display from one character to another.}
GotoXy(1,18);
Write('Press any key to exit...');
Readkey;
End.

No comments: