DelphiXE2 FireMonkey3D 鼠标指向时的渐变

来源:互联网 发布:mac系统显示隐藏文件夹 编辑:程序博客网 时间:2024/06/05 07:49

一、接前面的,在 Diffuse 的下拉列表中,选择 Create New TColorAnimation

 

二、连续点击两次,创建两个 TColorAnimation

 

三、如图修改属性

ColorAnimation1.StartValue := Green ;ColorAnimation1.StopValue  := Lime  ;ColorAnimation1.Trigger    := 'IsMouseOver=true';ColorAnimation2.StartValue := Lime  ;ColorAnimation2.StopValue  := Green ;ColorAnimation2.Trigger    := 'IsMouseOver=false';


 

 

四、 左边是平时的球, ---------------------------------------------------------------------------右边是鼠标移动到球上时,球的颜色改变

 

 

窗体代码;

object Form1: TForm1  Left = 0  Top = 0  BiDiMode = bdLeftToRight  Caption = 'Form1'  ClientHeight = 601  ClientWidth = 681  Transparency = False  Visible = False  object Sphere1: TSphere    RotationAngle.Point = '(0,-5.6288743019104,0)'    Width = 3.000000000000000000    Height = 3.000000000000000000    Depth = 3.000000000000000000    Opacity = 1.000000000000000000    Material.Diffuse = claGreen    Quanternion = '(0,-0.0491016022861004,0,0.998793303966522)'    object ColorAnimation1: TColorAnimation      Duration = 0.200000002980232200      Trigger = 'IsMouseOver=true'      StartValue = claGreen      StopValue = claLime      PropertyName = 'Material.Diffuse'    end    object ColorAnimation2: TColorAnimation      Duration = 0.200000002980232200      Trigger = 'IsMouseOver=false'      StartValue = claLime      StopValue = claGreen      PropertyName = 'Material.Diffuse'    end  end  object Light1: TLight    Position.Point = '(1,1,-5)'    Width = 1.000000000000000000    Height = 1.000000000000000000    Depth = 1.000000000000000000    Opacity = 1.000000000000000000    LightType = ltDirectional    Quanternion = '(0,0,0,1)'  endend


 

 

原创粉丝点击