Effects and Animations in Styles - FireMonkey Guide

Back to Styles

In a style both animations and [TEffect|effects]] can be used to change the appearance of a control based on it’s state. Both modify the appearance of their immediate parent object in the style. Examples of the use of effects and animations are displaying a glow around a focussed control or changing the text colour to red if the value is negative.

The effect will be activated or deactivated bast on a ‘trigger condition’ given in the Trigger property of the effect or animation. Animations also have a TriggerInverse property which can be used to reverse the animation. Trigger conditions make use of trigger properties of the control being styled. These are any properties named IsXXXX. Trigger properties use special coding to trigger any relevant animations and effects. To create trigger properties in your own custom controls see Triggering Effects and Animations.

Trigger conditions take the form of

<PropertyName>=[true|false];<PropertyName>=[true|false] 

E.g.

IsPressed=true
IsPressed
=false;IsMouseOver=true 

When multiple conditions are specified they are combined with an and operation. Trigger conditions are not case sensitive.

For effects that’s pretty much it, they are either enabled or not. But it should be noted that you can only attach one effect to any object.

Animations

For an animation you will also need to specify the PropertyName, which is the name of the property in the Parent object which will be animated (modified).

Each animation class animates a particular type of property. E.g. a TFloatAnimation will animate a floating point value, such as Height or Opacity. You will, therefore, need to use an animation of the appropriate class for the property you want to change. See TAnimation for a list of the built in animation classes and the types of the properties they modify.

Version: XE4

Categories:

div title=