Re: Image animation

Derek, Fabio
This can be simplified and added a little effect.
We leave only Label1 on the form. Add one letter at a time to the label, changing the case.

procedure frmSommario_bAvanti_OnClick (Sender: TObject; var Cancel: boolean);
var
 itArr: string='ITALIANO';
begin
  frmItaliano.Label1.Caption := '';
  frmItaliano.doublebuffered := true;
  frmitaliano.show;
  for vi := 0 to length(itArr) do
  begin
    sleep(200);
    frmItaliano.Label1.Caption := frmItaliano.Label1.Caption + Lowercase(itArr[vi]);
    application.processmessages;
    sleep(400);
    frmItaliano.Label1.Caption := UpperCase(frmItaliano.Label1.Caption);
    application.processmessages;
  end;
  sleep(2500);
end;

procedure frmItaliano_OnClose can be cleared


If desired, the effect can be removed.

Re: Image animation

Hi Derek and Sparrow,
my confusion arises from the fact that at the beginning the animations are started by the "form_onshow" event. Now it is clear that I must subsequently give the instructions using another control otherwise the animations start before the window opens. Thank you very much not only for the corrections but also for the explanations which I hope I will treasure.
I really don't know how to thank you. Now I proceed by continuing to add forms and buttons, hoping that I have understood correctly but I doubt that I will have to come back to ask you something else.

Re: Image animation

Hi Again Fabio, Sparrow,
I was inspired by Sparrow's approach to simplifying 'frmitaliano' by using just one label and came up with yet another option (don't you just love MVD!).
Basically,
1.  use one label with an initial width of 0. 
2.  increase the width of the label by the width of each letter. 
The only proviso here is that you really need to use a mono-spaced font to get the correct effect.  But the code is very simple.
Another random idea I had was that you could convert your grifone.png image into a .gif.
Both of these are in the attachment (I put them in a discrete project rather than mess up your 'Tesina' project).
Regards,
Derek.

Post's attachments

Attachment icon spinning gryphon.zip 736.06 kb, 46 downloads since 2024-05-31 

Re: Image animation

Hello Derek and everyone else,
derek, your inspiration has given me new ideas. Thanks to your help, the essay will not only be original but also beautiful.
Thank you so much.

Re: Image animation

Good morning everyone,
I'm moving forward with this project for my son's thesis. For work reasons I had to slow down the project a bit but now time is running out.
In the attachment I put the project as far as I have arrived.
What I would like to understand is how I could make a loop that continues until a certain control reaches a certain distance from the edge.
If you look in the project, just click on the first button in the first form (frmSummary), I put some writing with a slide effect. The problem is that by changing the length of the writing you have to do many tests to understand how many times the cycle must be repeated. I'm afraid that this way I won't be able to finish in time, the rehearsals take up a lot of time.
I tried to do something like this but it doesn't work:

begin
vi := 0;    
for vi := 250  do
      begin
        frmStoria.label5.Visible := True;
        frmStoria.label5.left := frmStoria.label5.left - 5;
        application.processmessages;
      end;
    until frmStoria.label5.left := 5;
   end;

Thanks to all and bye

Post's attachments

Attachment icon Tesina.zip 637.51 kb, 33 downloads since 2024-06-19 

Re: Image animation

Hi,


procedure frmSommario_bStoria_OnClick (Sender: TObject; var Cancel: boolean);
var
 itArr: string='LA PRIMA RIVOLUZIONE INDUSTRIALE';
begin
  frmStoria.Label2.Left := frmStoria.Label2.Left + frmStoria.width;

// --- > what is stated above is the same for other Labels (3,4,5)

...

   begin
        frmStoria.label2.Visible := True;                  // Disabilitato nelle proprietà, visibile all'apertura del form
    repeat
        frmStoria.label2.left := frmStoria.label2.left - 10;
        application.processmessages;
        sleep(10);
    until frmStoria.label2.left < 7;

// ---> what is stated above is the same for other Labels (3,4,5)

// ---> Remove the code below for all Labels(2,3,4,5)


//    for vi := 0 to 80 do
//      begin
//        frmStoria.label2.Visible := True;                  // Disabilitato nelle proprietà, visibile all'apertura del form
//        frmStoria.label2.left := frmStoria.label2.left - 5;
//        application.processmessages;
//        sleep(1);
//        vi := vi + 1;
//      end;            }
    end;

32 (edited by sparrow 2024-06-19 18:21:19)

Re: Image animation

Example

Post's attachments

Attachment icon Tesina-Cop-Example.zip 602.52 kb, 42 downloads since 2024-06-19 

Re: Image animation

Hi sparrow,
I'm sorry, I'm only replying now but I had to work all day. Thank you very much, I understood the concept and I also thank you very much for the embellishments in the entry of the writings which I really appreciated.
Thank you so much, without you on the forum I wouldn't know what to do.

Re: Image animation

Hi Fabio


- Effects are separated into separate procedures. I hope this unifies and simplifies the writing of the program for you.
  Shown as an example of two forms.
- Implemented pause/continue (Space key) and skip action (ESC key). Shown using an example of an Intro and two forms.

Post's attachments

Attachment icon Tesina-Cop-Example1.zip 643.39 kb, 31 downloads since 2024-06-20 

Re: Image animation

Thanks sparrow,
I'll take a look at it now. In the meantime I have continued the program but I find myself in two situations that I cannot resolve.
The discussion is tomorrow morning sad

1) frmItaliano and frmStoria open without being colored blue like all the other windows

2) if I open any window and close it before the effects finish, then the main program (frmSommario) does not close. You have to close it with the task manager.

A thousand thanks.

Post's attachments

