In a previous post, we had discussed about making an animated bouncing text from left to right, which, the text moves from the right .. and then back again, and so on .. and now we will create an animated bouncing text from top to bottom,,
on the 'object inspector', change the propert (click on the component, and then look at the object inspector)
----------------------------------------------------------------------------------------------------------------
timer1
interval ---> 5 ----------------------------------------------------------------------------------------------------------------
double click on 'form', and copy the program in red below
procedure TForm1.FormCreate(Sender: TObject);
begin
atas:=true;
end;
begin
atas:=true;
end;
and, double click on 'timer1', then copy the program in red below
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if label1.top<=0 then atas:=false;
if (label1.Top+label1.Height)>= panel1.Height then atas:=true;
if atas=true then
label1.Top:=label1.Top-1
else
label1.Top:=label1.Top+1;
end;
end.
begin
if label1.top<=0 then atas:=false;
if (label1.Top+label1.Height)>= panel1.Height then atas:=true;
if atas=true then
label1.Top:=label1.Top-1
else
label1.Top:=label1.Top+1;
end;
end.
try the program ... click 'run' or F9. and see the result..
if errors, usually occurs on the program,,
good luck......
No comments:
Post a Comment