Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 3 of 3 total |
Animations |
Fri, Sep 28 2018 7:58 PM | Permanent Link |
Allen Hunt | Hi,
I'm using Animations to animate moving a basicpanel with the left and width properties. The child controls of the panel don't render their layout positions during the animations. I'm curious if this is by design or whether or not I need to loop thru the child controls and animate them as well. I've attached an example of the issue I'm trying to resolve. Any help is greatly appreciated. Thank you! Best regards, Allen Attachments: Animation.zip |
Mon, Oct 1 2018 7:44 PM | Permanent Link |
Allen Hunt | Fyi
It looks like I made have some mistakes in the source I provide. I'm not setting the Layout.Stretch property to lsNone before the animation. But it doesn't appear to be making any difference. If I don't animate the width property and leave the left animation set the child controls get rendered property but when using the width animation they don't. I'm thinking it may have something to do with the width animation but I'm not sure. |
Tue, Oct 2 2018 5:01 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Allen,
<< If I don't animate the width property and leave the left animation set the child controls get rendered property but when using the width animation they don't. >> You've got a *lot* of issues with your code: 1) You accidentally removed the form variable, so it isn't getting initialized properly and will cause things to fail if anything tries to refer to the form variable to call methods, access properties, etc. 2) You are sizing things according to the browser viewport, even though the panel that you're trying to animate is a child control on a form. You should size things according to the *form*, not the browser viewport. 3) Your layout properties for the TBasicPanel aren't correct - you've got them set to position top-left and stretch top-right. The stretch should be just "right". 4) You're resetting the layout *before* the animations are complete. 5) You're *not* animating the child control, hence the reason why it seems to be "sticky". 6) Don't hide/show controls that you're trying to animate (unless you're trying to animate the visibility). It can interact with the dimensional animation in weird ways, especially in a BeginUpdate..EndUpdate where the showing/dimensional layout all occurs at the EndUpdate call. Here's code that should work for you: unit Main; interface uses WebCore, WebUI, WebForms, WebCtrls, WebBtns, WebBrwsr, WebCtnrs, WebLabels, WebSizer; type TFormMain = class(TForm) BasicPanel: TBasicPanel; ButtonGo: TButton; Button1: TButton; procedure ButtonGoClick(Sender: TObject); procedure BasicPanelAnimationsComplete(Sender: TObject); private { Private declarations } public { Public declarations } procedure SlideDown(AControl: TControl; AStyle: TAnimationStyle; ADuration: Integer); end; var FormMain: TFormMain; implementation procedure TFormMain.SlideDown(AControl: TControl; AStyle: TAnimationStyle; ADuration: Integer); var i, x, widthOffset: Integer; begin with AControl do begin BeginUpdate; try DefineLayout; // Peg the defined dimensions of the control based upon the current layout Layout.Position:=lpTopCenter; Layout.Stretch:=lsNone; Animations.Left.Style := asNone; Animations.Height.Style := asNone; Animations.Width.Style := asNone; for I:=0 to ControlCount-1 do Controls[I].Animations.Left.Style:=asNone; x := Height; Height := 1; widthOffset := 20 * 2; Width := FormMain.ClientWidth - widthOffset; finally EndUpdate; // Render end; BeginUpdate; try Animations.Left.Style := AStyle; Animations.Left.Duration := ADuration; for I:=0 to ControlCount-1 do begin Controls[I].Animations.Left.Style:=AStyle; Controls[I].Animations.Left.Duration:=ADuration; end; Animations.Height.Style := AStyle; Animations.Height.Duration := ADuration; Animations.Width.Style := AStyle; Animations.Width.Duration := ADuration; Height := x; Width := FormMain.ClientWidth; finally EndUpdate; // Render (with animation) end; end; end; procedure TFormMain.ButtonGoClick(Sender: TObject); begin SlideDown(BasicPanel,asLinear,750); end; procedure TFormMain.BasicPanelAnimationsComplete(Sender: TObject); begin with BasicPanel do begin Layout.Position := lpTopLeft; Layout.Stretch := lsRight; end; end; end. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Thursday, March 28, 2024 at 06:05 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |