2004. december 22., szerda

Two colour fade effects


Problem/Question/Abstract:

Two color fade effects

Answer:

With a fast SetPal procedure you can create a smooth fade. Here are a few simple but effective fade routines:

var
  fadepal: array[0..15, 1..3] of byte;
  i, j: Integer;

procedure fadeout;
begin
  for i := 0 to 15 do
    getpal(colnum[i], fadepal[i, 1], fadepal[i, 2], fadepal[i, 3]);
  for j := 63 downto 0 do
  begin
    for i := 0 to 15 do
      setpal(colnum[i], fadepal[i, 1] * j div 63, fadepal[i, 2] * j div 63, fadepal[i, 3] * j div 63);
    delay(10);
  end;
end;

procedure fadein;
begin
  for j := 0 to 63 do
  begin
    for i := 0 to 15 do
      setpal(colnum[i], fadepal[i, 1] * j div 63, fadepal[i, 2] * j div 63, fadepal[i, 3] * j div 63);
    delay(10);
  end;
end;

Based on this you can also make interesting 'psycho-fades': instead of fading to black fade to another colour or to 2 or 4 or 16 other colors.

Nincsenek megjegyzések:

Megjegyzés küldése