#PHP, 90 83 80 78 77 Bytes
PHP, 90 83 80 78 77 Bytes
77:
The closing ;
is not needed.
for(;$i<101;usleep(rand(1,75e4)))echo"\rloading ",'-\|/'[$i%4],' ',$i+++0,'%'
78:
While looking for another workaround to get a 0 initially without initializing the variable I came up with this:
for(;$i<101;usleep(rand(1,75e4)))echo"\rloading ",'-\|/'[$i%4],' ',$i+++0,'%';
Changed back to echo to win a few bytes as I only used printf to force-format as int. By incrementing the incremented $i with 0 I get a valid integer. By using single quotes as string delimiter the backslash does not need to be escaped, resulting in another byte freed
80:
Moving the increment of $i from the last for-section to the prinf gave me another 3 off. (See comments below)
for(;$i<101;usleep(rand(1,75e4)))printf("\rloading %s %d%%","-\\|/"[$i%4],$i++);
83:
Removed init of a variable with the loaderstates.
for(;$i<101;usleep(rand(1,75e4)),$i++)printf("\rloading %s %d%%","-\\|/"[$i%4],$i);
90:
I tried removing the init of $i to gain some bytes, as I had to add quite a few to enable the loader animation. printf adds 2 as opposed to echo, but formatting NULL as an integer results in 0.
for($l='-\|/';$i<101;usleep(rand(0,750)*1e3),$i++)printf("\rloading %s %d%%",$l[$i%4],$i);