~feng-kylin/youker-assistant/youker-assistant

« back to all changes in this revision

Viewing changes to backends/youker-assistant-daemon/data/beautify/plymouth/ubuntukylin-logo/ubuntukylin-logo.script

  • Committer: lixiang
  • Date: 2018-03-06 03:13:06 UTC
  • Revision ID: lixiang@kylinos.cn-20180306031306-fd7qnru3vm4a1xjd
Rewrite with Qt5, and add system monitor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2014 National University of Defense Technology(NUDT) & Kylin Ltd.
3
 
 *
4
 
 * Authors:
5
 
 *      Zhang Chao      zhangchao@ubuntukylin.com
6
 
 *
7
 
 * This program is free software; you can redistribute it and/or modify
8
 
 * it under the terms of the GNU General Public License as published by
9
 
 * the Free Software Foundation; version 3.
10
 
 *
11
 
 * This program is distributed in the hope that it will be useful,
12
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 * GNU General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
 */
19
 
//背景
20
 
 
21
 
Window.SetBackgroundTopColor (0, 0, 0);           
22
 
Window.SetBackgroundBottomColor (0, 0, 0); 
23
 
//
24
 
left_1_image = Image("left_1.png");
25
 
resized_left_1_image = left_1_image.Scale(Window.GetWidth(), Window.GetWidth()*left_1_image.GetHeight()/left_1_image.GetWidth());
26
 
left_1_sprite = Sprite();
27
 
left_1_sprite.SetImage(resized_left_1_image);
28
 
left_1_sprite.SetX(0); 
29
 
left_1_sprite.SetY(Window.GetHeight() / 2 - resized_left_1_image.GetHeight() / 2);
30
 
left_1_sprite.SetZ(98);
31
 
left_1_sprite.SetOpacity(0);
32
 
 
33
 
left_2_image = Image("left_2.png");
34
 
resized_left_2_image = left_2_image.Scale(Window.GetWidth(), Window.GetWidth()*left_2_image.GetHeight()/left_2_image.GetWidth());
35
 
left_2_sprite = Sprite();
36
 
left_2_sprite.SetImage(resized_left_2_image);
37
 
left_2_sprite.SetX(0); 
38
 
left_2_sprite.SetY(Window.GetHeight() / 2 - resized_left_2_image.GetHeight() / 2);
39
 
left_2_sprite.SetZ(98);
40
 
left_2_sprite.SetOpacity(1);
41
 
 
42
 
xx_h=resized_left_1_image.GetHeight()-50;
43
 
xx_y=Window.GetHeight() / 2 - xx_h / 2;
44
 
 
45
 
xx_w=resized_left_1_image.GetWidth()-200;
46
 
xx_x=Window.GetWidth() / 2 - xx_w / 2;
47
 
 
48
 
all_1_image = Image("all_1.png");
49
 
resized_all_1_image = all_1_image.Scale(Window.GetWidth(), Window.GetWidth()*all_1_image.GetHeight()/all_1_image.GetWidth());
50
 
all_1_sprite = Sprite();
51
 
all_1_sprite.SetImage(resized_all_1_image);
52
 
all_1_sprite.SetX(0); 
53
 
all_1_sprite.SetY(Window.GetHeight() / 2 - resized_all_1_image.GetHeight() / 2);
54
 
all_1_sprite.SetZ(102);
55
 
all_1_sprite.SetOpacity(0);
56
 
 
57
 
all_2_image = Image("all_2.png");
58
 
resized_all_2_image = all_2_image.Scale(Window.GetWidth(), Window.GetWidth()*all_2_image.GetHeight()/all_2_image.GetWidth());
59
 
all_2_sprite = Sprite();
60
 
all_2_sprite.SetImage(resized_all_2_image);
61
 
all_2_sprite.SetX(0); 
62
 
all_2_sprite.SetY(Window.GetHeight() / 2 - resized_all_2_image.GetHeight() / 2);
63
 
all_2_sprite.SetZ(103);
64
 
all_2_sprite.SetOpacity(0);
65
 
 
66
 
all1_1_image = Image("all1_1.png");
67
 
resized_all1_1_image = all1_1_image.Scale(Window.GetWidth(), Window.GetWidth()*all1_1_image.GetHeight()/all1_1_image.GetWidth());
68
 
all1_1_sprite = Sprite();
69
 
all1_1_sprite.SetImage(resized_all1_1_image);
70
 
