Skip to content

Instantly share code, notes, and snippets.

@rgrwkmn
Last active December 25, 2015 07:19
Show Gist options
  • Select an option

  • Save rgrwkmn/6938952 to your computer and use it in GitHub Desktop.

Select an option

Save rgrwkmn/6938952 to your computer and use it in GitHub Desktop.
Text spinner in JS. Call spin() to get the next character in the spin cycle.
var spin = function() {
var s = '|/-\\';
if (isNaN(this.i) || ++this.i > s.length - 1) {
this.i = 0;
}
return s[this.i];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment