Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 1.26 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. procedure TMForm.ScenaPlasma1(X1,Y1,X2,Y2,V:integer;przesuniecie:Real;RuszaSie:Boolean;Speed:Real);
  2. var
  3.   P,Q,X,Y,Hm,Wm: Integer;
  4.   Q1,Q2,RadWm,RadHm,SinR,CosR: Real;
  5.   B: Byte;
  6.   C1,C2,C3: Byte;
  7. begin
  8. R := R + Speed;
  9. R2 := R2 + Speed/2;
  10. R3 := R3 + Speed;
  11. //if FirstRun then R := 0.1;
  12. Hm := Y2 - Y1;
  13. Wm := X2 - X1;
  14. FirstRun := False;
  15. with(Buffer.Canvas) do
  16.   begin
  17.     RadWm := Pi/(Wm/V);
  18.     RadHm := Pi/(Hm/V);
  19.     SinR := Sin(R+przesuniecie);
  20.     CosR := Cos(R+przesuniecie);
  21.   for P:=0 to (Hm div V) do
  22.     for Q:=0 to (Wm div V) do
  23.       begin
  24.       X := X1 div V + Q;
  25.       Y := Y1 div V + P;
  26.       if RuszaSie then
  27.         begin
  28.         Q1 := Sqr(SinR*Sin(R+przesuniecie-Q*RadWm)) * 4096;
  29.         Q2 := Sqr(CosR*Cos(R+przesuniecie+P*RadHm)) * 4096;
  30.         end
  31.           else
  32.         begin
  33.         Q1 := Sqr(SinR*Sin(R+przesuniecie-X*RadWm)) * 4096;
  34.         Q2 := Sqr(CosR*Cos(R+przesuniecie+Y*RadHm)) * 4096;
  35.         end;
  36.  
  37.         B := 255-Round(Q1-Q2);
  38.           C1 := Round(Abs(Sin(R2+przesuniecie)) * B);
  39.           C2 := Round(Abs(Sin(R2 + przesuniecie + Pi*2/3)) * B);
  40.           C3 := Round(Abs(Sin(R2 + przesuniecie + Pi*2/6)) * B);
  41.  
  42.       Brush.Style := bsSolid;
  43.       Brush.Color := RGB(C1,C2,C3);
  44.       FillRect(Rect(X*V+X,Y+Y*V,(X+1)*V+X,Y+(Y+1)*V));
  45.       end;
  46.   end;
  47. end;