2024년 11월 4일 월요일

Gradient Color Timer Change

 



procedure TForm1.Gradation_Draw( angle : integer );

begin

  GRect.Fill.Gradient.Points[0].Color := GColor1;

  GRect.Fill.Gradient.Points[0].Offset := 0;


  GRect.Fill.Gradient.Points[1].Color := GColor2;

  GRect.Fill.Gradient.Points[1].Offset := 1;


  if IsAType then

  begin

    GRect.Fill.Gradient.StartPosition.X := 0.0;

    GRect.Fill.Gradient.StartPosition.Y := 0.0;

    GRect.Fill.Gradient.StopPosition.X :=  angle / 10;    

    GRect.Fill.Gradient.StopPosition.Y :=  1.0;

  end

  else

  begin

    GRect.Fill.Gradient.StartPosition.X := 0.0;

    GRect.Fill.Gradient.StartPosition.Y := 0.1;

    GRect.Fill.Gradient.StopPosition.X :=  1.0;

    GRect.Fill.Gradient.StopPosition.Y :=  angle / 10;   

  end;


  GRect.Repaint;

end;



//***************************************************************************************************************************

procedure TForm1.ColorTimer1Timer(Sender: TObject);

begin

  if ( R1 = $ff0000 ) and ( G1 = 0 ) and ( B1 < $0000ff ) then                           

    B1 := B1 + $000001


  else if (( 0 < R1 ) and ( R1 <= $ff0000 )) and ( G1 = 0 ) and ( B1 = $0000ff ) then     

    R1 := R1 - $010000


  else if ( R1 = 0 ) and ( G1 < $00ff00 ) and  ( B1 = $0000ff ) then                        

    G1 := G1 + $000100


  else if ( R1 = 0 ) and ( G1 = $00ff00 ) and (( 0 < B1 ) and ( B1 <= $0000ff ))  then       

    B1 := B1 - $000001


  else if ( R1 < $ff0000 ) and ( G1 = $00ff00 ) and ( B1 = $000000 )  then                  

    R1 :=  R1 + $010000


  else if ( R1 = $ff0000 ) and (( 0 < G1 ) and ( G1 <= $00ff00 )) and ( B1 = $000000 ) then  

    G1 := G1 - $000100


  else

    ColorTimer1.Enabled := FALSE;


  GColor1 := $FF000000 +  R1 + G1 + B1;

  Rectangle1.Fill.Color := GColor1;

end;

댓글 없음:

댓글 쓰기