Delphiでアニメーションを製作しているのですが、どうしても速度を時間的に変化させる事ができません。例えば、1秒後には速度が1、2秒後には速度が2のようにするにはどのようにしたらよいのでしょうか?よろしくお願いします。
例えば、タイマーを使って
OnTimer時にIntervalを変えるとかではどうですか?
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Tag:= Timer1.Tag+1;
if Timer1.Tag>7 then Timer1.Tag:=1;
Timer1.Interval := Timer1.Tag*1000;
//
//ここでアニメ処理
//
end;
ありがとうございます!!さっそくトライしてみます!!
またトライした後に結果を報告しまーす!!
procedure TaThread.Execute;
var
i : integer;
Page : integer;
CoordBuff1 : array[0..249,0..1] of double;
HalfWd, XOffset, YOffset : integer;
move : double;
x,dt,T,a :real;
ix :integer;
begin
//Load the coordinates buffers with a random set of coordinates.
for i := 0 to 249 do
begin
CoordBuff1[i][0] := random(HalfWd);
CoordBuff1[i][1] := random(HalfWd);
end;
//cycle through loop changing each dots coordinates slightly then redrawing the
//dots onto a different page.
Page := 0;
repeat
for i := 0 to 249 do
begin
x := 0; dt := 1; a := 9.8; T := 0;
ix := Round(x);
T := T + dt;
move := a*T ;
x :=a*T*T/2 ;
if random > 0.5 then
CoordBuff1[i][0] := CoordBuff1[i][0]+move
else CoordBuff1[i][0] := CoordBuff1[i][0]+move ;
//Check the dot is still on the screen.
if CoordBuff1[i][0] > HalfWd then
CoordBuff1[i][0] := CoordBuff1[i][0] - HalfWd;
if CoordBuff1[i][0] < 0 then
CoordBuff1[i][0] := CoordBuff1[i][0] + HalfWd;
end;
//ここでアニメ作製
//Toggle the value in the page parameter.
Page := 1-Page;
until (Terminated = TRUE);
end;
という感じでもともとは動きが定義されています。これにタイマーを加えて時間的に速度が変化するようにしたいのですがわかりますか?
初心者なので、自分でプログラムを見ていても具体的にこれが何を示しているのかといったことがわかりません。
ちなみに、アニメーションというのはランダムドットです。
色々とお手数をおかけしてしまい本当にすみません。よろしくお願いします。
ありがとうございました。
ツイート | ![]() |