1

I am having issues with the following code:

procedure TForm1.Button1Click(Sender: TObject);
var Rectangle:TRectangle;
Animation: TFloatAnimation;
begin
Rectangle := TRectangle.Create(Self);
With Rectangle do
  begin
    Parent := Form1;
    Height := 65;
    Width := 65;
  end;

Animation := TFloatAnimation.Create(Rectangle);
with Animation do
  begin
    Parent := Rectangle;
      PropertyName := 'Size.Width';
      StartValue := 65;
      StopValue := 120;
      Trigger := 'IsMouseOver=true';
      TriggerInverse := 'IsMouseOver=false';
      Interpolation := TInterpolationType.Cubic;
  end;
end;

Whenever my mouse cursor leaves the created rectangle, it leaves an "afterimage" as shown below: "Afterimage" after the inverse of the Animation How can I fix this?

Whenever I tried increasing the duration of the Float Animation, it did not leave the afterimage. However, I am required to have a faster animation without the slow-down of having a long animation.

4
  • this is FMX, isn't it? Sep 28 at 12:22
  • yes @complete_stranger
    – Jayden404
    Sep 28 at 12:26
  • From PropertyName := 'Size.Width'; remove Size. Iow, use: PropertyName := 'Width'; Sep 28 at 13:11
  • Tom is right. For some reason changing size of FMX components using Size.Width does not notify parent component/control that it needs updating. I'm not sure whether this is by design or a bug. Sep 28 at 15:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.