FMXTFmxObjectAnimateColor (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example shows how to call the TFmxObject method AnimateColor. Note that once called, you do not have access to the TColorAnimation instance that AnimateColor creates.

This instance has Rectangle1 as its parent, therefore it will be cleaned up when Rectangle1 is deleted. This example requires a TRectangle in a TForm.

Note that if you misspell 'Fill.Color', AnimateColor does nothing.

Code

procedure TForm1.TurnBlueClick(Sender: TObject);
begin
  Rectangle1.AnimateColor('Fill.Color', $FF0003F3, 5, TAnimationType.InOut,
    TInterpolationType.Linear);
end;

procedure TForm1.TurnRedClick(Sender: TObject);
begin
  Rectangle1.AnimateColor('Fill.Color', $FFF32000, 5, TAnimationType.InOut,
    TInterpolationType.Exponential);
end;

Uses

See Also