gpt4 book ai didi

delphi - Delphi Firemonkey中的鼠标事件动画

转载 作者:行者123 更新时间:2023-12-03 01:23:16 28 4
gpt4 key购买 nike

我添加了一个按钮并向其添加了一个 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,因为如果它是false,它就不会动画,它只是突然达到最终值。

所以我将其设置为true。但现在它正在循环(如名称所述),而不仅仅是动画一次然后停止。

而且我还希望当我离开鼠标时它从停止值动画到开始值(仅一次)。当我的鼠标离开或进入时,新动画必须从当前值开始,而不是从最大值或最小值开始。

最佳答案

触发器并不总是像我期望的那样工作......

你可以这样做:

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

关于delphi - Delphi Firemonkey中的鼠标事件动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7806487/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com