Sabtu, 11 April 2015

Membuat Animasi Sederhana (Menggunakan Delphi)

var
  Form1: TForm1;
  gambar:integer;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
if button1.caption='Pause' then
begin
timer1.enabled:=false;
button1.caption:='Start';
end else
begin
timer1.enabled:=true;
button1.caption:='Pause';
end;
end;


procedure TForm1.Timer1Timer(Sender: TObject);
begin
if gambar=1 then
image1.Picture.LoadFromFile('gambarA.bmp')
else if gambar=2 then
image1.Picture.LoadFromFile('gambarB.bmp')
else if gambar=3 then
image1.Picture.LoadFromFile('gambarC.bmp')
else if gambar=4 then
image1.Picture.LoadFromFile('gambarD.bmp')
else if gambar=5 then
image1.Picture.LoadFromFile('gambarE.bmp')
else if gambar=6 then
image1.Picture.LoadFromFile('gambarF.bmp')
else if gambar=7 then
image1.Picture.LoadFromFile('gambarG.bmp')
else if gambar=8 then
image1.Picture.LoadFromFile('gambarH.bmp')
else if gambar=9 then
image1.Picture.LoadFromFile('gambarI.bmp')
else if gambar=10 then
image1.Picture.LoadFromFile('gambarJ.bmp')
else if gambar=11 then
image1.Picture.LoadFromFile('gambarK.bmp')
else if gambar=12 then
image1.Picture.LoadFromFile('gambarL.bmp')
else if gambar=13 then
image1.Picture.LoadFromFile('gambarM.bmp')
else if gambar=14 then
image1.Picture.LoadFromFile('gambarN.bmp')
else if gambar=15 then
image1.Picture.LoadFromFile('gambarO.bmp')
else if gambar=16 then
image1.Picture.LoadFromFile('gambarP.bmp')
else if gambar=17 then
image1.Picture.LoadFromFile('gambarQ.bmp')
else if gambar=18 then
image1.Picture.LoadFromFile('gambarR.bmp')
else if gambar=19 then
image1.Picture.LoadFromFile('gambarS.bmp');
if gambar=19 then
gambar:=1
else
inc(gambar);
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
gambar:=1;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;

end.

Tidak ada komentar:

Posting Komentar