text:
Loading... Forever
Your challenge is to make an infinite loading screen, that looks like this:

Or, to be more specific:

Take no input.
Output Loading..., with a trailing space, but no trailing newline.
Infinitely cycle through the chars |, /, - and \: every 0.25 seconds, overwrite the last one with the next in the sequence. You can overwrite just the last character, or delete and rewrite the whole line, as long Loading... remains unchanged.

Rules

The output text must look exactly as specified. Trailing newlines/spaces are acceptable.
You should not wait 0.25 seconds before initially showing output - the first frame should be printed as soon as the program is run.
Your program should be able to run indefinitely. For example, if you use a counter for frames, the counter should never cause an error by exceeding the maximum in your language.
Although the waiting period between each "frame" should be 0.25 seconds, obviously this will never be exact - an error margin of 10% or so is allowed.
You may submit a function, but it must print to stdout.
You can submit an answer in a non-console (but still text-based) environment, as long as it is capable of producing the loading animation.
This is code-golf, so the shortest solution (in bytes) wins. Standard code-golf loopholes apply.
If possible, please provide a gif of your loading screen in action.

Example
Here is the C++ code I used to create the example (ungolfed):
#include <iostream>
#include <string>
#include <thread>

using namespace std;

int main() {
    string cycle = "|/-\\";
    int i = 0;

    cout << "Loading... ";

    while (true) {
        // Print current character
        cout << cycle[i];

        // Sleep for 0.25 seconds
        this_thread::sleep_for(chrono::milliseconds(250));

        // Delete last character, then increase counter.
        cout << "\b";
        i = ++i % 4;
    }
}

May the best golfer win!

Can submissions wait 0.25 seconds before initially displaying output?

No, but thanks for mentioning that, I'll add it to the rules @ETHproductions

Is a trailing newline (after the animating symbol) acceptable?

Of course :) @Copper

@FlpTkc what if you have the slowest language ever?

@DestructibleWatermelon as long as somewhere in your code there is something like sleep( 1/4 ), i.e. your algorithm is correct, the amount of time that the other operations take isn't overly relevant, as long as the animation will actually run. Or, get a faster language :P

I was just thinking really hard, why your example program prints \ two times in a row. :)

@raznagul you need the double backslash, otherwise C++ thinks  I'm trying to use a control character :P

I didn't know characters could be deleted from the console once printed. Is \b cross-platform\language? I tried printing (print "Hello\bWorld") in a Clojure REPL, and it printed a garbage character for the backspace.

Nvm. It has to be running in a windows console, not a REPL, to work.

For non-stdout implementations, does the font have to be monospace?

@penne12 No, you can use the default font

May I substitute — for -?

@Adám yes, that's acceptable - sorry for the late reply.

Can we start at any position in the animation?

Yes, as long as you cycle through the right characters @Titus

Does "run forever" mean the CS sense (where the halting problem comes into play), or just run forever normally?

@TheBitByte it means that, theoretically, nothing inside your program will cause it to error - such as a counter overflowing or reaching maximum recursion depth.

Could you add a scoreboard/leader board snippet?

HTML/CSS, 183 180 163 161 160 147 143 bytes

a{display:inline-flex;overflow:hidden;width:1ch}c{animation:c 1s steps(4)infinite}@keyframes c{to{margin:0-4ch

Loading... <c>|/-\

Edit: Saved 3 bytes thanks to @betseg. Saved 17 bytes thanks to @manatwork. Saved 1 byte thanks to @Daniel. Saved 13 bytes thanks to @Ismael Miguel. Saved 4 bytes thanks to @Fez Vrasta.

According to meta, CSS+HTML is fine for answering questions. Furthermore I allowed this in the challenge description. So this answer is perfectly valid :)

HTML+CSS is TC, so I don't see why it might be non-competing

@TùxCräftîñg CSS is definitely not turing complete as you can solve the halting problem in it (If there is no infinite animation, it halts). I think the same applies for HTML (If you don't include JS).

@Artyer http://stackoverflow.com/a/5239256/3273184 is something worth considering.

@MamaFunRoll A comment on that post mentions that that doesn't really prove it TC because it can't loop without user intervention. However, it can solve this particular challenge, so I don't see any problem with this answer.

@Neil you can remove last two braces and last semicolon in c to save three bytes.

@betseg Bah, how did I overlook that semicolon? Thanks!

Has the c tag default margin in any browser? If not, margin:0 instead of setting only margin-left will make no difference.

@manatwork I didn't realise that I could animate margin-left that way, thanks!

@Neil, now that you formulated it that way… The entire 0% frame definition seems unnecessary in Firefox and Chrome.

Holy cow, this almost has more upvotes than the question itself!

You can replace display:inline-block with display:inline-flex and save a byte :)

I improved upon this answer a while ago with 132 bytes: http://codegolf.stackexchange.com/a/101315/47097

It seems that Google Chrome is happy without vertical-align: top;. Probably isn't required since you're using display: inline-flex;, which automatically aligns on top. You can try it here: https://jsfiddle.net/vw2e7y0w/

@IsmaelMiguel Huh, must be a Firefox bug I guess...

@Neil As long as you can replicate it in one environment, it is a valid answer. An example would be this: http://codegolf.stackexchange.com/a/61126/14732 (only works on a very specific version of a specific environment)

@IsmaelMiguel Sure, but I only use Firefox, and I don't really want to log in to Stack Overflow in another browser just for this one question.

@Neil You could try the jsfiddle. I've quickly tested and using  instead of
 works on Firefox, but breaks the animation on Google Chrome.

@IsmaelMiguel Adding
 fixes it for me on Firefox, it must be parsing the DOM differently I guess...

@Neil Probably is. But don't forget to mention that it only works on Google Chrome. Mentioning the 2 possible fixes may could help too. But I'm not sure about that.

@IsmaelMiguel Ah, it's an SO bug - they send extra content to Firefox which breaks the snippet. Sigh...

It's a huge shame that you have to use
. Maybe there's a tag closing (like
) that can fix the issue?

@IsmaelMiguel Seems to just make things worse, sorry.

It does. The only that fixed it was
 but that is 1 byte longer.

You can also use margin:0 -4ch to save 4 LOC

Ohh. So that's partially how you make custom tags.

Vim, 43, 41 bytes
qqSLoading... |<esc>:sl250m
r/@:r-@:r\@:@qq@q

Two bytes saved thanks to @Udioica!
Here's a (slightly outdated) animation of it happening in real time!

And here is an explanation:
qq                              " Start recording into register 'q'
  SLoading... |<esc>            " Replace all of the text in the buffer with 'Loading... |'
                    :sl250m     " Sleep for 250 ms
r/                              " Replace the bar with a slash
  @:                            " Re-run the last ex command (sleeping)
    r-                          " Replace the slash with a dash
      @:                        " Re-run the last ex command (sleeping)
        r\                      " Replace the dash with a backslash
          @:                    " Re-run the last ex command (sleeping)
            @q                  " Run macro 'q' (the one we're recording)
              q                 " Stop recording
               @q               " Call macro 'q', which will run forever because it's recursive

just curios: does it violate "Your program should be able to run indefinitely"? can it eventually reach a stack overflow? :)

@dahnoak Well, obviously I can't infinitely test it, but it doesn't allocate any extra memory, so I can't see any reason it wouldn't work indefinitely.

If you switch i to S and move it inside the macro, you can skip r|.

@dahnoak There is no reason why the vi engine couldn't notice the tail recursion.  And some implementations of recursion would do so naturally (imagine if there is a vector of commands to-be-executed, and a current execution location.  Then @q would insert at-current-location the contents of register script q.  No stack needed, and no memory allocated unless there are commands to run after @q within q.)

Almost every time you post an answer to a challenge, I learn something new (in this case, @: and :sl), so thanks and keep them coming :)

@ChristianRondeau I'm glad you like it, but IMO this is the more impressive answer . :D

HTML + JS (ES6), 20 + 51 50 = 70 bytes

setInterval(_=>a.innerHTML='|/-\\'[i=-~i%4],i=250)
Loading... -

-1 byte (Zachary T)
Check out my 132 byte HTML/CSS answer as well.

Might that overflow i?

Yes, it eventually would. Fixed that!

Am I mistaken, or do you not need the ,i?

It's necessary. i++%=4 doesn't work because both ++ and %= perform assignments, and you can only have one assignment operator at a time.

Could you replace i++,i%=4 with i=-~i%4 for a byte?

Most definitely.

You can use a string as the argument to setInterval

Shouldn’t the HTML contain a
? The other HTML answer did include it.

@jrich Good tip, but wrapping it in another string doesn't play well with the escaped backslash: setInterval("a.innerHTML\n='|/-\\\\'[i=-~i%4]",i=250).

@Xufox The
 only ensured a monospaced font was used so that ch units would work. The rules don't mention anything about the font family used. ;)

If I am not mistaken, the first character printed by JS will be the last one in the string; so you should init with - instead of /. Or init with | and loop through '-\\|/'. Nice increment though.

@Titus Good catch, updated!

Windows Batch, 121 114 84 80 79 78 bytes
Just throwing this out for fun.
for %%b in (/ - \ ^|)do (cls
@echo Loading... %%b
ping 1.1 -n 1 -w 250>nul)
%0

I was not able to assign pipe (|) into the array, so I had to manually add it with another assignment. The delay is done with PING, which might not be accurate.
Output:

Edit:

Thanks to Roman Gräf for saving 7 bytes!
Thanks to Neil for saving 30 bytes! I have also mangled it a bit more to save bytes on the newlines.
Thanks to phyrfox for saving 4 bytes!
Thanks to YourDeathIsComing for saving 2 bytes!

You can remove @echo off and put an @ in front of  every set or echo command

You don't need the array, in (/ - \ ^|) works. Also, %0 is a shorter way to loop than goto.

Thanks @Neil! The array notation really helped. Also, I was unsure with how I used %0 here. Is it correct?

Yes, that looks right.

You should be able to use the IP address "1.1" (-4 bytes), because most platforms will auto-expand that to 1.0.0.1 for you.

You can save 1 byte by removing the space in front of >nul.

@YourDeathIsComing d'oh! I tried it before, but had thought that only 250 would be directed to null. Thanks!

You should also be able to remove the space in front of  do.

@YourDeathIsComing cmd seems to complain about it. http://imgur.com/a/wEkFw

I meant the space before it, not after it.

It seems that ping a -n 1 -w 250>nul also works. This tries to ping the host //a, which doesnt exist. I tried it with a 2500ms delay instead, and the delay happened. I've tested on Windows 7. With this, you can save 2 bytes.

@IsmaelMiguel it seems to be a lot slower than 250ms. Here's a webm of ping 1.1, ping a and the accepted answer. https://webmshare.com/omWXQ

Using ping . -n 1 -w>nul seems to give a delay of around 200-300ms. But that's visually, and I don't know how to time it on the CMD. But you were right, my version is slower than 250ms. It seems to be around 3-4s

golfed 1 byte off: ping/n 1 1.1 -w 250>nul

Can a batch script run indefinitely if it calls itself (%0 instead of goto somewhere)?

Node, 72 70 bytes
f=i=>console.log('\x1BcLoading... '+'|/-\\'[setTimeout(f,250,i=-~i%4),i])

Replace \x1B with the literal escape character to get the correct byte count. Call f() to start the animation. Here's how it looks in the ConEmu terminal emulator on my computer:

Try using \033c (replace \033 with its actual char representation). It doesn't look as good, but it saves you some bytes.

Won't i overflow?

@ZacharyT It will after 71 million years, but I can fix that if necessary

"Your program should be able to run indefinitely. For example, if you use a counter for frames, the counter should never cause an error by exceeding the maximum in your language.", yes, it's necessary.

@ZacharyT OK, fixed.

@MamaFunRoll Thanks, that saves two bytes!

When running your code on d8 (instead of node), you could use print instead of console.log and save 6 bytes.

@Florent But then it wouldn't run on Node ;-)

Pyth, 31 bytes
Wm,p+"\rLoading... "d.d.25"|/-\

Interpreter here.

Explanation
Wm,p+"\rLoading... "d.d.25"|/-\
    +"\rLoading... "d              Concatenate the string "\rLoading... " and the variable d
   p                               Print the result without a newline
                     .d.25         Sleep for 0.25 seconds
  ,                                Form a two-element list with the results of the two statements above. This is only needed to execute both statements in a single lambda function.
 m                        "|/-\    Map the above statement over the characters in the string "|/-\", setting the variable d to the character for each iteration
