Jump to content

Animation: Difference between revisions

1,429 bytes added ,  3 years ago
Added Delphi example
m (→‎{{header|Phix}}: minor tidy)
(Added Delphi example)
Line 660:
}
</lang>
 
 
===HTML DOM===
Line 690 ⟶ 691:
}
</lang>
=={{header|Delphi}}==
{{libheader| Winapi.Windows}}
{{libheader| System.SysUtils}}
{{libheader| System.Classes}}
{{libheader| Vcl.Controls}}
{{libheader| Vcl.Forms}}
{{libheader| Vcl.StdCtrls}}
{{libheader| Vcl.ExtCtrls}}
<lang Delphi>
unit Main;
 
interface
 
uses
Winapi.Windows, System.SysUtils, System.Classes, Vcl.Controls, Vcl.Forms,
Vcl.StdCtrls, Vcl.ExtCtrls;
 
type
TForm1 = class(TForm)
lblAniText: TLabel;
tmrAniFrame: TTimer;
procedure lblAniTextClick(Sender: TObject);
procedure tmrAniFrameTimer(Sender: TObject);
end;
 
var
Form1: TForm1;
Reverse: boolean = false;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.lblAniTextClick(Sender: TObject);
begin
Reverse := not Reverse;
end;
 
function Shift(text: string; direction: boolean): string;
begin
if direction then
result := text[text.Length] + text.Substring(0, text.Length - 1)
else
result := text.Substring(1, text.Length) + text[1];
end;
 
procedure TForm1.tmrAniFrameTimer(Sender: TObject);
begin
with lblAniText do
Caption := Shift(Caption, Reverse);
end;
end.</lang>
Form resource:
<lang Delphi>
object Form1: TForm1
ClientHeight = 132
ClientWidth = 621
object lblAniText: TLabel
Align = alClient
Alignment = taCenter
Caption = 'Hello World! '
Font.Height = -96
OnClick = lblAniTextClick
end
object tmrAniFrame: TTimer
Interval = 200
OnTimer = tmrAniFrameTimer
end
end
</lang>
=={{header|E}}==
 
478

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.