I have added a button and added a BoxBlurEffect to it and set following attributes to the BoxBlurEffect1
.
//extracted form fmx file
object BoxBlurEffect1: TBoxBlurEffect
Trigger = 'IsMouseOver=true'
Enabled = False
BlurAmount = 0.009999999776482582
object FloatAnimation1: TFloatAnimation
AnimationType = atInOut
Enabled = True
Duration = 1.000000000000000000
Loop = True
Trigger = 'IsMouseOver=true'
TriggerInverse = 'IsMouseOver=false'
StartValue = 0.009999999776482582
StopValue = 10.000000000000000000
PropertyName = 'BlurAmount'
end
end
I set loop = true because if it is false it is not animating it is just suddenly going to end value.
So I set it to true. But now it is looping (as the name described) not just animating once and stopping.
And also I want it to animate from stop value to start value when I leave the mouse (only once). When my mouse leaves or enters, the new animation must start from current value not from the max or min value.
Trigger doesn't always work as I expect neither...
You can do it like this:
procedure TForm2.Button1MouseEnter(Sender: TObject);
begin
BoxBlurEffect1.AnimateFloat('BlurAmount', 10, 1);
end;
procedure TForm2.Button1MouseLeave(Sender: TObject);
begin
BoxBlurEffect1.AnimateFloat('BlurAmount', 0, 1);
end;
Without TFloatAnimation:
object Button1: TButton
Position.Point = '(264,192)'
Width = 80.000000000000000000
Height = 22.000000000000000000
OnMouseEnter = Button1MouseEnter
OnMouseLeave = Button1MouseLeave
TabOrder = 1
StaysPressed = False
IsPressed = False
Text = 'Button1'
object BoxBlurEffect1: TBoxBlurEffect
BlurAmount = 0.009999999776482582
end
end