-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathBlankBG.pas
144 lines (111 loc) · 2.86 KB
/
BlankBG.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
unit BlankBG;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Cod.Visual.Button, Vcl.Imaging.pngimage,
Cod.Visual.Image, Vcl.ExtCtrls, Math, Cod.Animations, SetupUnit,
Cod.Visual.GlassBlur;
type
TBackdrop = class(TForm)
Logo: CImage;
AnimFade: TTimer;
TheBackground: CImage;
BackInit: TTimer;
FinalFade: TTimer;
AeroBlurGlass: CGlassBlur;
procedure FormCreate(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure AnimFadeTimer(Sender: TObject);
procedure BackInitTimer(Sender: TObject);
procedure FinalFadeTimer(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
{ Private declarations }
public
{ Public declarations }
procedure RecenterLogo;
procedure InitiateBackground;
end;
const
TOTAL_STEP = 255;
START_STEP = 200;
var
Backdrop: TBackdrop;
TheAnim: integer;
MaxSize: integer;
implementation
{$R *.dfm}
procedure TBackdrop.AnimFadeTimer(Sender: TObject);
begin
Inc(TheAnim);
Logo.Opacity := round(((TheAnim - START_STEP) / (TOTAL_STEP - START_STEP)) * 255);
Logo.Width := trunc( Power( MaxSize, TheAnim / TOTAL_STEP) );
Logo.Height := Logo.Width;
RecenterLogo;
if TheAnim >= TOTAL_STEP then
begin
AnimFade.Enabled := false;
BackInit.Enabled := true;
end;
end;
procedure TBackdrop.BackInitTimer(Sender: TObject);
begin
InitiateBackground;
BackInit.Enabled := false;
end;
procedure TBackdrop.FinalFadeTimer(Sender: TObject);
begin
Dec(TheAnim);
AlphaBlendValue := trunc((TheAnim / 100) * 255);
if TheAnim <= 0 then
begin
FinalFade.Enabled := true;
Application.MainForm.Close;
end;
end;
procedure TBackdrop.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if Setup.Visible or Setup.StartAttention.Enabled or AnimFade.Enabled then
CanClose := false;
end;
procedure TBackdrop.FormCreate(Sender: TObject);
begin
TheAnim := START_STEP;
MaxSize := round(Height / 2.2);
Logo.Width := 1;
Logo.Height := 1;
end;
procedure TBackdrop.FormResize(Sender: TObject);
begin
RecenterLogo;
end;
procedure TBackdrop.InitiateBackground;
var
Anim: TIntAni;
begin
// Background
TheBackground.BringToFront;
TheBackground.Opacity := 0;
TheBackground.Show;
Anim := TIntAni.Create;
Anim.Duration := 10;
Anim.Step := 10;
Anim.AniKind := akIn;
Anim.AniFunctionKind := afkExpo;
Anim.StartValue := 0;
Anim.DeltaValue := 255;
Anim.OnSync := procedure(Value: integer)
begin
TheBackground.Opacity := Value;
end;
Anim.FreeOnTerminate := true;
Anim.Start;
// Initate 2nd Form
Setup.PrepareForm(false);
end;
procedure TBackdrop.RecenterLogo;
begin
Logo.Left := Width div 2 - Logo.Width div 2;
Logo.Top := Height div 2 - Logo.Height div 2;
end;
end.