Animation - Stop Method

Stop animating and go to the end of the animation

Member of Animation (PRIM_ANIM)

Details

The Stop method is used to stop an animation.

Animations do no affect the actual property values of controls until the animation completes. Stopping an animation before the end will cause all controls to revert to their state as it was before the animation started.

Example

In this example, clicking the label will move it 200 pixels in 3 seconds. If the Stop button is clicked during the animation, the label will return to its starting point.

     Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientheight(112) Clientwidth(1050) Height(151) Width(1066) Left(218) Top(203) Theme(#SYS_THEME<2015Orange>)

Define_Com Class(#PRIM_VS.Style) Name(#Style1) Backgroundbrush(#Brush1)
Define_Com Class(#PRIM_VS.SolidBrush) Name(#Brush1) Color(Theme500)

Define_Com Class(#PRIM_labl) Name(#Label) Displayposition(1) Left(8) Parent(#COM_OWNER) Tabposition(1) Top(8) Tabstop(False) Height(65) Width(105) Alignment(Center) Verticalalignment(Center) Style(#Style1) Caption('Click')
Define_Com Class(#PRIM_PHBN) Name(#Stop) Caption('Stop') Displayposition(2) Left(8) Parent(#COM_OWNER) Tabposition(2) Top(80)

Define_Com Class(#prim_anim) Name(#Animation)
Define_Com Class(#prim_anim.Move) Name(#Animation1) Parent(#Animation) Left(200) Manage(#Label) Duration(3000)

Evtroutine Handling(#Label.Click)

#Label := "Animating"
#Animation.Start

Endroutine

Evtroutine Handling(#Stop.Click)

#Animation.Stop

Endroutine

Evtroutine Handling(#Animation.Ended)

#Label := ("Click (Left &1)").Substitute( #Label.left.AsString )

Endroutine

End_Com

See also

All Component Classes

Technical Reference

  • No labels