Recent

Author Topic: [solved] Projects in C:\lazarus\examples - motiongraphics  (Read 2639 times)

PeterX

  • Sr. Member
  • ****
  • Posts: 404
[solved] Projects in C:\lazarus\examples - motiongraphics
« on: May 12, 2017, 12:31:06 pm »
This is not a bugfix - simply makes it look better, to me ..

- on resizing the window ! -


Quote
procedure TForm1.FormPaint(Sender: TObject);
var
  lPoints: array[0..2] of TPoint;
begin
  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 := Self.Width  div 2;
  lPoints[2].Y := Self.Height div 2;
  ...


with additionally ..
Quote
function TForm1.RotatePoint(APoint, ACenter: TPoint; AAngle: Double): TPoint;
var
  dx, dy: Double;
begin
  dx := (ACenter.Y * Sin(AAngle)) - (ACenter.X * Cos(AAngle)) + ACenter.X +10;
  dy := -(ACenter.X * Sin(AAngle)) - (ACenter.Y * Cos(AAngle)) + ACenter.Y +Self.Height div 4;
  ...
« Last Edit: May 15, 2017, 02:02:20 pm by PeterX »
usually using latest Lazarus release version with Windows 10

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: Projects in C:\lazarus\examples - motiongraphics
« Reply #1 on: May 12, 2017, 12:48:25 pm »
Done in r54877, together with a little refactoring to avoid multiple calculation of sin(AAngle) and cos(AAngle).

 

TinyPortal © 2005-2018