Improve stats slow
This commit is contained in:
parent
22573bd1b5
commit
e256774c85
1 changed files with 5 additions and 4 deletions
|
@ -49,16 +49,17 @@ $(function() {
|
|||
});
|
||||
|
||||
function showStatistic(elementStatistic, amount, timeout) {
|
||||
const duration = 2000;
|
||||
const duration = 2000;
|
||||
const intervalInitial = 42;
|
||||
|
||||
var interval = 42;
|
||||
var interval = intervalInitial;
|
||||
var value = 0;
|
||||
var percent = 0;
|
||||
var increment = 1;
|
||||
|
||||
setTimeout(
|
||||
function count() {
|
||||
increment = amount / duration * interval;
|
||||
increment = amount / duration * intervalInitial;
|
||||
|
||||
if (value + increment < amount) {
|
||||
value = value + increment;
|
||||
|
@ -72,7 +73,7 @@ function showStatistic(elementStatistic, amount, timeout) {
|
|||
|
||||
percent = value / amount * 100;
|
||||
|
||||
if (percent >= 60) {
|
||||
if (percent >= 80) {
|
||||
interval = interval * 1.4;
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue