Technology Learning

导航

图像的飘动效果

procedure TForm15.FormActivate(Sender: TObject);
var
  X:Real;
  Z:integer;
  A:integer;
  pic1:TBitmap;
  pic2:TBitmap;
begin
A:=0;
pic1:=TBitmap.Create;
pic2:=TBitmap.Create;
pic1.Width:=312;
pic1.Height:=312;

pic1.Canvas.Brush.Color:=clBlack;

pic2.Width:=312;
pic2.Height:=312;
pic2.Canvas.Brush.Color:=clBlack;
Repeat
  for Z:=1 to 312 do
  begin
    inc(A);
    if A>310 then A:=0;
    X:=cos((A/0.05)/Pi)*(16/2.5);
    pic1.Canvas.CopyRect(Bounds(Round(X),Z,312,1),Image1.Canvas,Bounds(0,Z,312,1));

  end;
  for Z:=1 to 312 do
  begin
    inc(A);if A>310 then A:=0;
    X:=Cos((A/0.05)/Pi)*(16/2.5);
    pic2.Canvas.CopyRect(Bounds(Z,Round(X),1,312),pic1.Canvas,Bounds(Z,0,1,312));
  end;
  canvas.Draw(0,0,pic2);
  pic1.Canvas.Rectangle(0,0,312,312);
  pic2.Canvas.Rectangle(0,0,312,312);
  Application.ProcessMessages;
  Until Application.Terminated;

 

pic1.Free;
pic2.Free;

end;

posted on 2010-04-01 21:26  浔阳渔夫  阅读(280)  评论(0编辑  收藏  举报