mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-02 06:39:36 +01:00
Examples: Minor improvements of sample project motiongraphics (http://forum.lazarus.freepascal.org/index.php/topic,36858.msg245986.html)
git-svn-id: trunk@54877 -
This commit is contained in:
parent
7cc4753676
commit
cd4add856f
@ -7,12 +7,12 @@ object Form1: TForm1
|
||||
ClientHeight = 240
|
||||
ClientWidth = 320
|
||||
OnPaint = FormPaint
|
||||
LCLVersion = '0.9.31'
|
||||
LCLVersion = '1.9.0.0'
|
||||
object Label1: TLabel
|
||||
Left = 6
|
||||
Height = 18
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 46
|
||||
Width = 35
|
||||
Caption = 'Speed:'
|
||||
ParentColor = False
|
||||
end
|
||||
|
||||
@ -33,6 +33,9 @@ implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.timerRedrawTimer(Sender: TObject);
|
||||
@ -68,23 +71,25 @@ end;
|
||||
function TForm1.RotatePoint(APoint, ACenter: TPoint; AAngle: Double): TPoint;
|
||||
var
|
||||
dx, dy: Double;
|
||||
sinAngle, cosAngle: Double;
|
||||
begin
|
||||
dx := (ACenter.Y * Sin(AAngle)) - (ACenter.X * Cos(AAngle)) + ACenter.X;
|
||||
dy := -(ACenter.X * Sin(AAngle)) - (ACenter.Y * Cos(AAngle)) + ACenter.Y;
|
||||
Result.X := Round((APoint.X * Cos(AAngle)) - (APoint.Y * Sin(AAngle)) + dx);
|
||||
Result.Y := Round((APoint.X * Sin(AAngle)) + (APoint.Y * Cos(AAngle)) + dy);
|
||||
SinCos(AAngle, sinAngle, cosAngle);
|
||||
dx := ACenter.Y * sinAngle - ACenter.X * cosAngle + ACenter.X + 10;
|
||||
dy := -ACenter.X * sinAngle - ACenter.Y * cosAngle + ACenter.Y + Height div 4;
|
||||
Result.X := Round(APoint.X * cosAngle - APoint.Y * sinAngle + dx);
|
||||
Result.Y := Round(APoint.X * sinAngle + APoint.Y * cosAngle + dy);
|
||||
end;
|
||||
|
||||
procedure TForm1.FormPaint(Sender: TObject);
|
||||
var
|
||||
lPoints: array[0..2] of TPoint;
|
||||
begin
|
||||
lPoints[0].X := 100;
|
||||
lPoints[0].Y := 100;
|
||||
lPoints[1].X := 200;
|
||||
lPoints[0].X := Self.Width div 4;
|
||||
lPoints[0].Y := Self.Height div 4;
|
||||
lPoints[1].X := Self.Width div 2;
|
||||
lPoints[1].Y := 0;
|
||||
lPoints[2].X := 200;
|
||||
lPoints[2].Y := 200;
|
||||
lPoints[2].X := Self.Width div 2;
|
||||
lPoints[2].Y := Self.Height div 2;
|
||||
RotatePolygon(lPoints, CurStep);
|
||||
Canvas.Polygon(lPoints);
|
||||
end;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<Version Value="10"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
@ -12,9 +12,6 @@
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
@ -37,14 +34,13 @@
|
||||
<Unit0>
|
||||
<Filename Value="motiongraphics.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="motiongraphics"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="mainform.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="mainform"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
@ -64,12 +60,6 @@
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<UseMsgFile Value="True"/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user