Skip to content

Commit 04403e6

Browse files
author
liply
committed
original design progress bar!
1 parent 45f3b20 commit 04403e6

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

js/rpg_core/Graphics.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,19 @@ Graphics.startLoading = function() {
255255
};
256256

257257
Graphics._setupProgress = function(){
258-
this._progressElement = document.createElement('progress');
258+
this._progressElement = document.createElement('div');
259259
this._progressElement.id = 'loading-progress';
260-
this._progressElement.max = 100;
261-
this._progressElement.value = 0;
260+
this._progressElement.style.width = '200px';
261+
this._progressElement.style.height = '30px';
262+
this._progressElement.style.backgroundColor = 'gray';
263+
264+
this._barElement = document.createElement('div');
265+
this._barElement.id = 'loading-bar';
266+
this._barElement.style.width = '1%';
267+
this._barElement.style.height = '30px';
268+
this._barElement.style.backgroundColor = 'green';
269+
270+
this._progressElement.appendChild(this._barElement);
262271

263272
document.body.appendChild(this._progressElement);
264273
};
@@ -273,17 +282,20 @@ Graphics._hideProgress = function(){
273282
};
274283

275284
Graphics._updateProgressCount = function(countLoaded, countLoading){
285+
var progressValue;
276286
if(countLoading !== 0){
277-
this._progressElement.value = (countLoaded/countLoading) * 100;
287+
progressValue = (countLoaded/countLoading) * 100;
278288
}else{
279-
this._progressElement.value = 100;
289+
progressValue = 100;
280290
}
291+
292+
this._barElement.style.width = progressValue + '%';
281293
};
282294

283295
Graphics._updateProgress = function(){
284296
this._progressElement.style.zIndex = 99;
285297
this._centerElement(this._progressElement);
286-
this._progressElement.style.bottom = '-100px';
298+
this._progressElement.style.marginTop = '400px';
287299
};
288300

289301
/**

0 commit comments

Comments
 (0)