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
└─ TStyledAnimatedToolButtonThe render class (GetRenderClass) is TStyledAnimatedButtonRender (unit Vcl.StyledAnimatedButton).
Unit
Vcl.StyledAnimatedToolbarPublished properties
Only the properties added by TStyledAnimatedToolButton.
| Property | Type | Default | Description |
|---|---|---|---|
AutoAnimationTypes | TAutoAnimationTypes | [] | Events that start the animation (AnimateOnMouseOver, AnimateOnClick, AnimateAlways, AnimateOnFocus). Unlike TStyledAnimatedButton it is empty by default; AnimateAlways is not handled by this class |
AnimationSource | TSkAnimatedImage.TSource | empty | The Lottie data, stored in the DFM as binary property AnimationData |
AutoSizeAnimation | Boolean | True | Automatic size of the animation |
AutoSizeAnimationMargin | Integer | 10 (DEFAULT_ANIM_MARGIN) | Margin used by AutoSizeAnimation |
AnimationWidth | Integer | 32 (DEFAULT_ANIM_SIZE) | Width when AutoSizeAnimation is False (assigning it sets AutoSizeAnimation to False) |
AnimationHeight | Integer | 32 (DEFAULT_ANIM_SIZE) | Height when AutoSizeAnimation is False (assigning it sets AutoSizeAnimation to False) |
Public members
| Member | Description |
|---|---|
property AnimatedImage: TSkAnimatedImage | The 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: Boolean | True if AnimationSource has data |
procedure StartAnimation(ALoop: Boolean = False; AInverse: Boolean = False; AProgress: Double = 0) | Starts the animation |
procedure PauseAnimation / ResumeAnimation | Pause and resume |
procedure StopAnimation | Stops the animation (Progress = 1, last frame) |
function AnimationIsRunning: Boolean | True while the animation is playing |
procedure CreateAnimation | Creates the internal TSkAnimatedImage (called automatically) |
procedure Click | Override: 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, ...
