Фрактал вложенные квадраты

Фрактал вложенные квадраты

Демонстрация, построенная на известном фрактале "Вложенные квадраты". Эффект движения сделан за счет динамической смены цвета каждого вложенного квадрата.

Разместите на форме компонент Image1: TImage с вкладки Additional и компонент Timer1: TTimer с вкладки System. В инспекторе объектов (Object Inspector) выставьте начальные значения для компонентов.

Form1
  ClientWidth: 500
  ClientHeight: 500
 
Image1
  Align: alClient
 
Timer1
  Interval: 30

Переключитесь клавишей F12 в редактор кода и создайте в разделе Private класса Form1 процедуру Procedure RotateRect;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Image1: TImage;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
    Procedure RotateRect;
  public
    { Public declarations }
  end;

Нажмите CTRL+SHIFT+C, данная компбинация автоматически создаст заголовок процедуры в разделе implementation. Впишите в нее следующий код:

procedure TForm1.RotateRect;
Const N = 55;
      DT = 20;
      SD = 0;
Var Col        : TColor;
    RC, GC, BC : Integer; // Составляющие цвета
    Pnt        : Array [1..4] of TPoint;
    mx, my     : Integer;
    d          : ShortInt;
    i          : Integer;
begin
  With Image1 do begin
    Pnt[1].x := SD;
    Pnt[1].y := SD;
    Pnt[2].x := Width - SD;
    Pnt[2].y := SD;
    Pnt[3].x := Width - SD;
    Pnt[3].y := Height - SD;
    Pnt[4].x := SD;
    Pnt[4].y := Height - SD;
    GC :=0; RC := 0; BC := IC;
    d := id;
    Col := RGB( BC, GC, BC);
    Canvas.Pen.Color   := Col;
    Canvas.Brush.Color := Col;
    Canvas.Polygon( Pnt);
    For i:=1 to N do begin
      mx := Pnt[1].x;
      my := Pnt[1].y;
      Pnt[1].x := Pnt[1].x + (Pnt[2].x - Pnt[1].x) div DT;
      Pnt[1].y := Pnt[1].y + (Pnt[2].y - Pnt[1].y) div DT;
      Pnt[2].x := Pnt[2].x + (Pnt[3].x - Pnt[2].x) div DT;
      Pnt[2].y := Pnt[2].y + (Pnt[3].y - Pnt[2].y) div DT;
      Pnt[3].x := Pnt[3].x + (Pnt[4].x - Pnt[3].x) div DT;
      Pnt[3].y := Pnt[3].y + (Pnt[4].y - Pnt[3].y) div DT;
      Pnt[4].x := Pnt[4].x + (mx - Pnt[4].x) div DT;
      Pnt[4].y := Pnt[4].y + (my - Pnt[4].y) div DT;
      if BC >= 255 then d := -1;
      if BC <= 0   then d := 1;
      BC := BC + d * 5;
      Col := RGB( BC, GC, BC);
      Canvas.Pen.Color   := Col;
      Canvas.Brush.Color := Col;
      Canvas.Polygon( Pnt);
    end;
  if IC >= 255 then begin Id := 1; end;
  if IC <= 0 then begin Id := -1;  end;
  IC := IC - id * 5;
  end;
end;

Проинициализируйте в основном разделе Var две глобальные переменные

Var Form1: TForm;
    IC : Integer = 250;
    ID : ShortInt = -1;

Теперь вернитесь на форму (Клавиша F12) и сделайте двойной щелчок на компоненте Timer1 - это создаст в редакторе кода процедуру procedure TForm1.Timer1Timer(Sender: TObject); в которую необходимо вписать вызов процедуры RotateRect:

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  RotateRect;
end;

Запустите программу. Run (F9).

Если Вы хотите, чтоб при перемещении окна, картинка не мерцала, задайте форме Form1 свойство DoubleBuffered := true. Сделать это лучше сразу при создании формы на событие OnCreate (вкладка Events в инспекторе объектов).