Attachment icon Tesina.zip 637.51 kb, 29 downloads since 2024-06-20 

Re: Image animation

Ciao Fabio, Привіт Sparrow,
In answer to Question 1, this is because lines 253-254 in your script are switching off 'styles' for those particular forms.

//  frmItaliano.styleelements := 0;
//  frmStoria.styleelements := 0;

If you comment them out, they should appear as all the others.
With regard to Question 2, do you want to stop the user from closing the form before the effects finish or is this permissible and you want to avoid having to use task manager to terminate the program?  (for me, it does actually terminate but there is a delay of a few seconds).
Regards,
Derek.

37 (edited by reteinformatica 2024-06-20 19:42:06)

Re: Image animation

Hi Derek and thanks for the reply. Unfortunately I didn't understand. I removed the bNext button, now the forms each open with their own frmSummary button. In this new version, which I attach, I have included the sparrow changes.

Post's attachments

Attachment icon Tesina.zip 637.51 kb, 26 downloads since 2024-06-20 

Re: Image animation

Hi Derek, Fabio


Fabio,
1. Yes, Derek wrote everything correctly.
  But I would still advise you to choose the background color yourself for all forms with effects and leave styleelements := 0 unchanged.
  This will significantly reduce flicker.
2. Yes, I know about this problem. Below I have attached a corrected version of the example.
3. For information. Using a value less than Sleep(10) does not make sense due to the nature of pascal.

Post's attachments

Attachment icon Tesina-Cop-Example2.zip 605.5 kb, 31 downloads since 2024-06-20 

Re: Image animation

the idea of advancing the writing one at a time or all together is fantastic. Unfortunately, however, I will never be able to understand how to do it and implement them for tomorrow morning. Still, it was wonderful. Thank you.

Re: Image animation

I was sure that you had already finished the project. It’s a pity that you delayed the implementation and you don’t have time left. (

Re: Image animation

Yes sparrow,
the idea was truly exceptional.
Forgive me but I still haven't figured out how to keep the program from crashing when I close it if I don't complete the effects in each window.

Re: Image animation

Above I gave my example2.

Show me your program and I'll try to help.

43 (edited by reteinformatica 2024-06-20 20:13:39)

Re: Image animation

Yes sparrow, I looked at the example but I don't understand what I need to change or add.
In the meantime I'm working on the small touches and the final lines, I'm more or less almost finished.

Post's attachments

Attachment icon Tesina.zip 637.51 kb, 29 downloads since 2024-06-20 

Re: Image animation

I'll show you a fragment.
For each form with effects (except Intro), in each loop you need to insert the line

if screen.activeform.name = 'frmSommario' then Exit;

between loop Begin ... End;
Try it on one form first

procedure frmSommario_bStoria_OnClick (Sender: TObject; var Cancel: boolean);
var
 itArr: string='LA PRIMA RIVOLUZIONE INDUSTRIALE';
begin
  frmStoria.Label1.Caption := '';
  frmStoria.doublebuffered := true;
  frmStoria.show;
  for vi := 0 to length(itArr) do
    begin
      sleep(100);
      frmStoria.Label1.Caption := frmStoria.Label1.Caption +(itArr[vi]);
      application.processmessages;
      sleep(10);
      if screen.activeform.name = 'frmSommario' then Exit;                        //   < ========================
      //frmItaliano.Label1.Caption := UpperCase(frmItaliano.Label1.Caption);
      //application.processmessages;
    end;

    begin
    frmStoria.imStoria.Visible:= true;                // Disabilitato nelle proprietà, visibile all'apertura del form
    frmStoria.imStoria.Height := 9;
      for vi := 1 to 150 do
        begin
          frmStoria.imStoria.Height := frmStoria.imStoria.Height +2;
          application.processmessages;
          sleep(10);
          if screen.activeform.name = 'frmSommario' then Exit;                   //   < ========================
        end;
     end;

. . .
. . .
. . .
End;

Re: Image animation

Yes it works. Thank you so much sparrow!!!!!!!

46 (edited by reteinformatica 2024-06-20 21:05:01)

Re: Image animation

Now I have another problem that I can't understand: the title "RINGRAZIAMENTI" of the frmRingraziamenti form doesn't want to go to the center. It may certainly be a trivial thing but now I'm completely at a loss. I've been experimenting for half an hour to understand why.

Post's attachments

Attachment icon Tesina.zip 637.51 kb, 26 downloads since 2024-06-20 

47 (edited by sparrow 2024-06-20 21:18:51)

Re: Image animation

Excuse me, but I don’t see what you’re describing.
On the frmRingraziamenti form there are two inscriptions that crawl onto the screen. But there is no title RINGRAZIAMENTI???
I get the impression that you are working with one project and are posting something completely different, and this is not the first time.

https://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=10534

Post's attachments

Attachment icon frm.jpg 10.4 kb, 15 downloads since 2024-06-20 

48 (edited by reteinformatica 2024-06-20 21:31:41)

Re: Image animation

Truly? Maybe I uploaded a copy of the copy, the one I attach now is correct. Among other things, I added "Label2" in frmRingraziamenti. If I put it justified on the right as it is now it's fine, but if I put it in the center it doesn't want to go there.

Post's attachments

Attachment icon Tesina.zip 637.51 kb, 31 downloads since 2024-06-20 

Re: Image animation

Try downloading and opening what you attached )))

50 (edited by reteinformatica 2024-06-20 21:52:29)

Re: Image animation

Yes you're right, I'm completely out of it now. This should be right.
Now I've discovered that the more I put Label2 in the center or on the right, the more it returns to the left by itself.

Post's attachments

Attachment icon Tesina.zip 637.51 kb, 31 downloads since 2024-06-20