一、接前面的,在 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