Here the code, or, for me, a template to create animation.
Manipulate[and here the result
Graphics[{
Blue,
Circle[{t, 0}, 1]
},
PlotRange -> {{-10, 10}, {10, -10}},
ImageSize -> {400, 300},
Background -> GrayLevel[0.9],
Axes -> True
],
{t, 0, 5}
]
Manipulate[and here the result
Graphics[{
Blue,
Circle[{t, 0}, 1]
},
PlotRange -> {{-10, 10}, {10, -10}},
ImageSize -> {400, 300},
Background -> GrayLevel[0.9],
Axes -> True
],
{t, 0, 5}
]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Shape1: TShape;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
tkotak=record
x,y,vx,vy,ax,ay:real;
end;
var
Form1: TForm1;
jalan:boolean;
kotak:tkotak;
dt:real;
implementation
{$R *.dfm}
procedure proses;
begin
kotak.vx:=kotak.vx+kotak.ax*dt;
kotak.x:=kotak.x+kotak.vx*dt;
form1.Shape1.Left:=round(kotak.x);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
button1.Caption:='jalan';
jalan:=false;
kotak.x:=0;
kotak.y:=0;
kotak.vx:=5;
kotak.vy:=0;
kotak.ax:=10;
kotak.ay:=0;
dt:=0.1;
shape1.Left:=round(kotak.x);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
jalan:=not(jalan);
if jalan=true then button1.Caption:='stop' else button1.Caption:='jalan';
while jalan=true do begin
proses;
application.ProcessMessages;
sleep(100);
end;
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
jalan:boolean;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
jalan:=not(jalan);
if jalan=true then button1.Caption:='stop' else button1.Caption:='jalan';
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
jalan:=false;
end;
end.
My sky is high, blue, bright and silent.
Nugroho's (almost like junk) blog
By: Nugroho Adi Pramono