Skip to content

TStyledAnimatedToolButton - Technical Reference ​

Overview ​

TStyledAnimatedToolButton is the button created by TStyledAnimatedToolbar: a TStyledToolButton that can hold a Lottie animation (Skia TSkAnimatedImage). See the TStyledAnimatedToolbar page for the description (status: experimental) and the examples.

Class Hierarchy ​

TCustomStyledGraphicButton
  └─ TStyledToolButton
      └─ TStyledAnimatedToolButton

The render class (GetRenderClass) is TStyledAnimatedButtonRender (unit Vcl.StyledAnimatedButton).

Unit ​

pascal
Vcl.StyledAnimatedToolbar

Published properties ​

Only the properties added by TStyledAnimatedToolButton.

PropertyTypeDefaultDescription
AutoAnimationTypesTAutoAnimationTypes[]Events that start the animation (AnimateOnMouseOver, AnimateOnClick, AnimateAlways, AnimateOnFocus). Unlike TStyledAnimatedButton it is empty by default; AnimateAlways is not handled by this class
AnimationSourceTSkAnimatedImage.TSourceemptyThe Lottie data, stored in the DFM as binary property AnimationData
AutoSizeAnimationBooleanTrueAutomatic size of the animation
AutoSizeAnimationMarginInteger10 (DEFAULT_ANIM_MARGIN)Margin used by AutoSizeAnimation
AnimationWidthInteger32 (DEFAULT_ANIM_SIZE)Width when AutoSizeAnimation is False (assigning it sets AutoSizeAnimation to False)
AnimationHeightInteger32 (DEFAULT_ANIM_SIZE)Height when AutoSizeAnimation is False (assigning it sets AutoSizeAnimation to False)

Public members ​

MemberDescription
property AnimatedImage: TSkAnimatedImageThe internal Skia component (created on first access, child of the toolbar, initially not visible)
constructor CreateStyled(AOwner; AFamily; AClass; AAppearance)Creates the button with the given style
procedure LoadAnimationFromFile(const AFileName: TFileName)Loads a Lottie file into AnimationSource
procedure LoadAnimationFromStream(const AStream: TStream)Loads a Lottie stream into AnimationSource (from the current stream position)
function CanPlayAnimation: BooleanTrue if AnimationSource has data
procedure StartAnimation(ALoop: Boolean = False; AInverse: Boolean = False; AProgress: Double = 0)Starts the animation
procedure PauseAnimation / ResumeAnimationPause and resume
procedure StopAnimationStops the animation (Progress = 1, last frame)
function AnimationIsRunning: BooleanTrue while the animation is playing
procedure CreateAnimationCreates the internal TSkAnimatedImage (called automatically)
procedure ClickOverride: starts the animation if AnimateOnClick is in AutoAnimationTypes

Differences from TStyledAnimatedButton: no AnimateOnType, AnimationLoop, AnimationInverse, Render and LoadAnimationFromResource.

Mouse enter / leave start and stop the animation when AnimateOnMouseOver is set; getting the focus starts it when AnimateOnFocus is set.

Inherited members (briefly) ​

All the properties of TStyledToolButton (see its Reference): style properties, Caption, ImageIndex, Style (tbsButton, tbsSeparator...), Down, Grouped, AllowAllUp, DropDownMenu, Action, NotificationBadge, ...

See Also ​

Released under Apache License, Version 2.0.