build/loading-bar.js
function _inc() {
        if (_status() >= 1) {
          return;
        }

        var rnd = 0;

        // TODO: do this mathmatically instead of through conditions

        var stat = _status();
        if (stat >= 0 && stat < 0.25) {
          // Start out between 3 - 6% increments
          rnd = (Math.random() * (5 - 3 + 1) + 3) / 100;
        } else if (stat >= 0.25 && stat < 0.65) {
          // increment between 0 - 3%
          rnd = (Math.random() * 3) / 100;
        } else if (stat >= 0.65 && stat < 0.9) {
          // increment between 0 - 2%
          rnd = (Math.random() * 2) / 100;
        } else if (stat >= 0.9 && stat < 0.99) {
          // finally, increment it .5 %
          rnd = 0.005;
        } else {
          // after 99%, don't increment:
          rnd = 0;
        }

        var pct = _status() + rnd;
        _set(pct);
      }
function _inc() {
        if (_status() >= 1) {
          return;
        }

        var rnd = 0;

        // TODO: do this mathmatically instead of through conditions

        var stat = _status();
        if (stat >= 0 && stat < 0.25) {
          // Start out between 3 - 6% increments
          rnd = (Math.random() * (5 - 3 + 1) + 3) / 100;
        } else if (stat >= 0.25 && stat < 0.65) {
          // increment between 0 - 3%
          rnd = (Math.random() * 3) / 100;
        } else if (stat >= 0.65 && stat < 0.9) {
          // increment between 0 - 2%
          rnd = (Math.random() * 2) / 100;
        } else if (stat >= 0.9 && stat < 0.99) {
          // finally, increment it .5 %
          rnd = 0.005;
        } else {
          // after 99%, don't increment:
          rnd = 0;
        }

        var pct = _status() + rnd;
        _set(pct);
      }
function _inc ( ) { if ( _status ( ) >= 1 ) { return ; } var rnd = 0 ; // TODO: do this mathmatically instead of through conditions var stat = _status ( ) ; if ( stat >= 0 && stat < 0.25 ) { // Start out between 3 - 6% increments rnd = ( Math . random ( ) * ( 5 - 3 + 1 ) + 3 ) / 100 ; } else if ( stat >= 0.25 && stat < 0.65 ) { // increment between 0 - 3% rnd = ( Math . random ( ) * 3 ) / 100 ; } else if ( stat >= 0.65 && stat < 0.9 ) { // increment between 0 - 2% rnd = ( Math . random ( ) * 2 ) / 100 ; } else if ( stat >= 0.9 && stat < 0.99 ) { // finally, increment it .5 % rnd = 0.005 ; } else { // after 99%, don't increment: rnd = 0 ; } var pct = _status ( ) + rnd ; _set ( pct ) ; }
Increments the loading bar by a random amount
but slows down as it progresses
Increments the loading bar by a random amount but slows down as it progresses