我添加了一个按钮,并为其添加了BoxBlurEffect,并将以下属性设置为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
我设置了loop = true,因为如果它是假的,那么它不是动画,它只是突然变为最终值。
所以我把它设置为true。但现在它正在循环(如所描述的名称),不仅仅是动画一次并停止。
当我离开鼠标(仅一次)时,我也希望它从停止值动画到起始值。当我的鼠标离开或进入时,新动画必须从当前值开始,而不是从最大值或最小值开始。
答案 0 :(得分:6)
触发并不总是有效,因为我没想到......
你可以这样做:
procedure TForm2.Button1MouseEnter(Sender: TObject);
begin
BoxBlurEffect1.AnimateFloat('BlurAmount', 10, 1);
end;
procedure TForm2.Button1MouseLeave(Sender: TObject);
begin
BoxBlurEffect1.AnimateFloat('BlurAmount', 0, 1);
end;
没有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