W                                  While the result of the map statement is true, do nothing

Kotlin, 67 66 bytes
while(1>0)"|/-\\".map{print("\rLoading... $it");Thread.sleep(250)}

Fairly self explanatory, using \r to clear the line and taking advantage of Kotlin's awesome string interpolation.
EDIT: Saved 1 byte thanks to @mEQ5aNLrK3lqs3kfSa5HbvsTWe0nIu by changing while(true) to while(1>0)

You could save one byte by using while(1>0) instead of while(true) (-1) & probably should include the actual function syntax in your answer (fun a(){}, +9). If you wanna be a bit cheaty, you could use store a function as a variable (val a={}, +8).

@mEQ5aNLrK3lqs3kfSa5HbvsTWe0nIu Is 'full program' mode not acceptable? This can be run as a Kotlin script .kts without class or function definitions.
Also, great call with while(1>0)!

But what if, one day, 0 becomes greater than 1???? :P

Great idea of using Kotlin script.
@Flp.Tkc Your comment reminded me of this: http://codegolf.stackexchange.com/a/101131/62024. Still shuddering that this is possible.

@TylerMacDonell Really? I didn't know you could run kotlin directly as a script. Thanks for the info.

Not familiar with this, but wouldnt while(1) be shorter? Or doesnt this work?

@Gerrit Luimstra Doesn't work in Kotlin, must be a Boolean. :(

