Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Tutorial] Fade & Transparency in delphi application

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
The Numb3r
Newbie cheater
Reputation: 0

Joined: 14 Jul 2007
Posts: 12

PostPosted: Mon Jul 16, 2007 1:45 am    Post subject: [Tutorial] Fade & Transparency in delphi application Reply with quote

Made a couple of step-by-step guides for pretty cool effects in delphi application (Lol this is my first post).

Table of contests:
1. Fade In/Out
2. Transparency

1. Fade In/Out
Part 1, Fade Out.
Step 1.
You should see {$R *.DFM} after the implementation part.
Add this code after the {$R *.DFM}:
Code:
Procedure FadeOut;
begin
  MainForm.AlphaBlendValue:=200;
  Sleep(10);
  MainForm.AlphaBlendValue:=190;
  Sleep(10);
  MainForm.AlphaBlendValue:=180;
  Sleep(10);
  MainForm.AlphaBlendValue:=170;
  Sleep(10);
  MainForm.AlphaBlendValue:=160;
  Sleep(10);
  MainForm.AlphaBlendValue:=150;
  Sleep(10);
  MainForm.AlphaBlendValue:=140;
  Sleep(10);
  MainForm.AlphaBlendValue:=130;
  Sleep(10);
  MainForm.AlphaBlendValue:=120;
  Sleep(10);
  MainForm.AlphaBlendValue:=110;
  Sleep(10);
  MainForm.AlphaBlendValue:=100;
  Sleep(10);
  MainForm.AlphaBlendValue:=90;
  Sleep(10);
  MainForm.AlphaBlendValue:=80;
  Sleep(10);
  MainForm.AlphaBlendValue:=70;
  Sleep(10);
  MainForm.AlphaBlendValue:=60;
  Sleep(10);
  MainForm.AlphaBlendValue:=50;
  Sleep(10);
  MainForm.AlphaBlendValue:=40;
  Sleep(10);
  MainForm.AlphaBlendValue:=30;
  Sleep(10);
  MainForm.AlphaBlendValue:=20;
  Sleep(10);
  MainForm.AlphaBlendValue:=10;
  Sleep(10);
end;

Step 2.
Now click your application on any free spot.
Then look at object inspector and change the "AlphaBlend" to true.
Click the "events" tab.
Step 3.
There you should find something like OnCloseQuery. Double click it.
Then add this code between "begin" and "end;":
Code:
FadeOut;

Now we have Fade Out.
Part 2, Fade In.
Step 1.
Add this code under {$R *.DFM}:
Code:
Procedure FadeIn;
 MainForm.AlphaBlendValue:=10;
  Sleep(10);
  MainForm.AlphaBlendValue:=20;
  Sleep(10);
  MainForm.AlphaBlendValue:=30;
  Sleep(10);
  MainForm.AlphaBlendValue:=40;
  Sleep(10);
  MainForm.AlphaBlendValue:=50;
  Sleep(10);
  MainForm.AlphaBlendValue:=60;
  Sleep(10);
  MainForm.AlphaBlendValue:=70;
  Sleep(10);
  MainForm.AlphaBlendValue:=80;
  Sleep(10);
  MainForm.AlphaBlendValue:=90;
  Sleep(10);
  MainForm.AlphaBlendValue:=100;
  Sleep(10);
  MainForm.AlphaBlendValue:=110;
  Sleep(10);
  MainForm.AlphaBlendValue:=120;
  Sleep(10);
  MainForm.AlphaBlendValue:=130;
  Sleep(10);
  MainForm.AlphaBlendValue:=140;
  Sleep(10);
  MainForm.AlphaBlendValue:=150;
  Sleep(10);
  MainForm.AlphaBlendValue:=155;
  Sleep(10);
  MainForm.AlphaBlendvalue:=255

Part 2.
Then click the form. In object inspector go to events.
Doubleclick "OnActivate" and add code:
Code:
FadeIn;

Now we have fade in.

My result:
Code:
http : / / www . mediafire . com / ?5m1znmvlgfc


2. Transparency.
Click on the form.
Set AlphaBlend to true and AlphaBlendValue to 210.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Jul 16, 2007 1:55 am    Post subject: Reply with quote

Why not just make a nice loop to do the same thing except with about 9000 less lines?
Back to top
View user's profile Send private message
Iampro
Advanced Cheater
Reputation: 0

Joined: 07 Jun 2007
Posts: 89

PostPosted: Mon Jul 16, 2007 3:11 am    Post subject: Reply with quote

nice 1st post
Back to top
View user's profile Send private message
Kevin
Grandmaster Cheater Supreme
Reputation: 0

Joined: 07 Mar 2007
Posts: 1139
Location: Spiderman-World

PostPosted: Mon Jul 16, 2007 4:38 am    Post subject: Reply with quote

or make transparency set to true, transparency color to Fuschia (a almost never used color) and then set the forms background to Fuschia and place a image on it or something alike Razz

SimsAC is made that way, i also made several programs this way but never released any.

edit: nice tutorial Wink even though i knew that before.


Last edited by Kevin on Mon Jul 16, 2007 4:40 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
SolticeReign
Newbie cheater
Reputation: 0

Joined: 30 Jun 2007
Posts: 20

PostPosted: Mon Jul 16, 2007 4:39 am    Post subject: um Reply with quote

er, wat's delphi? and also the other things similar to it
_________________
Back to top
View user's profile Send private message
Kevin
Grandmaster Cheater Supreme
Reputation: 0

Joined: 07 Mar 2007
Posts: 1139
Location: Spiderman-World

PostPosted: Mon Jul 16, 2007 4:41 am    Post subject: Reply with quote

Delphi is a program, you use to make other programs. Like VB.

just uses OOP Pascal (not 100% sure its called that, dont remember)
Back to top
View user's profile Send private message MSN Messenger
Renkokuken
GO Moderator
Reputation: 4

Joined: 22 Oct 2006
Posts: 3249

PostPosted: Mon Jul 16, 2007 1:40 pm    Post subject: Reply with quote

Code:
Procedure Fadein;
Var i : Integer;
begin
  i:= 0;
      begin
        repeat
        inc(i);
        Mainform.AlphaBlendValue := i;
        until i = 255;
      end;
end;

Procedure Fadeout;
Var i : Integer;
begin
  i:= 255;
        repeat
        dec(i);
        Mainform.AlphaBlendValue := i;
        until i = 0;
      Application.Terminate;
end;


My old versions. Better, doesn't skip transparency and smoothly travels through all 255 values.
Fadeout will terminate when completed, remove it if you don't like it.

1. 2 Timers with the events will be called when the form is activated, make them enabled on formshow, disabled afterwards.

2. Just fadein; on Form activate, fadeout; on close.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Jul 16, 2007 4:20 pm    Post subject: Reply with quote

renko your code wouldn't compile for me...

so i rewrote it using while()do statement and its much more effecient

Code:
Procedure FadeIn;
Var
i : Integer;
begin
i := 0;
  while( i <255) do
  begin
  inc(i);
  Form1.AlphaBlendValue := i;
  end;
end;

Procedure FadeOut;
Var
i : Integer;
begin
i := 255;
  while(i > 0) do
  begin
    dec(i);
    Form1.AlphaBlendValue := i;
  end;
end;



if you put that in you'll notice the form loads then goes back to transparent and does the procedure.

So i figured set Form1.AlphaBlendValue := 0; in the formcreate function


Edit:
my bad, i iddnt c/p the code i typed it in to get a better feel of it. I left out repeat...lmao

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites