Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Animation questions
Thu, Nov 12 2015 5:50 AMPermanent Link

Uli Becker

When I set animations properties of a TBasicPanel e.g., the animation is
executed during the creation of the form. I guess that is not
intentional, is it?

Another question: I'd like to execute one animation (height) after the
other (width). I tried the AnimationComplete event and checked the
animation's classname, but can't get that to work:

procedure TForm1.btnStartClick(Sender: TObject);
begin
   PanelTest.Width := 500;
end;

procedure TForm1.PanelTestAnimationComplete(Sender: TObject; Animation:
TAnimation);
begin
  edit1.text := Animation.classname;
  if Animation is TWidthAnimation then
    PanelTest.height := 300;
end;

Executing the code in btnStartClick shows the "width" animation, but the
height is 300 from the start of the animation, because the event already
has been fired during the form's creation. Probably that's the "general"
problem.

Uli
Thu, Nov 12 2015 6:59 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< When I set animations properties of a TBasicPanel e.g., the animation is executed during the creation of the form. I guess that is not intentional, is it? >>

No, it's intentional.  It's how you can do stuff like this:

http://www.elevatesoft.com:8081/responsive/responsive.html

without writing any code.

<< Another question: I'd like to execute one animation (height) after the other (width). I tried the AnimationComplete event and checked the animation's classname, but can't get that to work:

....

Executing the code in btnStartClick shows the "width" animation, but the height is 300 from the start of the animation, because the event already has been fired during the form's creation. Probably that's the "general"
problem. >>

Are you setting the animation properties for the Height and Width at design-time ?  If so, then yes, the animations would execute at form creation.

What you want is this (at runtime):

procedure TForm1.Button1Click(Sender: TObject);
begin
  with BasicPanel1 do
     begin
     BeginUpdate;
     try
        Animations.Width.Style:=asQuadEaseOut;
        Animations.Width.Duration:=500;
        Width:=500;
     finally
        EndUpdate;
     end;
     end;
end;

procedure TForm1.BasicPanel1AnimationComplete(Sender: TObject; Animation: TAnimation);
begin
  if (Animation=BasicPanel1.Animations.Width) then
     begin
     with BasicPanel1 do
        begin
        BeginUpdate;
        try
           Animations.Height.Style:=asQuadEaseOut;
           Animations.Height.Duration:=500;
           Height:=300;
        finally
           EndUpdate;
        end;
        end;
     end;
end;

However, this is a little buglet in how the animation completion is handled, and it will possibly fire multiple times when it should only fire once, so wait until 2.03 to try this.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Nov 12 2015 7:54 AMPermanent Link

Uli Becker

Tim,

> However, this is a little buglet in how the animation completion is handled, and it will possibly fire multiple times when it should only fire once, so wait until 2.03 to try this.

OK, thanks for the clarification!

Uli
Image