Powershell (v4), 57 56 54 53 58 57 Bytes
Back at the Bytecount I started with!
for(){cls;"Loading... "+"|/-\"[($a=++$a%4)];sleep -m 250}
The CLI in powershell will glitch out slightly on some computers, so it doesn't look perfect, but it's as good as I can feasibly get.
Moved $a++ into the for loop to save one byte, (no ;)
Then moved it into the array indexer, for another 2 byte save, thanks to Roman for pointing that out.
Also saved 1 more byte (;) by moving the Clear screen (cls) part into the for loop..
Issue and fix pointed out by TimmyD for the infinite aspect of the question, only +5 Bytes required, changed $a++%4 into ($a=++$a%4) so it will never go above 3.
Saved another byte by leaving the for loop totally blank, thanks to 'whatever' for pointing out that this is actually possible in Powershell Version 4!
New updated gif for the (final?) version of this answer.

for(;;cls){"Loading... "+"|/-\"[($a=++$a%4)];sleep -m 250}
for(;;cls){"Loading... "+"|/-\"[$a++%4];sleep -m 250}
for(;;){"Loading... "+"|/-\"[$a++%4];sleep -m 250;cls}
for(;;$a++){"Loading... "+"|/-\"[$a%4];sleep -m 250;cls}
for(;;){$a++;"Loading... "+"|/-\"[$a%4];sleep -m 250;cls}

for(;;){"Loading... "+"|/-\"[$a++%4];sleep -m 250;cls} (move the $a++ to the last usage of $a)

always forgetting something - thanks for that!

I'm not very adept at Powershell, but when I saw the Windows Batch entry, i thought "Could Powershell beat this?". And here it is!

@TimmyD this requires the () wrap to do, so it's actually a 5 byte loss, but neccessary all the same. thanks for pointing that out.

@JakubJankowski Powershell is a pretty powerful shell, there's some stuff cmd natually does very well, but i'd expect powershell to be a better golfing language overall for non-fringe challenges.

At least on ps v4 you should be able golf another byte by keeping the for condition totally empty: for(){cls;"Loading... "+"|/-\"[($a=++$a%4)];sleep -m 250}

@whatever updated - totally didn't realize that was possible in v4 - thanks!

You're welcome. It actually seems to work for Version 2+, was just too lazy to check before ;)

definitely need to remember that one for the future.

Vim, 35 bytes
iLoading... \-/|<Esc>qqdb:sl250m<CR>p@qq@q
The boring version. Here's a non-complying solution that's better:
Vim (1 second sleep), 27 bytes
idbgsp@@<C-U>Loading... \-/|<Esc>@.
Using gs not only is much shorter, but you don't have to hit Enter. That means the macro fits in-line, and I can save bytes by switching to @.. (Since nothing after the recursive call can ever run, I can type whatever I want.)

Thanks  for this answer! I learned gs, @. and the @@ within @. still makes my head hurt!

Matlab, 78 75 bytes
a='\|/-';while 1;clc;disp(['Loading... ',a(1)]);a=a([2:4,1]);pause(1/4);end

Pyth - 36 35 bytes
#+"\033cLoading... "@"\|/-"~hZ.d.25

Doesn't work online, obviously.

Do you have a gif of this in action? Also, is there any counter that could overflow?

@Flp.Tkc the only counter is Z which is a python integer, which don't overflow. I was trying to make a gif but couldn't get it to work. If you know how to make one, you can run it with the pyth interpreter at https://github.com/isaacg1/pyth

If the integer doesn't overflow, then it'll probably grow until filling up all memory, which would make it fail at least after 10⁶⁵⁰⁰⁰⁰⁰⁰⁰ years on most 32-bit systems. Sure, the heat death of the universe will happen first, but still...

HTML/CSS, 23 + 109 = 132 bytes
Improved upon Neil's answer.

pre{display:flex}a{overflow:hidden;animation:a 1s steps(4)infinite;width:1ch}@keyframes a{to{text-indent:-4ch

Loading... |/-\

Mathematica, 74 67 Bytes
ListAnimate["Loading... "<>#&/@{"|","/","-","\\"},AnimationRate->4]

A whopping 7 bytes off thanks to @dahnoak

ListAnimate["Loading... "<>#&/@Characters@"|/-\\",AnimationRate->4]

@dahnoak cheers! I didn't realise ListAnimate was a thing. It's a shame that <> is Flat not Listable otherwise 4 more bytes could be shaved off!

Just for fun: Dynamic["Loading... "<>{"|","/","-","\\"}[[1+Round[4Now@"Second"]~Mod~4]],UpdateInterval->.25]

Python 2, 81 79 78 77 bytes
import time
i=1
while 1:print'\rLoading...','\|/-'[i%4],;i+=1;time.sleep(.25)

Quite a simple solution that sleeps using time.
I use \r (A carriage return) to go back to the start of the line and then print the message overwriting the line.
I start with i=1 to avoid double escaping the \ (It is '\|/-' instead of '|/-\\').
In the past, I had used -~i to mean i + 1 to avoid parentheses. (Thanks to @Flp.Tkc for these -2 bytes!) (It was i=(i+1)%4 vs. i=-~i%4)
Now, I am just letting the counter rise forever, as technically Python ints can't overflow. Thanks to @Zachary T for pointing that out and saving a byte!
It only stops on a machine because the machine runs out of memory, but this takes 9.7 generations with 4GB of memory for that one int.
Thanks to @Kade for the -1 byte where print a,b prints a and b space seperated, so I don't need my own space.
Here's a gif of it working on Windows:

I tested it on a Linux VM too. I couldn't test it on a Mac.

If I remember correctly, you can use i=-~i%4 to save the bytes for the parens :)

I think that should overwrite using the carriage return.

And you forgot the i in -~i.

Won't replacing [i],;i=-~i%4 with [i%4],;i+=1 save a byte since it doesn't exceed the max for Python, only the maximum memory?

@ZacharyT That seems against the spirit of the challenge.

I should downvote you for logging in as Administrator...

@Neil To be totally honest, I just put the Python file in Administrator and ran it from there because the other account names are real names (Personal PC).

I'd allow @ZacharyT 's suggestion as technically Python integers can be infinitely large, as long as the computer has memory to hold them

I think you can save some bytes by using the time as your index instead of a counter (while 1:print'\rLoading... '+'\|/-'[int(time.time()*4)%4],) and not sleeping

@artificialnull, that would assume that each step in the while loop takes a certain amount of time. AKA, that won't work on all systems.

@ZacharyT I don't think so. If you run the code I proposed, it constantly updates the line and only changes when the time is a multiple of 0.25 (achieved by multiplying by 4 and then mod 4-ing). Please correct me if I'm mistaken.

What allows you to assume that the time is a multiple of 0.25?

@ZacharyT multiplying the floating point time provided by time.time() by 4 and converting to an integer gets the current time counted in quarter second increments.

I know that! What lets you assume every iteration of the while loop will take a fixed duration of time?

@ZacharyT +/-10% is allowed

What lets you even assume that it will be within 10%?

Also, the challenge says to print it in the correct order and you can't sleep at the beginning, so the time.time solution would most likely break that.

print'\rLoading... '+ -> print'\rLoading...', should save a byte.

C#, 170 133 Bytes
void X(){Console.Write("Loading...  ");for(;;){foreach(var c in "|/-\\"){Console.Write("\b"+c);System.Threading.Thread.Sleep(250);}}}

Big thanks to Roman Gräf and raznagul, who saved me 37 bytes. (Especially raznagul, who pointed out, that my original solution was invalid anyway. I kinda missed out on something there, but it's fixed now and should meet the requirements :)
pretty similar to Pete Arden's existing C# answer but with some improvements
e.g. "for(;;)" instead of "while (true)", char instead of string
I would have commented my suggestions on his answer but I don't actually have enough reputation to do that.
Ungolfed:
static void X()
{
    Console.Write("Loading...  ");
    for (;;)
    {
        foreach (var c in "|/-\\")
        {
            Console.Write("\b" + c);
            System.Threading.Thread.Sleep(250);
        }
    }
}

Why don't remove the first Console.Write("\b"); and change the second to Console.Write("\b"+a);?

Defining an action is unnecessary and to long using a loop like foreach(var a in"|/-\\") and add the code you currently have in the action as the body will save you ~20 Bytes.

Also, the task is to create the required output exactly. Which is currently not the case.

It should be the case now, I forgot '|' and the trailing space after "Loading...".

In your ungolfed version (since it doesn't match the golfed version), you can remove the first Console.Write() and use just one Console.Write($"Loading... {c}\r") instead of the second.

Your Console.Writes should be System.... you might be able to use using c = System.Console; to save bytes though I haven't tested it. You can compile to a Action and save more bytes

Forth, 72, 73 bytes
EDIT:

Added the Gforth-only version, 69 bytes (Thanks @ninjalj !)
Added missing whitespace after "Loading..." (Thx @Roman Gräf !), +1 byte
Updated to match the rules more precisely (in the same byte count)

Golfed
: L '| '/ '- '\ begin .\" \rLoading... " 3 roll dup emit 250 ms again ; L

Gforth version
The GNU Forth-only version can be brought down to 69 bytes like this:
'| '/ '- '\ [begin] .\" \rLoading... " 3 roll dup emit 250 ms [again]

Screencast

Try it online !

Since you are using gforth, if you don't care about portability to other Forth's, you can use [begin] and [again] outside a word definition.

MATL, 36 bytes
1 byte removed using @flawr's idea of circularly shifting the string
'\-/|'`Xx1YS'Loading... 'y1)hD.25Y.T

Here is a gif recording from the offline compiler:

Or try it at MATL Online!
How it works
'\-/|'           % Push this string
`                % Do...while
  Xx             %   Clear screen
  1YS            %   Circularly shift thr string 1 step to the right
  'Loading... '  %   Push this string
  y              %   Duplicate the string of shifting symbols
  1)             %   Get the first character
  hD             %   Concatenate the two strings and display
  .25Y.          %   Pause for 0.25 seconds
  T              %   Push "true". This is used as loop condition, to it
                 %   generates an infinite loop
                 % End loop implicitly

Hey Luis. well done with MATL as always. Here's a slight variation of the circular list. and display. Do you think you could translate that in an even shorter solution: a='\|/-';k=1; fprintf('Loading...  -') while 1     k=mod(k,4)+1;     fprintf('\b\b%c\n',a(k));     pause(.25); end

@Hoki Thanks for the idea. Actually I initially had an increasing counter modulo 4, but it was a little longer (I then gained a byte because of the requirement of no initial pause). Also, I think clear screen and normal display is shorter than fprintf with backspaces

Dyalog APL, 50 bytes
This only works in the Windows version, as otherwise the ⎕SM window will not show unless ⎕SR is called.
{⎕SM←1 1,⍨⊂⊃⍵⌽'Loading... '∘,¨'|/-\'⋄∇4|⍵+⌈⎕DL÷4}1

Explanation:

{...}1: run the function beginning with ⍵=1
Loading... '∘,¨'|/-\': generate the four possible outputs
⊂⊃⍵⌽: Rotate the list to put the ⍵th element first, take the first element, and enclose it
⎕SM←1 1,⍨: put the string in the top-left corner of the ⎕SM window.
⎕DL÷4: wait 1/4th of a second
4|⍵+⌈: round up the resulting value (seconds spent waiting, so this is always 1), add it to ⍵ (incrementing it), and take the mod-4 (to prevent it from eventually overflowing).
∇: run the function again with the new ⍵.

Somehow I knew someone would submit an answer for this challenge for Dyalog (/APL) :)

C#, 187 Bytes
Golfed:
void L(){Console.Write("Loading...");Action<string>l=(a)=>{Console.SetCursorPosition(11,0);System.Threading.Thread.Sleep(250);Console.Write(a);};while(true){l("|");l("/");l("-");l("\\");}

Ungolfed:
public void L()
{
  Console.Write("Loading...");
  Action<string> l = (a) =>
  {
    Console.SetCursorPosition(11, 0);
    System.Threading.Thread.Sleep(250);
    Console.Write(a);
  };
  while (true)
  {
    l("|");
    l("/");
    l("-");
    l("\\");
  }
}

Still waiting for it to load...

Still waiting for it to display “\”…

@manatwork Oh crap, lazy copy and pasting. Will fix it when I'm back at my desk shortly :)

Sorry to see your solution getting longer due to my comment. Can't you use 1>0 instead of true to get it back to 186?

@ErikGolferエリックゴルファー, no idea about C#, but based on the fact the language is a copy of Java and apparently confirmed by Can't cast int to bool, I thought that would not work. (BTW, if that works, maybe using the first call of l() as condition would also work?)

@manatwork Well, it seems C# is ungolfable.

@ErikGolferエリックゴルファー I've not given up yet, I will continue to answer PPCG questions in C#! :)

@manatwork No worries, it was shorter originally because it was wrong. Looks like 'Snowfire' has got a shorter solution than me now anyway :)

@PeteArden Do not give up on this yet, the other answer says that it would have been a comment, so you can ask in the comments if you can use what (s)he did.

@ErikGolferエリックゴルファー But then there'll be two answers the same won't there?

@PeteArden Well, I don't know for exact, but I think (s)he might be willing to delete the answer (probably not, though, since the user just got the +10 they needed to be un-sandboxed from that post). You can always ask, though :)

I know it's been almost a year, but you can still golf quite a bit: O=>{Console.Write("Loading...");for(Action<string>l=a=>{Console.SetCursorPosition(11,0);Threading.Thread.Sleep(250);Console.Write(a);};;l("/"),l("-"),l("\\"))l("|");} (173 bytes) Although I think (not entirely sure) it should be 186 bytes for the added using System; for the Console.Write calls.

MS-DOS .COM file, 56 bytes
Here the file content in hexadecimal:
b4 09 ba 2c 01 cd 21 b2 2f e8 11 00 b2 2d e8 0c
00 b2 5c e8 07 00 b2 7c e8 02 00 eb ea b4 02 cd
21 b2 08 cd 21 b9 05 00 f4 e2 fd c3 4c 6f 61 64
69 6e 67 2e 2e 2e 20 24

The matching assembler code looks like this:
    mov ah, 9      ; Print "Loading... "
    mov dx, text
    int 21h
theloop:
    mov dl, '/'    ; Call "chrout" for "/", "-", "\" and "|"
    call chrout
    mov dl, '-'
    call chrout
    mov dl, '\'
    call chrout
    mov dl, '|'
    call chrout
    jmp theloop    ; Endless loop

chrout:            ; Sub-Function "chrout"
    mov ah, 2      ; Output the character
    int 21h
    mov dl, 8      ; Output backspace
    int 21h
    mov cx,5       ; Call "HLT" 5 times
timeloop:
    hlt            ; Normally HLT will wait ~55 milliseconds
                   ; (Assuming no keyboard key is pressed)
    loop timeloop
    ret            ; End of the function

text:
    ASCII "Loading... ",'$'

Keeping a key pressed accelerates the spinner, which can be fixed by masking interrupts other than the timer interrupt, e.g.: mov al, 0xfe / out 0x21,al

The comment for HLT is wrong, you probably meant that HLT wakes up at ~18.2 Hz (or, more precisely, at NTSC clock/12/65536 Hz).

@ninjalj Thanks. I changed the comment...

Snap!, 8 blocks

This was one of the very first algorithms I ever puzzled out on an Apple ][e

Show us your Applesoft BASIC :)

I would gladly do these in Hypercard.

Perl 6, 72 61 bytes
Supply.interval(1/4).tap: {print "\rLoading... ",<| / - \ >[$/++];$/%=4}

loop {print "\rLoading... ",<| / - \ >[$/++];$/%=4;sleep 1/4}

Bash, 98 69 bytes
while s='\|/-';do
printf "\rLoading... ${s:i=++i%4:1}"
sleep .25
done

Thanks to many people for the many bytes golfed off!

Also you don't have to escape the backslash if you use single quotes and the arguments for echo -e -n can be combined to echo -en

You can save 2 lines and 13 bytes by replacing the echo line to: echo -en "\rLoading... ${s:i=(i+1)%4:1}"

echo -en → printf; make the assignment to s the while condition.

use printf like manatwork said, simplify the substring, and put it directly in the while condition: while printf "\rLoading... ${s:i++%4:1}";do. 67 bytes

That won't work Dominik R, it would eventualy overflow.

It works in bash 4.3.46(1)-release. Ony my x64 system, it goes up to 9223372036854775807, then wraps back to -9223372036854775808

><>, 55+4 = 59 bytes
"...gnidaoL"v
l?!voc1. ^:<>
<v<>'\|/-'>^v
^<^<<<8{<<^o<

Must be run passing -t .01 as additional argument to the interpreter, that's the +4 in the byte count.
What this does is putting the four characters to be printed on the stack, printing the top one without removing it and shifting the stack by one position. Then it prints \b (backspace, character x08) and restarts the loop.
Timing is achieved by the argument passed to the interpreter, which forces to wait 0.01 second before executing each instruction. There are 23 instructions between an output and the next one (most of them simply move the instruction pointer to the next cell), so this will wait 0.23 seconds plus the time needed for executing the instructions, which fits without problem in the requested 0.25s with 10% error.
You could try it online, but that interpreter doesn't recognize the backspace character, so the output will be a bit strange there.

Normally flags like -n are scored as 1 byte, so I think you can score the argument as t, .01 which is 4 bytes. Nice use of the 10% rule btw :)

@Flp.Tkc Thank you! I wasn't sure of how to count bytes for the argument, I like this way :)

@Leo - Is there a reason for using 0.01 and not a larger tick with less instructions? I've added my version which uses a loop of 8 instructions and the tick count of 0.03; #"...gnidaoL"l?!vob0.
"|/-":o}8o51. >#

@Tealpelican There is a reason, but it's not a very good one: the rules state that "You should not wait 0.25 seconds before initially showing output - the first frame should be printed as soon as the program is run.", so I didn't want to make the timer too long, while on the other hand this is code golf, so I didn't want to make it too short. In the end I decided for a 25 instruction loop taking 0.01s each to achieve the exact timing of 0.25s requested; when I implemented it, though, I realized that I lacked enough space for the full loop, so I had to resort to using the 10% rule.

I must have misread the rules. That is a perfectly good reason for the timing :)

reticular, 40 bytes
:i=@C"Loading... "o"|/-\\".iHo14%w.i1+4,

I forgot to commit a bunch of things, including w. Oh well.
Explanation
:i=@C"Loading... "o"|/-\\".iHo14%w.i1+4,
:i=                                       set `i` to the TOS
   @C                                     clear the screen
     "Loading... "o                       output that string
                   "|/-\\"                push that string
                          .i              get `i`
                            H             get the `i`th character of that string
                             o            and output it
                              14%         push 0.25 (1/4)
                                 w        wait that long
                                  .i      get `i`
                                    1+    increment
                                      4,  mod 4
                                          this wraps around the beginning of the program,
                                          setting i to the said value

NASM x86_64 - 349 283 bytes
This should be run 64 bit linux systems
built using:
nasm loading_golfed.asm -felf64 && ld loading_golfed.o
%use altreg
global _start
section .data
o:db"Loading...  "
s:db"|/-\\"
b:db`\bx`
q:dq 0,250000000
_start:mov r0,1
mov r7,1
mov r6,o
mov r2,12
syscall
mov r2,2
l:mov r7,1
mov al,[s+r8]
mov [b+1],al
mov r0,1
mov r6,b
syscall
mov r0,35
lea r7,[q]
mov r6,0
syscall
inc r8
and r8,3
jmp l

animation:
saved 65 bytes - thanks user254948

I count 349 bytes, unless there's a trailing newline/space

^Flp. Tkc Thanks, there was a line with a space at the end

@Samuel are lines 13-17 needed? It seems to work pretty much fine without those lines. As far as I can tell (Not that great in assembly I'm afraid) you print the Loading...., then the | character, then remove that character, then enter a loop where you repeat printing the | for the first time.

@Samuel in addition xor r8,r8 -> mov r8,0 (saves 1 character), some MOV's have an extra space (mov r7, 1 -> mov r7,1). further more the instructions cmp r8,4, jl l, xor r8,r8, can be replaced by AND r8,3 (saving 15 characters). You should be down to 285 bytes then instead of 349! (in combination with the lines mentioned above)

R, 85  89 bytes
repeat{if(T>4)T=1;cat("\fLoading...",c("|","/","-","\\")[T],sep="");T=T+1;Sys.sleep(.25)}

Edit: Fixed the answer such that T wont overflow by resetting the counter if greater than 4.
The only interesting aspect about this answer is the use of R's TRUTHY builtin T. It is effectively a predefined variable set to 1/TRUE which means we don't have to initialize the counter but can start incrementing T.

Would T eventually overflow?

@Flp.Tkc It wouldn't overflow but be treated as infinity past 1e+308 in which case NA is returned so I guess  this answer is invalid then (didn't notice it in the rules). Will update soon

Actually you can get it 2 bytes shorter if you don't use the built-in T: i=1;repeat{cat("\rLoading...",c("\\","|","/","-")[i]);Sys.sleep(.25);i=`if`(i>3,1,i+1)} is 87 bytes.

Hmm ... does R only operate on vectors? Why are there no modulo or bitwise operators for atoms? is T a vector? Does T=(T+1)%%4 work? It would save another 5 bytes.

@Titus In R, indexing is 1-based (meaning here one has to cycle T between 1, 2, 3 and 4; not 0, 1, 2, and 3) so what you propose won't work as if T=3, (T+1)%%4 is 0 which would index nothing. (Which could be solved by indexing with T+1 instead of T of course).

... or T=T%%4+1: even 2 bytes shorter.

79 bytes :)

Haskell (GHC), 103 91 bytes
import GHC.Conc
mapM((>>threadDelay 250000).putStr)$("\rLoading... "++).pure<$>cycle"|/-\\"

Thanks @nimi for saving 12 bytes!

No need for a full program. mapM((threadDelay 250000>>).putStr)$("\rLoading... "++).pure<$>cycle"|/-\\".

Two bytes might be saved by using the 10% tolerance and replacing 250000 and the space before it with (4^9).

Perl, 71 63 61 bytes
s//\rLoading... |/;select$\,$\,$\,y'-|\/'\/|-'/4while$|=print

Previous version:
$_="\rLoading... |";{$|=print;y#|/\-\\#/\-\\|#;select$\,$\,$\,.25;redo}

Thanx to @primo for 10 bytes.

Nice trick to use the select timeout rather than Time::HiRes. You can save a few bytes by using ... while$|=print, and by moving the hyphens in the transliteration to the front and the end. s//\r Loading... |/ also saves a byte over assignment.

And also, if you use single quotes for the transliteration delimiter, there's no need to escape the backslash either: y'-\|/'\|/-'.

It seems you have an extra space before your code.

You can save another byte by using a literal \r.

Use y'-|\/'\/|-'/4 in place of .25 for 2 more.

A bit more refactoring: select$\,$\,$\,'-\|/'=~/./g/4while$|=print"\rLoading... $&"

C (on UNIX-like systems) 88 bytes
main(_){for(;;){_%=4;printf("\rLoading... %c","\\-/|"[_++]);fflush(0);usleep(250000);}}

It starts with the wrong character, but I think it looks nicer. You can easily change the character order by modifying the "\-/|" string.

Could be golfed further by moving statements into for, e.g: ain(_){for(;printf("\rLoading... %c","\\-/|"[_%4]);usleep(250000))_++,fflush(0);}, then could be golfed further assuming wraparound for integer overflow: main(_){for(;printf("\rLoading... %c","\\-/|"[_++%4]);usleep(250000))fflush(0);}

Do you need the fflush() in there?

On most systems you do need the fflush, many of them buffer based on newlines. However it is possible that it isn't necessary on some systems.

You could use fprintf(stderr,... instead, since that is not line buffered like stdout. The f...stderr, takes eight characters, while the fflush(0); takes ten, so it's a net win of two characters.

Ruby, 66 59 58 57 bytes
I saved 7 bytes when I remembered ruby's loop syntax. -1 byte thanks to manatwork (changed print to $><<)! -1 byte thanks to daniero!
loop{$><<"Loading... #{'|/-\\'[$.=-~$.%4]}\r";sleep 0.25}

Decently self-explanatory.  Uses the nice fact that '...' strings don't need to have double-escapes I had to rework the string, so now the \ is at the end and must be escaped.

print → $><<

@manatwork Oh, cool!

You can use $. instead of initializing i, as explained here. Saves at least two bytes

PHP, 58 bytes
for(;;usleep(25e4))echo"\rLoading... ","\\|/-"[$i=++$i%4];

uses carriage return = overwrites the whole line. Run with -r.

@user59178: The assignment is needed to avoid integer overflow. Can you tell me how to run code with single and double quotes with -r?

Those are both excellent points, I probably should have actually tried running it, rather than just looking at the code.:-)

On 64-Bit php, it would take over 73 billion years to overflow. I think that's acceptably close to forever. Also, 57, no -r required: Loading... <?for(;;usleep(25e4))echo'\|/-'[$i=++$i%4],~÷;

@primo: I tried ^H, but it doesn´t seem to expand to chr(8) everywhere. And no idea what it depends on.

If using -r, it will likely depend on the terminal.

Java, 173 115 bytes

Version 2.0

Changed to lambda function/Thanks to @Xanderhall and @manatwork/115 bytes:
()->{System.out.print("Loading...  ");for(int i=0;;Thread.sleep(250))System.out.print("\b"+"\\|/-".charAt(i++&3));}

Version 1.0

Initial Version/173 bytes:
class A{public static void main(String[]a)throws Exception{System.out.print("Loading...  ");for(int i=0;;){System.out.print("\b"+"\\|/-".charAt(i++%4));Thread.sleep(250);}}}

“Your program should be able to run indefinitely.” – This will terminate when reaches Integer.MAX_VALUE after 17++ years with “java.lang.StringIndexOutOfBoundsException: String index out of range: -3”.

Can't test but will it i&3 do?

Also, you are allowed to submit a function. You can get rid of the class declaration and just have void a(){myfunction} format.

Pascal, 116 114 107 105 bytes
where is my head.. Thanks to @manatwork for shaving few bytes!
uses crt;var c:char;begin while 1=1do for c in'|/-\'do begin Write(#13'Loading... ',c);Delay(250)end;end.

Ungolfed:
uses
  crt;    // CRT unit has Delay function

var
  c: char;

begin
  while 1=1 do
    for c in '|/-\' do
    begin
      Write(#13'Loading... ', c);
      Delay(250)
    end;
end.

True → 1=1 and that way you can remove the following space too.

Better use a single output statement rewriting the entire line: Write(#13'Loading... ',c);. (BTW, no need for , between character and string literals.)

@manatwork - thanks, that makes more sense

Oh, and no need for the ; in front of 1st end.

Got it. have to eat something....

Noodel, noncompeting 24 25 bytes
Cannot compete because Noodel was born after the challenge.

    ”|gAĖọẸ.?a5‘|/-\⁺ʂḷạÇḍ/4

Had to add a byte because messed up the compression algorithm:(
“Loading...¤‘|/-\⁺ʂḷạÇḍ/4

Try it:)
How it works
“Loading...¤              # Creates a string that is "Loading...¤" that is placed into the pipe.
            ‘|/-\         # Creates a character array ["|", "/", "-", "\"]
                 ⁺ʂ       # Adds two items in the pipe which will add the string to each character in the array. The 'ʂ' forces it to prepend rather than append.
                   ḷ      # Unconditionally Loop everything up until a new line or end of program.
                    ạ     # Basic animation, iterates through an object moving to the next index every call on that object and returns what is at that index.
                     Ç    # Clears the screen then prints what is in the front of the pipe and dumps what was displayed.
                      ḍ/4 # Delays for the specified amount of time (/4 => 1/4 => 0.25s)

Stepping The Pipe
-->
--> "Loading...¤"
--> ["|", "/", "-", "\"], "Loading...¤"
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]
Loop ----------------------------------------------------------------------------------------
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]
--> "Loading...¤|", ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:0>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:0>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:0>
Loop ----------------------------------------------------------------------------------------
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:0>
--> "Loading...¤/", ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:1>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:1>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:1>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:1>
Loop ----------------------------------------------------------------------------------------
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:1>
--> "Loading...¤-", ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:2>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:2>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:2>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:2>
Loop ----------------------------------------------------------------------------------------
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:2>
--> "Loading...¤\", ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:3>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:3>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:3>
--> ["Loading...¤|", "Loading...¤/", "Loading...¤-", "Loading...¤\"]<frame:3>

There currently is not a version of Noodel that supports the syntax used in this answer. Here is a script that is supported:
23 bytes
Loading...¤”Ƈḟḋḣ⁺sḷạÇḍq

This is a pretty neat language. Welcome to PPCG :)

@FlipTack Thank you:) This place is like a giant playground:)lol

Wonder, 50 bytes
f\@(ol ++"�Loading... ":#0"\|/-";%%25e4;f +1#0);f0

Replace � with the actual carriage return \r.
Explanation
f\@(...);f0: Infinitely recursive function f.
:#0"\|/-": Modular indexing using the function argument and the string "\|/-".
ol ++"�Loading... ": Return cursor to beginning of line, concatenate previous result to Loading... , and output.
%%25e4: Sleep for 250000 nanoseconds.
f +1#0: Call f on the argument incremented.

Would this reach maximum recursion depth and crash?

I don't think so, although I haven't tried running it for very long. Sort of weird, given that I should know how the interpreter works.

C#, 165 123 bytes
Quite a few bytes saved thanks to raznagul !
z=>{Console.Write("Loading... ");for(int i=0;;i++){Console.Write(@"|/-\"[i%=4]+"\b");System.Threading.Thread.Sleep(250);}};

Anonymous function with no return type. The integer parameter z is only used as a placeholder in order to slash 1 byte off.
If input was allowed, the value 0 (or any other multiple of 4 to start from the same character) could be used as the iterator, reducing the byte count
to 116 bytes:
i=>{Console.Write("Loading... ");for(;;i++){Console.Write(@"|/-\"[i%=4]+"\b");System.Threading.Thread.Sleep(250);}};

Full program with ungolfed function:
using System;

public class Program
{
    public static void Main()
    {
        Action<int> a = z =>
        {
            Console.Write("Loading... ");
            for (int i=0;;i++)
            {
                Console.Write(@"|/-\"[i%=4]+"\b");
                System.Threading.Thread.Sleep(250);
            }
        };

        a(0);
    }
}

No GIF for now, since I'm having trouble with some dependencies on a slightly older Linux distro... The cursor is displayed on the last character, this behavior can be changed by adding a space in the Loading...   string.

I think this doesn't fulfill the third rule a i++ will eventually throw an overflow exception.

It won't overflow, since i is assigned the modulo of division by 4 when printing the line (i%=4).

+1 this is indeed clever. You can save a lot of bytes by printing Loading once and then printing "\b" instead of setting the cursor position. Also you don't have to define r. You can use @"|/-\"[...] instead.

I don't know if it is allowed. But you add on byte for the initialization of z and then you z instead of i, in total saving 6 bytes.

Befunge, 60 bytes
"  ...gnidaoL">:#,_v
"|/"<v*:*6"}",,8<
"\-"^>:#->#1_$:#^  _

Since Befunge doesn't have anything like a sleep command, the delay is approximated with a long running loop. This will obviously need to be adjusted depending on the speed of the system on which it is run.
You can test it on the codingground website.

C, 119 118 102 91 88 bytes
#import<windows.h>
i;f(){for(;;)Sleep(19*printf("\rLoading... %c","\\|/-"[i=(i+1)%4]));}

Could char *c be char*c?

@ZacharyT Yes, it could. Thanks!

Can you move the assignment into the index, for(;;){printf("\b%c",c[i=i>2?0:i+1])...?

Have a look at my submission... i=i>2?0:i+1 is identically i=(i+1)%4. He can use incrementation in the index, then modulo in the loop.

He can also save a byte (I think) by completely flushing with \r so he doesn't need the extra space in the "Loading...  " string.

I don't know C, but would i=++i%4 work?

@FlipTack Yes, it does. Thank you!

@FlipTack Or at least it seemed to work, but I just now realised that it's undefined behaviour, so I reverted back to the (i+1) thing.

Befunge 98, 61 bytes
Requires the HRTI (High Resolution Timers) fingerprint.
"ITRH"4(v
"g2:%4+1<,M',*93,aj*-d0`T**::?'M,kb"Loading...
|/-\

Waits 250047 (63^3) microseconds using a busy loop, using the M (mark) and T (returns the number of microseconds since the last mark) instructions from the "HRTI" fingerprint.
After each line, it outputs "\n\eM", to force a flush, and reposition the cursor.

Version for terminals using 8-bit encodings with proper support for C1 control codes (59 bytes):
"ITRH"4(v
"g2:%4+1<,+f~',aj*-d0`T**::?'M,kb"Loading...
|/-\

This version outputs "\n\x8d" after each line. "\x8d" is the 8-bit equivalent of 7-bit "\eM", and is supported by e.g: xterm +u8 (xterm not in UTF-8 mode).

Batch, 88 81 77 bytes
:1
@FOR %%G IN (/,-,\,^|) DO @(echo Loading...%%G
timeout/t 1 >a
cls)
@goto 1

(My first answer on Code Golf...)

The @echo off line is costing you ten bytes. Would it be cheaper to simply place an @ on each command individually? Or is there some reason that doesn't work?

@ais523 It's giving me some errors... I'm working on it

@ais523 Done! Turns out if you're using DO ( ) with FOR, you just need to put a single @: DO @( )

Since nobody's said it, welcome to code-golf! Nice answer

Still better than my 100-byte bash answer!

PowerShell, 116 77 69 67 bytes
for(){[char[]]'|/-\'|%{write-host -n `rLoading... $_;sleep -m 250}}

cleaner than cls?

Welcome to PPCG!

ES8 + HTML, 68 bytes
setInterval(e=>a.innerHTML='|/-\\'[++i%4],i=250)
Loading... -

TI-BASIC, 65 bytes
While 1:remainder(A+1,4)→A:Output(1,1,"Loading... "+sub("|/-\",A+1,1:Wait 1/4:End

TI CONNECT CE sadly does not allow screen recording so you'll have to enjoy my amazing camera skills instead.

Ungolfed:
While 1
remainder(A+1,4)→A
Output(1,1,"Loading... "+sub("|/-\",A+1,1
Wait 1/4
End

Explained:
While 1                                     Loop through everything forever
remainder(A+1,4)→A                          Set A to (A+1) mod 4
Output(1,1                                  Print at the first row, first column
          "Loading..."                      Loading...
                      +                     Concatenate string to...
                       sub( .... ,A+1,1     The A+1th characer of...
                           "|/-\"           This string
Wait 1/4                                    Pause for 0.25 seconds
End                                         End loop, go back to while.

According to this meta post, TI-BASIC is scored by token byte count, not characters. While is stored as a 1 byte token, and so is Output, while remainder is two bytes. It's kind of hard to count the tokens, so the best way is just to go to TI CONNECT and see how much space the program takes on the calculator.

C++11, 209 207 180 175 164 bytes
This might have been a good use for the new C++ literals, saving std::chrono::milliseconds(250) to just write 250ms or 0.25s, but unfortunately this requires using namespace std::chrono; which is longer in the end.
-2 bytes thanks to Flp.Tkc for using #import instead of #include. Saving lot more thanks to Flp.Tkc, learning about \r and \b. -2 bytes thanks to myself for c[++i%=4]. -5 bytes thanks to Roman Gräf. -9 bytes thanks to kvill for indexing into the string literal directly.
#import<iostream>
#import<thread>
int main(int i){A:std::cout<<"\rLoading... "<<"|/-\\"[++i%=4];std::this_thread::sleep_for(std::chrono::milliseconds(250));goto A;}

Golfed your initial example. If it does not work in your console, you have to add <<flush to see any output for +7 bytes.
Ungolfed:
#import <iostream>
#import <thread>

int main(int i) {
    A:
        std::cout << "\rLoading... " << "|/-\\"[++i%=4];
        std::this_thread::sleep_for(std::chrono::milliseconds(250));
    goto A;
}

Will i overflow?

@ZacharyT Ah, yes it would and negative % positive = negative in C++. Rolled back.

Wouldn't it be shorter to remove using namespace std; and replace that with std:: or is this_thread also std::

Tip: use #import<...> to save a couple bytes :)

@Flp.Tkc thanks! 2 bytes to be exact and some warnings, but hey ;) Might edit some of my previous answers, although most times I circumvented #include by assuming a string or vector<int> as input to a generic function.

Good idea using i as an argument, I didn't think of that. To shave some more bytes, you can rename cycle to c. And, rather than printing twice, just change the one in A: to cout<<"\rLoading... "<<c[i++];. My console didn't need the flush either.

@Flp.Tkc Thanks again. That `'\r'' is great.

@RomanGräf Yes, this_thread was also in std:: and using it 4 times is the same as using namespace std, but now that I dropped flush it is shorter with 3 times std::

No need to define c, just use ...<<"|/-\\"[++i%=4] for another couple of bytes.

@kvill Thanks! That feels a little pythonish.

Is there an std::chrono::seconds(0.25)?

Ruby, 75 72 bytes
$><<'Loading...  '
c='|/-\\'.chars
loop{$><<?\b+c.rotate![0]
sleep 0.25}

Nim, 81 80 bytes
import os
while 1>0:
 for c in "|/-\\":stdout.write("\rLoading... ",c);sleep 250

This may require flushing with stdout.flushFile in some terminals.

don't know nim but can't you write the for loop directly after the while 1>0;? Also can you maybe remove the whitespace between in and '|/-\\":?

@RomanGräf Thanks, but those changes are beyond Nim!

T-SQL, 239 182 162 159 153 152 149 bytes
Golfed:
DECLARE @c CHAR(5)='|/-\',@s CHAR,@ INT WHILE 1=1BEGIN SET @=1WHILE @<4BEGIN SET @s=(SELECT SUBSTRING(@c,@,1))PRINT'Loading... '+@s SET @=@+1 END END

Ungolfed
DECLARE @c CHAR(5) = '|/-\',
        @s CHAR(1),
        @ INT;
WHILE (1 = 1)
BEGIN
    SET @ = 1;
    WHILE (@ < 4)
    BEGIN
        SET @s = (SELECT SUBSTRING(@c, @, 1));
        PRINT 'Loading... ' + @s;
        SET @ = @i + 1;
    END
END

Maybe you should try golfing this?

@Cyoce down to 182.

Mathematica, 90 bytes 85 bytes
Significantly longer than A Simmons' answer, but with fewer visual frills.
t=0;RunScheduledTask[t=Mod[t+1,4],1/4];Dynamic["Loading... "<>"|"["/","-","\\"][[t]]]

Wow! "|"["/", "-", "\\"][[t]] looks awesome. nice one! :)

Nice job! I count only 86 bytes (using the two-byte [[ and ]] instead of the three-byte 〚 and 〛). You can also save a byte with 1/4 in place of 0.25.

Clojure, 93 92 bytes
#(do(print"Loading... -")(doseq[c(cycle"\\|/-")](print(str"\b"c))(flush)(Thread/sleep 250)))

Basically the Haskell answer (I swear I didn't cheat!).
It must be run in a console. IDE's REPL (Intellij) just prints a garbage character in place of the "\b".
And it's late, and I've never even created a GIF before, so I'm going to have to pass on that part.

HTML/CSS 135 Bytes
Like my previous answer, but doesn't use a monospace font, saving 6 bytes (not 100% if that's allowed, so I separated the answers for separate voting).
Update - a non monospace font is allowed. This works!

@keyframes l{0%{content:'|'}25%{content:'/'}50%{content:'-'}75%{content:'\\'}}a:after{animation:l 1s infinite;content:'|'}
Loading...

The 0% frame seems unnecessary.

@manatwork there so that it can repeat infinitely.

PowerShell 57 Bytes
for(){'|','\','-','/'|%{"loading...$_";sleep -m 250;cls}}

Welcome to PPCG! You can save a byte by using a char array instead of explicitly calling out each character -- [char[]]'|\-/'

Right, @TimmyD, Thx!

Dyalog APL, 45 bytes
Uses ─ instead of -.
{⍵⊣⎕DL÷4⊣⍞←⍵,⍨⊃⎕TC}¨⍣≢'|/─\'⊣⍞←'Loading...  '

⍞←'Loading...  ' print the string without newline
'|/─\'⊣ replace it with the string of bars
{...}¨⍣≢ indefinitely apply the below function on each character
 ⊃⎕TC first Terminal Control character (backspace)
 ⍵,⍨ prepend the argument (a bar character)
 ⍞← output that without newline (this overwrites the previous bar)
 4⊣ replace that with a four
 ÷ invert that (yielding 0.25)
 ⎕DL DeLay that many seconds
 ⍵⊣ replace with (and return) the original argument

Turing machine simulator, 189 bytes
0 * L r 1
1 * o r 2
2 * a r 3
3 * d r 4
4 * i r 5
5 * n r 6
6 * g r 7
7 * . r 8
8 * . r 9
9 * . r A
A * * r B
B - \ * C
B / - * C
B | / * C
B * | * C
C * * * D
D * * * E
E * * * F
F * * * B

Do not run on full speed, or it will not wait for ~0.25 s1.
1Dunno if actually within 10% of 0.25 s. Last 4 lines do the waiting job approximately.

TI-Basic (CE/CSE only), 57 bytes
:ClrHome
:Disp "LOADING...
:For(A,1,5
:A-4(A=5→A
:Output(1,12,sub("+/-*",A,1
:Pause .25
:End

Notes:

Many commands in TI-Basic are 1-2 byte tokens, which may make it appear to be a byte miscount.
Due to TI-Basic's very limited character set, the following characters have been replaced: |\ with +*.
This will only run correctly on the newest version of a TI-84+ CE or CSE.

Commodore 64 (or VIC-20), 123 Bytes
0 A$="/|\-":A=1:FORI=0TO1STEP0:PRINT"{home}LOADING..."MID$(A$,A,1):A=A+1:GOSUB2:ON-(A>4)GOTO0
1 NEXT
2 FORX=0TO99:NEXT:RETURN

Using print 38911-(fre(0)-65536*(fre(0)<0)) tells me that I have consumed 123 bytes of the computers memory (on the C64); this will probably work on other variants of Commodore BASIC, such as the BASIC 7; you will need to use BASIC keyword abbreviations to enter it on a real C64 or VIC-20.

In order to make it infinite*, you will need to disable the RUN/STOP key with a POKE, I think it's POKE 808,234 - that will mean you can't break into the BASIC listing without an Action Replay or a soft reset or something. The time delay can be altered in line 2 - increase the FOR X counter as required.

C++, 109 Bytes
There should be a lot to improve, it's my first golf code.
Feedback is greatly appreciated :)
#import<stdio.h>
#import<unistd.h>
int b;main(){for(;;usleep(2500))printf("\rLoading...%c","-\\|/"[++b%=4]);}

C function, 73 bytes
i;f(){for(;write(1,"\rLoading... -\b\\\b|\b/",13+i%8);i++)usleep(1<<17);}

Tested on SystemResque-Cd 4.9.6 in this program:
#include <stdio.h>
#include <unistd.h>

/*
i;
f(){
        for(
            ;
            write(1, "\rLoading... -\b\\\b|\b/", 13+i%8);
            i++
        ){
                usleep(1<<17);
        }
}
*/
i;f(){for(;write(1,"\rLoading... -\b\\\b|\b/",13+i%8);i++)usleep(1<<17);}

int main(){
        f();
        return 0;
}

compiled with gcc 4.9.4

Welcome to the site!

Charcoal, 34 bytes
Loading... Ａ⁰αＨＷ²⁵⁰¦¹«Ａ⁺¹ααＰ§|/-\α

Try it online! Refresh command has changed since so it is different on TIO. Link to verbose code for explanation.

Java 7, 121 118 bytes
void f()throws Exception{for(int k=0;;k++){System.out.print("\rLoading...
"+"|/-\\".charAt(k%=4));Thread.sleep(250);}}

Gif animation:

C89, 71 bytes
main(i){for(;;)usleep(4<<printf("Loading... %c\n[A","/-\\|"[i++&3]));}

Using printable characters the format argument to printf(3) would be "Loading... %c\n\x1b[A".

C (gcc) -O3, 65 bytes
The same but as a function. Requires tail-call optimization, otherwise it would overflow the stack eventually.
i;f(){f(usleep(4<<printf("Loading... %c\n[A","/-\\|"[i++&3])));}
/* main(){f();} */

Bash, 62 bytes
c='|/-\';for((;;)){ echo Loading... ${c:d++%4:1}^[M;sleep .25;}

where ^[ represents ESC (ASCII 0x1b), which typically you can get by pressing CtrlV and then ESC.
ESC M is RI, reverse linefeed.
If you don't care about running indefinitely, you can save 2 bytes by using a recursive function:
c='|/-\';f(){ echo Loading... ${c:d++%4:1}^[M;sleep .25;f;};f

JavaScript (ES6), 90 bytes

(F=(i=0)=>{(c=console).clear();c.log('loading... '+'|/-\\'[i]);setTimeout(F,250,-~i%4)})()

i will eventually overflow, since it just keeps going up without modulation. This can be fixed at no cost with c.log('loading... '+'|/-\\'[i]);setTimeout(F,250,-~i%4)

@ETHproductions Good catch, the poor user would only have to wait a mere 71 billion years.

Node, 72 bytes (70 with literal)
c=0;setInterval(_=>console.log('\x1BcLoading... '+'/-\\|'[c=-~c%4]),250)
If you replace \x1B with the literal escape character you can cut another 2 bytes. You don't need to call anything.

Would setInterval(_=>console.log('\x1BcLoading... '+'/-\\|'[c=-~c%4]),c=250) work since c is being mod-ed by four every time?

Swift 3, 75 bytes
do{"|/-\\".characters.map{print("\u{001B}[2J\nLoading... \($0)");sleep(1)}}

I need to use \u{001B} (ESCAPE) and [2J (clear screen) here because the old system API is deprecated in Swift 3 and I can't use \r on Mac/Linux.  I would lose bytes if I had to use the length posix_spawn call or NSTask.  I also hate having to access a string's CharacterView in order to map over each character.  At least I saved some bytes by using do instead of a while loop.

Python 3, 86 83 bytes
GIF to follow. Golfing suggestions welcome as this is still a little verbose. -3 bytes thanks to Flp.Tkc.
import time
i=1
while i:print(end="\rLoading... "+"/-\|"[i%4]);time.sleep(.25);i+=1

You can stick the \r before the Loading to save the costly bytes for end=. Note that this solution is extremely similar

@Flp.Tkc I could have sworn that there were no other Python answers on here. Thanks for the heads up. Also, that tip doesn't work as Python 3's print has the default end of \n which screws up the updating. Thanks anyway.

In that case you could do print(end="\rLoading... "+"/-\|"[i%4])

F# (interactive), 81 bytes
async{while 1>0 do for c in"|/-\\"do printf"\rLoading... %O"c;do!Async.Sleep 250}
In order to run it in F# interactive, you have to pass it to Async.Start or Async.RunSynchronously.
For reference, a little longer non-async version:
while 1>0 do for c in"|/-\\"do printf"\rLoading... %O"c;System.Threading.Thread.Sleep 250
and a slightly outdated gif :)

Welcome to PPCG. Nice answer :)

Python 3, 94 bytes
Okay. First answer. EDIT: SAVED 8 BYTES EDIT 2: SAVED 1 BYTE EDIT 3: SAVED 11 BYTES EDIT 4: SAVED 3 BYTES EDIT: SAVED 5 BYTES EDIT: SAVED 2 BYTES
import time
while 1:
 for f in 0,1,2,3:print("Loading...","|/-\\"[f],end="\r");time.sleep(.25)

Ungolfed:
import time
while True: # Loop forever
    for f in [0, 1, 2, 3]: # Loop four times
    print("Loading...", "|/-\\"[f], end="\r") # Print Loading... then the current frame
        time.sleep(0.25) # Wait 0.25 seconds

Welcome to PPCG! Nice answer, although there is a shorter python solution here. You might want to see tips for golfing in python so you can make your future answers shorter :)

I see you have a bit of extra whitespace particularly f += 1 can be replaced with f+=1 and f >= 3 can become f>=3.  Additionally 0.25 can be replaced with .25

Also I think a can be defined as the string "|/-\\" without any issue. And since a is only referenced once you don't have to define it at all.

Another thing I noticed is the fourth line is the same as f%=3.

While True: is the same as While 1:

awk, 46 bytes
In awk, with some help from ANSI codes and the rotor comes piped in:
{while(i=1+i%4)print"Loading... "$i"\033[1A"}

Try it:
$ echo \|/-\\|awk -F '' '{while(i=1+i%4)print"Loading... "$i"\033[1A"}'
Loading...[|/-\]

One byte comes off if NF is replaced with 4. I didn't wait to see if i iterates to oblivion.

Does this have the space between the ... and the cycling chars?

@FlipTack Missed that, I stand corrected.

tcl, 83
while 1 {lmap c {| / - \\} {puts -nonewline \rLoading...$c;flush stdout;after 250}}

Can be seen running on: https://goo.gl/BJmxV0

PKod , 48 bytes ~ Non-Competing
Possibly the only way I can do this, as PKod only has one write-able variable
lL=oo=ao=do=io=no=go=.ooo =|oyw=/oyw=-oyw=\oywl<
Explanation: l - Clear screen and since its the first char, allow printing no operation (NOP) chars
             L - NOP, thus print "L"
             =oo=ao=do=io=no=go=.ooo - Set as certain chars and print them.
             (space) - Another NOP, thus print a space
             =|oyw - Set char as "|", print it, then wait a quarter of a second and remove it
             =/oyw=-oyw=\oywl - Same as above, with different symbols to match the challenge
             < - Go back to the start

"Gif" (more like mp4): https://i.gyazo.com/577dd164313a6b2e5dbf40249efb435d.mp4
You can see quote marks around the code in the console, thats because cmd tries to do stuff with my "<" and would return an error. It's just to nicely pass the code to the interpeter without cmd interfering.

Why is this non-competing?

Bash, 100 bytes
while [ 1 ]; do for i in `echo '|/-\' | grep -o .`; do printf $'\rLoading...'$i;sleep 0.25;done;done

This is not nicely golfed, so please tell me where I can improve here.

This does work, and has been tested on a Raspbian Raspberry Pi, an Amazon server, and an Ubuntu machine. This would not work on a Solaris machine because the sleep command on those systems cannot take inputs less than 1.

C#, 183 180 178 170 161 140 bytes
I know a C# solution has already been posted, but this one is a fully functional console program (including usings) in less bytes!
Golfed
class P{static void Main(){for(int i=0;;){System.Console.Write("\rLoading... "+@"|/-\"[i=i++==3?0:i]);System.Threading.Thread.Sleep(250);}}}

Ungolfed
class P
{
    static void Main()
    {
        for (int i = 0; ;)
        {
            System.Console.Write("Loading... "+@"|/-\"[i = i++ == 3 ? 0 : i]);
            System.Threading.Thread.Sleep(250);
        }
    }
}

Yes, I'm probably very late, but I had to post it..!
EDIT: I figured someone else posted a 109 byte C# solution, oh well
EDIT 2: Thanks to the poster of the 109 byte C# solution, I managed to lose 3 more bytes by removing i<4 from my for loop, thanks!
EDIT 3: Removed C# 6 string interpolation and used good old + instead to save 2 more bytes.
EDIT 4: Not declaring a var for the animation characters anymore, instead I added them directly into the Write() method, saving another 8 bytes
EDIT 5: Removed the parameter string[]s from the Main method to save 9 bytes!
EDIT 6: Used carriage return instead of System.Console.Clear(), removed a using and moved the incrementing of i + the ternary inside of System.Console.Write(), all thanks to @CSharpie! (all this saved 21 bytes)

Instead of Console.Clear just use a carriage return infront of the string.
c.Write("\rLoading... "+@"|/-\"[i]);. Then you probably can further reduce by getting rid of the using since you only need System.Console.Write("\rLoading... "+@"|/-\"[i]); You can put your ternary expression in there too, making it System.Console.Write("\rLoading... "+@"|/-\"[i=i++==4?0:i]); whilst also  removing the i++ from the for-loop.

One small mistake, cant edit comments after 5 minutes so: Console.Write("\rLoading... "+ @"|/-\"[i=i++==3?0:i]); resulting in 142 bytes.

Woah @CSharpie that's some awesome improvements, thanks alot! I'll apply some of them, but I will have to explain why I rolled back the carriage return (I added it earlier): imgur GIF this is happening when the console window isn't wide enough, somehow. Doesn't happen using .Clear()

thats nothing you need to worry about.

@CSharpie Oh, really? I'll apply that as well then! Thank you very much :) I also discovered a weird exception happening using .Clear() but I don't think this is the right place to discuss that, so I posted it on SO instead

SmileBASIC, 57 bytes
@L CLS?"Loading... "+"|/-\"[I]:I=(I+1)MOD 4 WAIT 15 GOTO@L

Ungolfed:
@L                       'loop start
CLS                      'clear console
?"Loading... "+"|/-\"[I] 'construct our output and print
I=(I+1)MOD 4             'inc counter, MOD to prevent overflow
GOTO @L                  'loop

SmileBASIC, 51 46 bytes
CLS?"Loading... ";"|\-/"[3AND MAINCNT/15]EXEC.

JavaScript (ES6) + HTML, 77 74 bytes
f=c=>setTimeout(f,250,-~c%4,o.value="Loading... "+"|/-\\"[~~c])

<input id=o

Try It

(f=c=>setTimeout(f,250,-~c%4,o.value="Loading... "+"|/-\\"[~~c]))()
<input id=o>

PHP, 56 bytes
while(!usleep(25e4))echo"\rLoading... ",'\|/-'[@$i++%4];

C++ (224)
This certainly isn't the shortest code to do this. I like doing coding challenges, so I'm posting it anyway.
#include <iostream>
#include <string>
#include <thread>
using namespace std;int main(){string s = "|/-\\";int i=0;cout<<"Loading... ";while(1){cout<<s[i];this_thread::sleep_for(chrono::milliseconds(99));cout<<"\b";i=++i%4;}}

You can save 2 bytes by removing the spaces around =.

Japt, 38 bytes
@Oq Oo`LoÃHg... `+"|/-\\"gW°%4)1
a#úiU

Try it online!
How it works
@Oq Oo`LoÃHg... `+"|/-\\"gW°%4)1
a#úiU

@               Declare a function...
 Oq               that clears the screen,
 Oo"Loading... "  prints this string,
 +"|/-\\"gW++%4   plus the spinner char (using a variable W),
 )1               and finally returns 1
                and implicitly store this function to U.

a       Call U once (return 1 is needed for this)
 #úiU   and call U every 250 milliseconds.

By the nature of Japt syntax, it's impossible to call U() directly (well, it's possible using JS directive $...$ but it's too long after all.) So we use U.a() method that calls U with numbers from 0 to infinity until U returns true. If you omit )1 at the end of the first line and try running it, your browser will hang.
Without the initial U() call, the output window will show the implicit output (seemingly random integer value) before first showing the Loading... text.
Finally, a#úiU actually translates to U.a(250 .i(U)), which registers the 250ms loop first and then passes the return value (which happens to be undefined) to U.a (which accepts optional function argument, but seems to do nothing special with undefined).

><> with -t.03 flag, 33 bytes
'o!vooooo|\-/ ...gnidaoL
{[4<o8o:

Try it online!
The only part of the specification this doesn't implement is that the first frame should be printed as soon as the program is run which seems rather strict and unobservable. The first frame here take 1.08 seconds to print, and every frame after that takes 0.24 seconds.

Julia, 61 bytes
while 0!=@.print("\rLoading... "*["|/-\\"...])==sleep(1/4)end

(Don't) try it online!

Python 3 (Windows), 112 109 108 bytes
import time,os
while 1:
 for i in ['|','/','-','\\']:print("Loading... "+i);time.sleep(1/4);os.system('cls')

Python 3 (*nix), 111 110 bytes
import time,os
while 1:
 for i in ['|','/','-','\\']:print("Loading... "+i);time.sleep(1/4);os.system('clear')

Thanks @Dion for reducing 3 bytes in Windows version and add more info about *nix run!

You could save 3 bytes by moving the last line onto the previous one

You could also change 0.25 to 1/4 to save a byte :p

save a bunch of bytes with for i in '|/-\\':print(end="\rLoading... "+i);time.sleep(1/4)

Zsh, 56 bytes
while for i (\| / - \\)printf \\rLoading...$i&&sleep .25
Attempt This Online!

CLC-INTERCAL -psyscall, 356 bytes
Uses latest feature: syscall #9.
DO;1<-#12DO;1SUB#1<-#94DO;1SUB#2<-#317DO;1SUB#3<-#314DO;1SUB#4<-#2567DO;1SUB#5<-#377DO;1SUB#6<-#364DO;1SUB#7<-#248DO;1SUB#8<-#670DO;1SUB#9<-#188DO;1SUB#10<-#255DO;1SUB#11<-#255DO;1SUB#12<-#213DO;2<-#1DO:9<-#392¢#452DOCOMEFROM#9(4)DO;2SUB#1<-#122(2)DO;2SUB#1<-#126(1)DO;2SUB#1<-#15DO;2SUB#1<-#47DO.1<-#8DOCOMEFROM.1DOREADOUT;1+;2(666)DO.9<-#9(9)DO.1<-.1~#14

Running gif before fixing; spinning counterclockwise

Ungolfed
DO;1<-#12          DONOTE ;1 <- "\rLoading... "
DO;1SUB#1<-#94
DO;1SUB#2<-#317
DO;1SUB#3<-#314
DO;1SUB#4<-#2567
DO;1SUB#5<-#377
DO;1SUB#6<-#364
DO;1SUB#7<-#248
DO;1SUB#8<-#670
DO;1SUB#9<-#188
DO;1SUB#10<-#255
DO;1SUB#11<-#255
DO;1SUB#12<-#213

DO;2<-#1           DONOTE ;2 is one of "|/-\"
                   DONOTE implicit .1<-#0 as iterator

DO:9<-#392¢#452    DONOTE const 250,000

DOCOMEFROM#9

(4)DO;2SUB#1<-#122 DONOTE /
(2)DO;2SUB#1<-#126 DONOTE -
(1)DO;2SUB#1<-#15  DONOTE \
DO;2SUB#1<-#47     DONOTE |
DO.1<-#8
DOCOMEFROM.1       DONOTE possibly from 4 2 or 1
DOREADOUT;1+;2
(666)DO.9<-#9      DONOTE sleep for :9 microseconds
(9)DO.1<-.1~#14    DONOTE right shift

YASEPL, 122 bytes
=sŔ,9=1)pipeſdivideſminusſ"\"=b$27»ſopenbracket=o|3`1!aŔ,9!c$a-s}1,250,3|`3!b~#"2J"~#"HLoading..."=g¥o,1~!o+%4!Ŕ,9|

it starts automatically, the compiler just takes a second to load the file so thats why there is a pause if you run this
I cant exactly make a GIF of this right now, but when I can i'll update.
this uses ANSI.

Uiua, 39 bytes
⍢(&sl1/4&pf⊂"\rLoading... "⊢.↻1)1$ |/-\

For some reason it looks really slow in the GIF but I can assure you on my computer it waits for 1/4 of a second. You may also notice that in the GIF, the code has an extra backslash; that's because I have Uiua 0.9.5 installed on my computer. In 0.10.0, the way $ strings work is a bit different, and the extra backslash isn't needed.
Explanation:
⍢(…)1$ |/-\

This starts with “|/-\” on the stack and does the rest of the program in a loop forever. A byte is saved by using the raw string syntax $ |/-\ instead of the normal "|/-\\".
↻1

Rotate this string one character to the left.
&pf⊂"\rLoading... "⊢.

Combine the first character of this with the loading text, and print it. The \r causes the text to be printed over whatever was already there.
&sl1/4

Sleep for a quarter of a second. Using a fraction literal like this is a byte shorter than 0.25.

Easyfuck, 41 36 bytes

ymsĘ·^U¶ąĺw‹ž]€ ĎÁ␆n␈2´A•ŕ␐.\»>í90ďSOS

due to lack of unicode representations for c1 control characters, they have been replaced by their superscripted abbreviations
Decompressed:
<[.<U]<U[.<W<.<]@␈␙|␈␙\␈␙-␈␙/␀ ...gnidaoL

<[.<U]<U[.<W<.<]@␈␙|␈␙\␈␙-␈␙/␀ ...gnidaoL
<                                         go to the last cell
 [.<U]                                    go through cells backwards, printing and deleting until encountering a null character
      <U                                  delete the null character
        [.<W<.<]                          go backwards through characters looping when reaching the beginning, printing and waiting according to their values
                @                         marks the end of code
                 ␈␙|␈␙\␈␙-␈␙/␀ ...gnidaoL initializer data

Is your code using raw EM and \ bytes, and you are using the unicode versions just for presentation purposes? If not, this is 59 bytes in UTF-8

@noodleman they're raw bytes, i had to use powershell to push them into the file one by one and then i replaced them for presentation purposes

ForceLang, 130 bytes
Noncompeting, requires language features (datetime.wait) that postdate the question.
def w io.write
set z string.char 8
def d datetime.wait 250
w "Loading...  "
label 1
w z+"|"
d
w z+"/"
d
w z+"-"
d
w z+"\"
d
goto 1

Rust, 196 bytes
use std::*;
use std::io::Write;
fn main(){let mut i=0;loop{print!("Loading... {}",['|','/','-','\\'][i]);io::stdout().flush();thread::sleep(time::Duration::from_millis(250));i=(i+1)%4;print!("\r")}}

Ungolfed with explanation:
// We have to use the std library before we can use the io, time, and thread modules
use std::*;
// We also have to have the std::io::Write trait in scope before we can use the functions it defines (like flush)
use std::io::Write;
// The main function
fn main() {
  // Our counter. It has to be declared mutable so that we can change it
  let mut i = 0;
  // loop creates an infinite loop
  loop {
    // print the loading text with the current spinner char
    // ['|','/','-','\'][i] must be used instead of "/-\\"[i] because Rust's strs and Strings don't allow indexing. :(
    print!("Loading... {}", ['|','/','-','\'][i]);
    // Flush stdout. Without this nothing will be displayed on the screen
    io::stdout().flush();
    // Sleep for 250 ms (0.25 secs)
    thread::sleep(time::Duration::from_millis(250));
    // Increment the counter
    i = (i+1)%4;
    // print a carriage return to clear the line
    print!("\r")
  }
}

https://codegolf.stackexchange.com/a/122770/45877

Windows Batch, 109 bytes
This is just another solution in Windows Batch
@echo off
call:s ^|
call:s /
call:s -
call:s \
%0
:s
cls
echo Loading... %1
ping 1.1 -n 1 -w 250>nul
goto:eof

I'm not quite shure what's wrong with the pipesymbol.

The pipe is a special character in batch

C# - 111 bytes
Just added some "creative [ac]counting" to existing C# answers.
void G(){for(var i=0;;i=i%4+1){Console.Write("\rLoading... "+"|/-\\|"[i]);System.Threading.Thread.Sleep(250);}}

Human readable version.
void G()
{
    for (var i = 0; ; i = i % 4 + 1)
    {
        Console.Write("\rLoading... " + "|/-\\|"[i]);
        System.Threading.Thread.Sleep(250);
    }
}

Ruby, 57 bytes
Same length as Conor O'Brien's answer, but a different approach:
%w(| / - \\).cycle{|c|$><<"Loading... #{c}\r";sleep 0.25}

Scala, 86 bytes
def t(i:Int=0):Any={print("\b"*12+"Loading... "+"|/-\\"(i));Thread sleep 250;t(i+1&3)}

Explanation:
def t(i:Int=0):Any={ //define a method t
  print(               //print...
    "\b"*12+             //a backspace character repeated 12 times to delete everything
    "Loading... "+       //the string "Loading...
    "|/-\\"(i)           //and the i-th char of the char in question
  );
  Thread sleep 250;    //sleep 250ms
  t(i+1&3)             //call t with i incremented by one, but capped at 3
}

Like most other answers, it looks pretty standard console-like.

C#, 168 136 123 109 Bytes
Golfed:
void S(){for(int a=0;;a++){Console.Write("\rLoading... "+"|/-\\"[a%=4]);System.Threading.Thread.Sleep(250);}}

Ungolfed:
void S()
{
    for(int a = 0; ; a++)
    {
        Console.Write("\rLoading... " + "|/-\\"[a%=4]);
        System.Threading.Thread.Sleep(250);
    }
}

See it working here:

Edit: Simplified the array.
Edit2: For is way better for this.

Regarding the edit sugestion: You dont need the Console.Clear(). Check the result gif I put, and when in doubt, test it out first ;)

tcl, 79
while 1 {lmap c {| / - \\} {puts -nonewline stderr \rLoading...\ $c;after 250}}

assuming I can write to stderr instead of stdout

C, 92 89 82 bytes
i;f(){for(;;i=4)while(i--)dprintf(2,"\rLoading... %c","|\\-/"[i]),usleep(250000);}

shortC, 59 bytes
i;f(){O;;i=4)Wi--)dR2,"\rLoading... %c","|\\-/"[i]),U250000

T-SQL, 121 bytes
DECLARE @ CHAR W:SET @=IIF(@='/','-',IIF(@='-','\',IIF(@='\','|','/')))PRINT'Loading... '+@ WAITFOR DELAY'0:0:0.25'GOTO W

Yabasic, 83 bytes
An anonymous function that takes no input and outputs to the console in graphics mode. Does not function with TIO.
Clear Screen
?"Loading..."
Do
?@(1,11)Mid$("|/-\\",i+1,1)
Wait.25
i=Mod(i+1,4)
Loop

Can you use i instead of i+1 in Mid$?

@12Me21 Unfortunately not - Mid$ is 1-indexed in Yabasic, so the +1 is necessary. You can see this in the context of this question here

Groovy, 60 bytes 59 bytes, 61 bytes
print'Loading...';for(;;)'|/-\\'.any{print"$it\b";sleep 250}

(modified to work with later versions of groovy, removed ascii cast)

Stax, 24 bytes
Ñ!Δ╚«&╖ô^ô◙⌠≈%<╗∞█z9ÖºOT

Run and debug it
Delays 15 frames between each change, which at default 60fps should be equal to 1/4th of a second.
Explanation
W`lAtv>!`"|/-\"{[+p{|,}15*|:F
W                             loop forever
 `lAtv>!`                     push "Loading... "
         "|/-\"{            F for each char in "|/-\"
                [+p           add to Loading and print
                   {|,}15*    delay 1 frame 15 times
                          |:  clear the screen

limiting your display to 30fps would mess with any of the programs here.

Hm. An error margin is allowed, and no fps requirements are specified. It should work fine on any modern browser.

I will specify a 60fps browser requirement then.

Let us continue this discussion in chat.

05AB1E, 26 bytes
[13ç”²½... ”"|/-\"NèJ?Ƶ–.W

[13ç”...”"..."NèJ?Ƶ–.W  # trimmed program
[                       # forever...
   ç                    # push character with codepoint...
 13                     # literal
    ”...”               # push "Loading... "
               è        # push character in...
         "..."          # literal...
               è        # at index...
              N         # current index in loop...
               è        # modulo length of...
         "..."          # literal
                 ?      # output...
                J       # joined stack...
                 ?      # without trailing newline
                    .W  # wait...
                  Ƶ–    # 250...
                    .W  # milliseconds

Python 3, 93 bytes
import time
while 1:print(end="Loading... "+"|/-\\"[int(time.time())%4]+"\r");time.sleep(.25)

Try it online!

Scratch, 98 bytes

Try it on Scratch!
define
forever
set[i v]to(((i)mod(4))+(1
say(join[Loading... ](letter(i)of[|/-\\]))for(.25)seconds

JavaScript + HTML, 48 + 20 = 68 bytes

setInterval(_=>a.innerHTML="\\|/-"[i++%4],i=250)
Loading... |

Since the animation is supposed to start immediately, I had to move the Loading text and the initial state of the animation to the HTML.


text:
Validate a PNG file
Write a program that can validate a PNG file. Your program should follow the PNG spec and must validate the PNG signature and the 4 critical chunks: IHDR, IDAT, PLTE and IEND. Your program must not validate the contents of ancillary chunks, except for their CRC checksums.
Your program must validate the presence of the PLTE chunk (that is, This chunk shall appear for colour type 3, and may appear for colour types 2 and 6; it shall not appear for colour types 0 and 4. There shall not be more than one PLTE chunk. ref)
Your program must validate chunk order.
Your program must validate CRC checksums.
Your program must validate the compressed data.
You may use runtime code generation+execution (e.g. compress the program itself, or algorithmically write the program itself a la kolmogorov complexity). If any binary blobs are used, their source code will be considered when calculating size.
External library source code size counts towards program size. This is to discourage image-parsing external libraries while allowing e.g. a CRC32 library. Libraries defined in the language specification (aka "standard libraries") don't count as external.
No regex.
You must specify how to input the file. Your program must output to stdout "true" or "false" to answer the question "is the file a valid PNG?".
Failing test files:
This file is false.

(Yes, that's a plaintext file. Newline-terminated.)
Passing test files:

It looks like Mathematica (surprise!) has a built-in to import an image, so you could just wrap some error handling to get a solution. Unfortunately, I don't know Mathematica and I'm not able to run code without paying.

The ban on binary blobs seems to be imprecise. If their distinguishing feature is not being in ASCII, people will just use base64 or the like to make them not-binary. If their distinguishing feature is being unreadable, doesn't that apply to most golfing submissions?

@ais523 Even tho code golf tends to be unreadable, a human can parse most of them without having to use an external tool such as a decompiler.

@Challenger5 Good thing you can't use it! Your program must not validate the contents of ancillary chunks, except for their CRC checksums.

I don't get the "external library" thing. What makes a library external compared to internal?

@nimi Is it part of the stdlib? If so, it's not external. Is it something you need to download/install yourself? If so, then it's external.

@nimi If you install just the "haskell" package and any required deps, what does it come with? What does the standard distribution when you get it off the official website come with?

@nimi Also you'd need to find a PNG library that doesn't validate any ancillary chunks.

@nimi Perhaps "Haskell Platform" from https://www.haskell.org/downloads ? I assume that's the official website, and thus "Haskell Platform" is the official standard haskell distribution. (We should probably take this to meta...)

@SoniEx2 One can tell libpng to not validate ancillary chunks (except for the checksum validations) with png_set_keep_unknown_chunks(png_ptr,PNG_HANDLE_CHUNK_NEVER, NULL, -1); (if golfing, use 0 instead of the named constant)

@GlennRanders-Pehrson From the docs, all known chunks except for the IHDR, PLTE, tRNS, IDAT, and IEND chunks are affected. - in other words it won't work because it'll still attempt to validate tRNS ;)

Right, you'd need another call to png_set_keep_unknown_chunks() to eliminate tRNS chunk validation.  tRNS is checked because we consider tRNS to be critical, even though it's officially ancillary.

@GlennRanders-Pehrson Well, looks like you just beat the challenge. Just need a language with built-in libpng which lets you set libpng flags.

@SoniEx2 Almost.  Ubuntu comes with libpng but unfortunately without the "devel" version that's needed to support new code.

@GlennRanders-Pehrson Since when is Ubuntu a programming language? Since when is libpng part of the C or C++ standard?

@SoniEx2: I want to correct myself: there is a "standard Haskell" in regards to libraries which are described in the Haskell 2010 report. Ok problem solved for Haskell, sorry for the confusion. Still I think it's better to forbid specific libraries (here: "PNG libraries") than referring to vague terms such as "external library".

Java - 1220 chars
import java.io.*;import java.util.zip.*;interface Q{static int i(byte[]b,int i){return java.nio.ByteBuffer.wrap(b).getInt(i);}static boolean v(int x,int...a){return java.util.stream.IntStream.of(a).anyMatch(y->x==y);}static void main(String[]a){byte[]b={-119,80,78,71,13,10,26,10},c={0,0,0,0},d=b.clone();OutputStream I=new InflaterOutputStream(new ByteArrayOutputStream());int l,k,i,t,r=k=i=l=0,H=1229472850,D=1229209940,P=1347179589,E=1229278788,L=8192;DataInputStream in=new DataInputStream(System.in);boolean v;CRC32 C=new CRC32();try{for(v=(in.read(b)>7&&java.util.Arrays.equals(b,d));v=v&&(l=in.readInt())>=0&&in.read(c)>3;){C.update(c);for(byte B:c)v&=(B|32)<123&&(B|32)>96;for(r=0;v&&(t=in.read(b=new byte[l-r>L?L:l-r]))>0;r+=t){C.update(b);if(i(c,0)==D)if(v=v(i,2,3))I.write(b);if(i(c,0)==H&&r==0)if(v=i==0&&t==13){v=i(b,0)>0&&i(b,4)>0&&b[10]==0&&b[11]==0&&v(b[12],0,1)&&((k=b[9])==0&&v(b[8],1,2,4,8,16))||(v(k,2,4,6)&&v(b[8],8,16))||(k==3&&v(b[8],1,2,4,8));i=(v&&k==3)?1:v?k&2:3;}}v&=(k=in.readInt())==(int)C.getValue();C.reset();if(v&(t=i(c,0))==P){v=v(i,1,2)&&l<=768&&l%3==0;i=3;}if(v&t==E){v=l==0;break;}if((t&L)!=0||((t&L<<16)==0&&!v(t,P,H,E,D)))v=0>1;}}catch(IOException e){v=0>1;}System.out.println(v);}}

Input is from stdin.

What happened to "External library source code size counts towards program size"?

@PeterTaylor The stdlib isn't an external library.

I can't tell if I'm impressed you golfed Java or scared. :P

@Downgoat Java has built-in CRC32, inflate/deflate, etc. It was only logical. I hope I never have to debug this thing again...

In that case, why not just use ImageIO.getImageReadersByFormatName("PNG")?

@Downgoat, if one answer with golfed Java scares you, the almost 2000 on this site should terrify you.

@PeterTaylor The challenge states Your program must not validate the contents of ancillary chunks, except for their CRC checksums. I'm sure there's a language out there with a built-in PNG parser that only validates the critical chunks, but I'm pretty sure Java is not one of them.

Do you have a test case to cover that?

@PeterTaylor Not yet. Hmm... ugh I forgot to print "false" on unknown critical chunks... .-.

instead of Integer.MAX_VALUE, you could do 1L<<32-1

I could probably optimize this by instead of validating everything myself, I just copied the relevant chunks (IHDR, IDAT, etc) to a new datastream and handed it off to the built-in PNG parser (yes, that's allowed). But eh w/e.

can't you use enum to shorten your code?

@MilkyWay90 enum?

@SoniEx2 See the Tips for Golfing in Java question

@MilkyWay90 haha I have no idea how to modify this code anymore :) but anyway you're welcome to try. it's mostly here as an example for ppl to go off on.

@SoniEx2 Well, I don't know Java

@MilkyWay90 you could try golfing it in something else :)

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Witness My Challenge (Tetris Puzzle)
Introduction
In the game   The Witness (possible spoilers ahead) there is a group of puzzles that involve drawing a Tetris piece with your line while making sure that the symbol for the Tetris piece your currently drawing stays contained within the shape you've drawn.

For the image above the drawing works because the L-shaped and upside down L-shaped Tetris pieces, occupying the positions (1,2)(2,2)(3,2)(3,3) and (1,1)(1,0)(2,0)(3,0) respectively, and the icons, located at (3,0) and (3,3), are contained within the white line.
Challenge
Your goal is to draw the solution line such that it contains all Tetris pieces as well as their respective symbols. The solution line may not contain anymore squares than that which is required (i.e. you must contain the sum of the number of squares making up each Tetris piece). Each solution will begin in the bottom left and end in the top right. Lastly, this is code-golf, so the shortest solution (in bytes) wins.
Representation
Each of these puzzles use a HxW grid of squares to construct your Tetris pieces and have some space for you to draw lines in between them. The representation is best understood by example. For the above image the representation would be
===========
|         |
| X X X X |
|         |
| X X X X |
|         |
| X X X X |
|         |
| X X X X |
|         |
===========

and the solution would be
===========
|*********|
|*X X X X |
|*******  |
| X X X*X |
|  *** *  |
| X*X*X*X |
|  * * ***|
| X*X*X X*|
|*** *****|
===========

where each square is represented by an X and the solution is drawn using a line of *s. The number of lines for each puzzle is 2*H+3 and the number of characters for each line is 2*W+3.
Input
The first n lines will give you the Tetris piece followed by the location of the corresponding symbol for that Tetris piece. The format is as follows:
(i1,j1)(i2,j2)...(ik,jk)->(p,q)
where (ik,jk) is the kth coordinate pair of the Tetris piece
(the left coordinate increases as you move down, the right coordinate increases as you move right) and (p,q) is the location of the corresponding symbol. The origin of each Tetris piece is the top left square (i.e. the top left square is (0,0)).
Example 1:
X
X
XX

would be
(0,0)(1,0)(2,0)(2,1)

Example 2:
XX
X
X

would be
(0,0)(1,0)(2,0)(0,1)

Example 3:
X  X
X  X

would be
(0,0)(1,0)(0,3)(1,3)

The next 2*H+3 lines will consist of the puzzle's grid.
Output
Output the puzzle grid with the solution line drawn in.
Examples
Example Input 1
(0,0)(0,1)->(2,1)
(0,0)(0,1)->(0,1)
(0,0)->(0,2)
=========
|       |
| X X X |
|       |
| X X X |
|       |
| X X X |
|       |
=========

Example Output 1
=========
|*******|
|*X X X |
|*******|
| X X X*|
|***** *|
|*X X*X*|
|*   ***|
=========

Example Input 2
(0,0)(0,1)(0,2)(1,2)(2,2)->(0,0)
(0,0)(1,0)(0,3)(1,3)->(2,1)
(0,0)(1,0)(2,0)->(1,3)
===========
|         |
| X X X X |
|         |
| X X X X |
|         |
| X X X X |
|         |
| X X X X |
|         |
===========

Example Output 2
===========
|      ***|
| X X X*X |
|      ***|
| X X X X*|
|        *|
| X X X X*|
|*** *****|
|*X*X*X X |
|* ***    |
===========

Example Input 3
(0,0)(1,0)(2,0)->(1,0)
(0,0)(1,0)(2,0)->(1,6)
(0,0)(0,1)(0,2)->(1,3)
=================
|               |
| X X X X X X X |
|               |
| X X X X X X X |
|               |
| X X X X X X X |
|               |
=================

Example Output 3
=================
|***         ***|
|*X*X X X X X*X |
|* *******   *  |
|*X X X X*X X*X |
|* *******   *  |
|*X*X X X X X*X |
|* ***********  |
=================

Clarifications

It is assumed that for any given input there is a solution.
If there are multiple solutions just print one.

Can we assume there is always a solution? Can we assume the solution is always unique?

Since the challenge is modeled off of the game there is always a solution for every puzzle and there may be more than 1 solution.

In that case, do we print any one solution or all of them?

Yeah, any valid solution.

The introduction makes very little sense to me. What's the coordinate system? In what sense is there a "Tetris piece your currently drawing"?

@Peter Taylor -- The coordinates I use in the introduction are referring to the 4x4 grid in the picture, where the top left green square is at (0,0) and the bottom right green square is at (3,3) , the left coordinate is up-down and the right coordinate is left-right. The Tetris pieces are defined by the symbols, so in the picture they have an L shaped one located at the bottom left and a upside down (reflected) L shaped one located at the bottom right. These Tetris pieces in the image fully occupy a section in the grid (defined by the white line and the grid border).

Python, 992
Takes input from stdin and prints the solution.   Note that SE has turned my tab characters into four spaces - anything indented beyond one space should be a tab.
It shouldn't be too hard to beat this, but I thought I'd post it since no one else had posted a solution.
L=len
R=range
j=[(-1,0),(1,0),(0,-1),(0,1)]
P=lambda y,x,q:(y,x)==(0,w)and[q+[(y,x)]]or sum([P(y+e,x+d,q+[(y,x)])for e,d in j if not(y+e,x+d)in q and 0<=x+d<=w and 0<=y+e<=h],[])
def C(q,y,x,v):
 if(y,x)in v:return
 v.add((y,x))
 for e,d in j:
    Y,X=y+e,x+d;a,b=[(y+(e+s*d+1)/2,x+(d+s*e+1)/2)for s in[-1,1]]
    if 0<=X<w and 0<=Y<h and not(a in q and b in q and abs(q.index(a)-q.index(b))==1):C(q,Y,X,v)
def G(s,c):
 if not s:return not c
 for y,x in r:
    p=set((Y+y,X+x)for Y,X in s[0])
    if c&p==p and G(s[1:],c-p):return 1
def B(q):
 for y,x in r:
    c=set();C(q,y,x,c);s=[h for(w,h)in p if w in c]
    if s and not G(s,c):return 1
h,p,g=0,[],[]
try:
 while 1:
    s=raw_input()
    if'('in s:l,o=s.split('->');p.append(map(eval,[o,'('+l.replace(')','),')+')']))
    else:g.append(list(s))
except:h=L(g)/2-1;w=L(g[0])/2-1
r=[(x/w,x%w)for x in R(w*h)]
for s in P(h,0,[]):
 if not B(s):break
for(a,b),(c,d)in zip(s,s[1:]):g[1+2*a][1+2*b]=g[1+a+c][1+b+d]=g[1+2*c][1+2*d]='*'
print'\n'.join(''.join(r)for r in g)

Quick rundown of how it works:
P finds all possible paths.
C finds all the squares that are connected to a given square.
G determines whether or not a set of shapes fit exactly in a set of squares.
B determines whether or not a path is bad by checking each connected set of squares and checking if their shapes fit.
Examples
input:
(0,0)(0,1)->(2,1)
(0,0)(0,1)->(0,1)
(0,0)->(0,2)
=========
|       |
| X X X |
|       |
| X X X |
|       |
| X X X |
|       |
=========

output (all tetris pieces are grouped into the top-right):
=========
|***   *|
|*X*X X*|
|* *   *|
|*X*X X*|
|* * ***|
|*X*X*X |
|* ***  |
=========

input:
(0,0)(0,1)(0,2)(1,2)(2,2)->(0,0)
(0,0)(1,0)(0,3)(1,3)->(2,1)
(0,0)(1,0)(2,0)->(1,3)
===========
|         |
| X X X X |
|         |
| X X X X |
|         |
| X X X X |
|         |
| X X X X |
|         |
===========

output (this is the only one that's the same as the example solution):
===========
|      ***|
| X X X*X |
|      ***|
| X X X X*|
|        *|
| X X X X*|
|*** *****|
|*X*X*X X |
|* ***    |
===========

input:
(0,0)(1,0)(2,0)->(1,0)
(0,0)(1,0)(2,0)->(1,6)
(0,0)(0,1)(0,2)->(1,3)
=================
|               |
| X X X X X X X |
|               |
| X X X X X X X |
|               |
| X X X X X X X |
|               |
=================

output (rightmost 2 pieces are grouped together):
=================
|*** *** *******|
|*X*X*X*X*X X X |
|* * * * *******|
|*X*X*X*X X X X*|
|* * * * *******|
|*X*X*X*X*X X X |
|* *** ***      |
=================

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/