unit Unit3;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
FMX.Objects, FMX.Layouts, FMX.Controls.Presentation, FMX.Ani;
type
TForm3 = class(TForm)
Button1: TButton;
Layout1: TLayout;
Layout2: TLayout;
Button2: TButton;
Rectangle1: TRectangle;
Panel1: TPanel;
FloatAnimation1: TFloatAnimation;
PathAnimation1: TPathAnimation;
Button3: TButton;
FloatAnimation2: TFloatAnimation;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ private 宣言 }
mCnt: Integer;
public
{ public 宣言 }
end;
var
Form3: TForm3;
implementation
{$R *.fmx}
procedure TForm3.Button1Click(Sender: TObject);
begin
// 1 Down
if mCnt > 4 then Exit; // 上Down
mCnt := mCnt + 1;
FloatAnimation2.Stop;
FloatAnimation2.Duration := 2;
FloatAnimation2.StartValue := Rectangle1.Position.Y + 0; // 始点
FloatAnimation2.StopValue := Rectangle1.Position.Y + 50; // 終点
FloatAnimation2.Start; // 開始
end;
procedure TForm3.Button2Click(Sender: TObject);
begin
// New One ボタン動作
FloatAnimation1.Stop;
FloatAnimation1.Duration := 1;
FloatAnimation1.StartValue := -250; // 始点
FloatAnimation1.StopValue := 150; // 終点
FloatAnimation1.Start; // 開始
mCnt := 0;
end;
procedure TForm3.Button3Click(Sender: TObject);
begin
//1 Down Bound
if mCnt > 4 then Exit;
mCnt := mCnt + 1;
PathAnimation1.StopAtCurrent; // 終了
PathAnimation1.Start; // 開始
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
mCnt := 0; //初期化
PathAnimation1.Create(Self);
PathAnimation1.Path.MoveTo(PointF(0,50)); // 移動范围指定
PathAnimation1.Path.LineTo(PointF(0,10)); // 途中座標指定
PathAnimation1.Path.LineTo(PointF(0,50)); // 途中座標指定
PathAnimation1.Path.LineTo(PointF(0,20)); // 途中座標指定
PathAnimation1.Path.LineTo(PointF(0,50)); // 途中座標指定
PathAnimation1.Path.LineTo(PointF(0,30)); // 途中座標指定
PathAnimation1.Path.ClosePath; // 座標指定終了
PathAnimation1.Duration := 2;
end;
end.