all1_1_sprite.SetX(0); 
71
 
all1_1_sprite.SetY(Window.GetHeight() / 2 - resized_all1_1_image.GetHeight() / 2);
72
 
all1_1_sprite.SetZ(101);
73
 
all1_1_sprite.SetOpacity(0);
74
 
 
75
 
all1_2_image = Image("all1_2.png");
76
 
resized_all1_2_image = all1_2_image.Scale(Window.GetWidth(), Window.GetWidth()*all1_2_image.GetHeight()/all1_2_image.GetWidth());
77
 
all1_2_sprite = Sprite();
78
 
all1_2_sprite.SetImage(resized_all1_2_image);
79
 
all1_2_sprite.SetX(0); 
80
 
all1_2_sprite.SetY(Window.GetHeight() / 2 - resized_all1_2_image.GetHeight() / 2);
81
 
all1_2_sprite.SetZ(100);
82
 
all1_2_sprite.SetOpacity(0);
83
 
//文字
84
 
text_image = Image("text.png");
85
 
resized_text_image = text_image.Scale(Window.GetWidth(), Window.GetWidth()*text_image.GetHeight()/text_image.GetWidth());
86
 
text_sprite = Sprite();
87
 
text_sprite.SetImage(resized_text_image);
88
 
text_sprite.SetX(0); 
89
 
text_sprite.SetY(Window.GetHeight() / 2 - resized_text_image.GetHeight() / 2);
90
 
text_sprite.SetZ(106);
91
 
text_sprite.SetOpacity(0);
92
 
 
93
 
 
94
 
xx_image = Image("xx.png");
95
 
xx1_image = Image("xx1.png");
96
 
xx2_image = Image("xx2.png");
97
 
xx3_image = Image("xx3.png");
98
 
xxnum=15;
99
 
for(i=0;i<xxnum;i++){
100
 
  xx_sprite[i]=Sprite(xx_image);
101
 
  xx_sprite[i].SetOpacity(0);
102
 
  xx_sprite[i].SetZ(105);
103
 
  xx1_sprite[i]=Sprite(xx1_image);
104
 
  xx1_sprite[i].SetOpacity(0);
105
 
  xx1_sprite[i].SetZ(105);
106
 
  xx2_sprite[i]=Sprite(xx2_image);
107
 
  xx2_sprite[i].SetOpacity(0);
108
 
  xx2_sprite[i].SetZ(105);
109
 
  xx3_sprite[i]=Sprite(xx3_image);
110
 
  xx3_sprite[i].SetOpacity(0);
111
 
  xx3_sprite[i].SetZ(105);
112
 
}
113
 
 
114
 
progress = 0;
115
 
star_progress=0;
116
 
 
117
 
 
118
 
 
119
 
 
120
 