procedure TForm1.FormCreate(Sender: TObject);
begin
 DoubleBuffered := true;
end;

СКАЧАТЬ ПРОГРАММУРазмер
Move_Square.exe (367)393 кб

Отправил Вс, 12/09/2018 - 13:14

Installment Loans

In case if one needs cash at the moment, the most reliable way to have it is to address to installment loans that have historically been reputed as the most helpful and timely for large purchases. Installment loan represents a limited loan, assuming a specified time period for beginning and ending, which should be identified during the applying process. Everyone is able to pop up how frequently he would return the money. For instance, everyone may have the loan type, being structured in the form of a payment per month with 36 equal parts for two years.

Taking into consideration varieties of installment loans, you might select between secured and unsecured one. Unsecured type is signature loan as it might be drawn up only by signing the contract and justifying your wish in such a way. Secured loan is backed by guarantee paper that can be modified in case of emergency. For example, auto loan is frequently secured by the auto you pay cash in hand for. That's why installment loans online in CO are a helpful solution to borrow money at profitable rates.

How to Apply for Installment Loans when Your Credit Score Isn't Good?

To tell the truth, you decide on just 2 ways. The first one is to go to a banking establishment. However, take account that the motives for lending installment loans are a bit bounded: mortgage, auto, children, and personal loans. Furthermore, banks have strict terms for such lends, especially if you require an unsecured kind. Clients with marginal credits have to provide a co-maker has to be creditworthy and trusty. Furthermore, banking establishments need a long and time-taking application process that won't fit when you hurry.

One more variant and working solution in that situation is to count on our online services and take installment loans without headache. We guarantee the most fitting terms for your precise situation, granting profitable benefits and privileges. You can check it!

Benefits of Receiving Installment Loans at Our Site

Due to us, you can bank on guaranteed advantages:
Easy and fast|Fast and easy. Our service appreciates your time and wants to economize it by granting comfortable online application process. As you can't wait for long weeks to obtain 'yes' and receive your cash , we offer opportune answers and variants from direct lenders.

Cash at hand. Our terms are flexible and client-oriented; so, we dispose a fair scheme of work and no extra charges, meaning that we render money aid in case if you feel need in it above all without any questions.

Debtees for your situation. We collaborate with trusty and revised creditors from the United States, who would like to be helpful for you!|

Bad credit score can't be considered as the last verdict. While most banks and debtees turn your loan down, we will make all efforts to pop up the most appropriate decision for your case. We appreciate all our clients and wish to offer an individual approach!

Payments you will be able to afford. Do you remember these enormous charges while examining rivals' portals? We see them too! Thus, we prefer to take care of customers than to raise fast money on their difficulties.

No checks of your credits. We realize why you have ask us for help; thus, we don't pay attention to your credit score by rendering you a chance both to dispose finances and improve your credit score for the future, demonstrating what a trustworthy borrower you are!

Reflect upon Installment Loans?

Don't have doubts and call us to receive more details about installment loans and specifications https://maybeloan.com/installment-loans/wi-usa-il . Our advisors are available on the round-the-clock basis and usually wish to help you, that's why you will see a reply very quickly. Don't count on the better times to dispose money, assume them straight away with our company!

Последние комментарии

  • http://ziter.ru/index.php?productID=3751 http://eur-style.ru/product/713 http://samaram.ru/product/nemnogo-o-napolnyh-chasah http://salonturov.ru/index.php?productID=43345
  • What Do Installment Loans Present Themselves? In case if one feels need in ready money straight away, the best method to get it is to turn to installment loans that have historically been known as the most efficient and timely for enormous buyings. Installment loan constitutes a close-end loan,...
  • ОСТАЛОСЬ ВСЕГО 15 ДЕНЕЖНЫХ БОНУСОВ! ВЫПЛАЧЕНО БОЛЕЕ 4 000 000 РУБЛЕЙ ! ---http://link.futbol/8lko

Счетчики