Mas pruebas:
Código Delphi
[-]
unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms3D,
FMX.Types3D, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Math.Vectors, FMX.Ani, FMX.Controls3D, FMX.Objects3D;
type
TForm1 = class(TForm3D)
Cube1: TCube;
FloatAnimation1: TFloatAnimation;
procedure Form3DKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
procedure Form3DKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
procedure Form3DCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.Form3DCreate(Sender: TObject);
begin
FloatAnimation1.Enabled := False;
FloatAnimation1.AnimationType := TAnimationType.In;
FloatAnimation1.AutoReverse := FalsE;
FloatAnimation1.Delay := 0;
FloatAnimation1.Duration := 0.1;
FloatAnimation1.Interpolation := TInterpolationType.Linear;
FloatAnimation1.Inverse := FalsE;
FloatAnimation1.Loop := False;
FloatAnimation1.PropertyName := 'RotationAngle.Y';
FloatAnimation1.StartFromCurrent := True;
FloatAnimation1.StartValue := 0;
FloatAnimation1.StopValue := 360;
end;
procedure TForm1.Form3DKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
begin
if FloatAnimation1.Running then
Exit;
if Key in [vkLeft, vkRight] then
begin
FloatAnimation1.AnimateFloat(FloatAnimation1.PropertyName, FloatAnimation1.CurrentTime);
case Key of
vkLeft: FloatAnimation1.StopValue := Cube1.RotationAngle.Y + 10;
vkRight: FloatAnimation1.StopValue := Cube1.RotationAngle.Y - 10;
end;
FloatAnimation1.Start;
end;
end;
procedure TForm1.Form3DKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
begin
if (Key in [vkLeft, vkRight]) and (FloatAnimation1.Running) then
FloatAnimation1.StopAtCurrent;
end;
end.
En este caso al presionar las teclas izquierda/derecha el cubo rota en la direccion indicada. Al soltar la tecla el cubo se detiene. No hace falta usar timer, de hecho las animaciones crean su propio thread para animar el objeto