fun refresh_callback ()
121
 
  {
122
 
    # Currently we do nothing here
123
 
   
124
 
    if(progress < 157){
125
 
    left_1_sprite.SetOpacity(Math.Sin(progress/50));
126
 
    left_2_sprite.SetOpacity(1-Math.Sin(progress/50));
127
 
    text_sprite.SetOpacity(progress/157);
128
 
}else{
129
 
    left_1_sprite.SetOpacity(0);
130
 
    left_2_sprite.SetOpacity(0);
131
 
    }
132
 
    if(progress > 50){
133
 
    all1_1_Opacity=(progress-50)%314;
134
 
    all1_1_sprite.SetOpacity(Math.Sin(all1_1_Opacity/100));
135
 
    }
136
 
    if(progress > 127){
137
 
    all1_2_Opacity=progress%78;
138
 
    all1_2_sprite.SetOpacity(Math.Sin(all1_2_Opacity/25));
139
 
    }
140
 
    if(progress > 78){
141
 
    all_1_Opacity=(progress-78)%157;
142
 
    all_1_sprite.SetOpacity(Math.Sin(all_1_Opacity/50));
143
 
    }
144
 
    if(progress > 157){
145
 
    all_2_Opacity=progress%157;
146
 
    all_2_sprite.SetOpacity(Math.Sin(all_2_Opacity/50));
147
 
    }
148
 
    
149
 
 
150
 
    
151
 
 
152
 
    if(star_progress < 800){
153
 
        if(star_progress%40==0){
154
 
        xx_sprite[star_progress/40].SetX(Math.Int(Math.Random(10)*xx_w+xx_x));
155
 
        xx_sprite[star_progress/40].SetY(Math.Int(Math.Random(10)*xx_h+xx_y));
156
 
        xx1_sprite[star_progress/40].SetX(Math.Int(Math.Random(10)*Window.GetWidth()));
157
 
        xx1_sprite[star_progress/40].SetY(Math.Int(Math.Random(10)*Window.GetHeight()));
158
 
        xx2_sprite[star_progress/40].SetX(Math.Int(Math.Random(10)*Window.GetWidth()));
159
 
        xx2_sprite[star_progress/40].SetY(Math.Int(Math.Random(10)*Window.GetHeight()));
160
 
        xx3_sprite[star_progress/40].SetX(Math.Int(Math.Random(10)*Window.GetWidth()));
161
 
        xx3_sprite[star_progress/40].SetY(Math.Int(Math.Random(10)*Window.GetHeight()));
162
 
        }
163
 
        xx_sprite[Math.Int(star_progress/40)].SetOpacity((progress%40)/40);
164
 
        xx1_sprite[Math.Int(star_progress/40)].SetOpacity((progress%40)/40);
165
 
        xx2_sprite[Math.Int(star_progress/40)].SetOpacity((progress%40)/40);
166
 
        xx3_sprite[Math.Int(star_progress/40)].SetOpacity((progress%40)/40);
167
 
    }else{
168
 
        if(star_progress%80 < 40){
169
 
        xx_sprite[Math.Int(star_progress/80)% 20].SetOpacity(1-(progress%80)/40);
170
 
        xx1_sprite[Math.Int(star_progress/80)% 20].SetOpacity(1-(progress%80)/40);
171
 
        xx2_sprite[Math.Int(star_progress/80)% 20].SetOpacity(1-(progress%80)/40);
172
 
        xx3_sprite[Math.Int(star_progress/80)% 20].SetOpacity(1-(progress%80)/40);
173
 
        }else{
174
 
           if(star_progress%80==40){
175
 
                xx_sprite[Math.Int(star_progress/80)% 20].SetX(Math.Int(Math.Random(10)*xx_w+xx_x));
176
 
                xx_sprite[Math.Int(star_progress/80)% 20].SetY(Math.Int(Math.Random(10)*xx_h+xx_y));
177
 
                xx1_sprite[Math.Int(star_progress/80)% 20].SetX(Math.Int(Math.Random(10)*Window.GetWidth()));
178
 
                xx1_sprite[Math.Int(star_progress/80)% 20].SetY(Math.Int(Math.Random(10)*Window.GetHeight()));
179
 
                xx2_sprite[Math.Int(star_progress/80)% 20].SetX(Math.Int(Math.Random(10)*Window.GetWidth()));
180
 
                xx2_sprite[Math.Int(star_progress/80)% 20].SetY(Math.Int(Math.Random(10)*Window.GetHeight()));
181
 
                xx3_sprite[Math.Int(star_progress/80)% 20].SetX(Math.Int(Math.Random(10)*Window.GetWidth()));
182
 
                xx3_sprite[Math.Int(star_progress/80)% 20].SetY(Math.Int(Math.Random(10)*Window.GetHeight()));
183
 
           }
184
 
           xx_sprite[Math.Int(star_progress/80)% 20].SetOpacity((progress%80)/40);
185
 
           xx1_sprite[Math.Int(star_progress/80)% 20].SetOpacity((progress%80)/40);
186
 
           xx2_sprite[Math.Int(star_progress/80)% 20].SetOpacity((progress%80)/40);
187
 
           xx3_sprite[Math.Int(star_progress/80)% 20].SetOpacity((progress%80)/40);
188
 
        }
189
 
    }
190
 
 progress+=2;
191
 
star_progress+=20; 
192
 
 
193
 
 }
194
 
 
195
 
  
196
 
Plymouth.SetRefreshFunction (refresh_callback);
197
 
 
198
 
 
199
 
 
200
 
#----------------------------------------- Progress Bar --------------------------------
201
 
 
202
 
 
203
 
fun progress_callback (duration, progress)
204
 
  {
205
 
    
206
 
  }
207
 
 
208
 
Plymouth.SetBootProgressFunction(progress_callback);
209
 
 
210
 
#----------------------------------------- Quit --------------------------------
211
 
 
212
 
fun quit_callback ()
213
 
{
214
 
}
215
 
 
216
 
Plymouth.SetQuitFunction(quit_callback);
217
 
 
218