本帖最后由 冥界3大法王 于 2020-11-15 14:08 编辑
[Delphi] 纯文本查看 复制代码 unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, acPNG,
Vcl.ExtCtrls, Vcl.StdCtrls, sLabel;
type
TForm1 = class(TForm)
sLabel1: TsLabel;
Timer1: TTimer;
Image1: TImage;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
Math;
procedure TForm1.Timer1Timer(Sender: TObject);
var
PI: Float32;
DuShu: Integer;
begin
PI := 3.1415926;
DuShu := 0;
if Image1.Left <> 0 then
begin
DuShu := DuShu + 10;
Image1.Left := 240 + Ceil(5 * cos(DuShu * PI / 180));
Image1.Top := 240 + Ceil(5 * sin(DuShu * PI / 180));
end;
end;
end.
//三角函数以及求圆上的任意一点
//圆心坐标:(x0,y0) 240,208
//半径:5
//角度:10
//圆周率: PI
//则圆上任一点为:(x1,y1)
//x1 = 240 + 5 * cos(10 * PI /180 )
//y1 = 240 + 5 * sin(10 * PI /180 )
|