1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
var
Form1: TForm1;
aniX: TFloatAnimation;
aniY: TFloatAnimation;
aniZ: TFloatAnimation;
implementation
{$R *.fmx}
procedure TForm1.Button1Click(Sender: TObject);
begin
GotoPosi(posiHublot1.Position, 2);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
GotoPosi(posiHublot2.Position, 3);
end;
procedure TForm1.GotoPosi(posi: TPosition3D; duree: Single);
begin
if not Assigned(aniX) then
begin
aniX := TFloatAnimation.Create(Bras);
aniX.Parent := Bras;
aniY := TFloatAnimation.Create(Bras);
aniY.Parent := Bras;
aniZ := TFloatAnimation.Create(Bras);
aniZ.Parent := Bras;
end;
aniX.PropertyName := 'Position.X';
aniX.StartValue := Bras.Position.X;
aniX.StopValue := posi.X;
aniX.Loop := false;
aniX.AutoReverse := false;
aniX.Duration := duree;
aniX.Start;
aniY.PropertyName := 'Position.Y';
aniY.StartValue := Bras.Position.Y;
aniY.StopValue := posi.Y;
aniY.Loop := false;
aniY.AutoReverse := false;
aniY.Duration := duree;
aniY.Start;
aniZ.PropertyName := 'Position.Z';
aniZ.StartValue := Bras.Position.Z;
aniZ.StopValue := posi.Z;
aniZ.Loop := false;
aniZ.AutoReverse := false;
aniZ.Duration := duree;
aniZ.Start;
end; |