Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > FireMonkey
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 28-08-2015
Avatar de AgustinOrtu
[AgustinOrtu] AgustinOrtu is offline
Miembro Premium
NULL
 
Registrado: ago 2013
Ubicación: Argentina
Posts: 1.858
Poder: 15
AgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en bruto
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
    { Private declarations }
  public
    { Public declarations }
  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
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Hacer las veces de DISTINCTROW en SQL Server con Distinct RedVenom SQL 0 11-05-2011 19:49:53
Hacer aparecer un objeto con transparencia ElDuc OOP 0 12-02-2009 18:17:06
ibdatabase y firebird a veces si a veces no Patricio Conexión con bases de datos 13 18-09-2008 14:01:21
Girar imagen Arroyo69 C++ Builder 2 12-06-2008 09:11:43
girar texto josefns Impresión 7 26-10-2007 23:00:30


La franja horaria es GMT +2. Ahora son las 05:19:15.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi