unit Unit1;Project1.rar ( 255.14 килобайт ) Кол-во скачиваний: 472
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, DateUtils, jpeg;
type
TForm1 = class(TForm)
Timer1: TTimer;
Image0: TImage;
Timer2: TTimer;
Image2: TImage;
Image1: TImage;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
cl1=clblack;
x0=100;
w1=2;
y1=100;
L1=70;
w2=3;
L2=60;
w3=4;
L3=40;
cl4=clBlack;
w4=10;
A=50;
L4=330;
L40=130;
t0=1000;
y4=-120;
r=20;
var
w:real;
t:integer;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
with image1.Canvas do
begin
Brush.Color := ClWhite;
FillRect(Canvas.ClipRect);
pen.Color:=cl1;
pen.Width:=w1;
moveto(x0,y1);
lineto(x0+round(L1*cos(SecondOf(now)*6*pi/180-pi/2)),y1+round(L1*sin(SecondOf(now)*6*pi/180-pi/2)));
pen.Width:=w2;
moveto(x0,y1);
lineto(x0+round(L2*cos(MinuteOf(now)*6*pi/180-pi/2)),y1+round(L2*sin(MinuteOf(now)*6*pi/180-pi/2)));
pen.Width:=w3;
moveto(x0,y1);
lineto(x0+round(L3*cos(HourOf(now)*15*pi/180-pi/2)),y1+round(L3*sin(HourOf(now)*15*pi/180-pi/2)));
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
w:=2*pi/(T0*0.001);;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
var
x,y:integer;
f:real;
begin
with image2.Canvas do
begin
x:=round(A*sin(w*t*0.01));
y:=round(sqrt(L4*L4-x*x));
f:=arctan(x/y);
Brush.Color := ClWhite;
FillRect(Canvas.ClipRect);
pen.Color:=cl4;
brush.Color:=cl4;
pen.Width:=w4;
MoveTo(x0+round(L40*sin(f{-pi/2})),y4+round(L40*cos(f{-pi/2})));
LineTo(x0+x,y4+y);
pie(x0+x-r,y4+y-r,x0+x+r,y4+y+r,0,0,0,0);
end;
inc(t);
if t=t0 then t:=0;
end;
end.
вот код. все работает, но так как Transparent картинки маятника установлено в true, оно очень моргает. подскажите как от этого избавиться.