diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-11 01:26:59 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-11 01:26:59 +0100 |
commit | d4b9b289e8a4db61dbed9c725ee602ee63515d15 (patch) | |
tree | 1dcfb150c9fa0d3e0dbe7f789193fd5a02330c0f /app/assets/javascripts | |
parent | 6c4c84b161947cb11ad0451a39e26b25be4c93d5 (diff) |
Adding Mastodon logo
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/mastodon-logo.coffee | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/app/assets/javascripts/mastodon-logo.coffee b/app/assets/javascripts/mastodon-logo.coffee new file mode 100644 index 000000000..3fb8c0a13 --- /dev/null +++ b/app/assets/javascripts/mastodon-logo.coffee @@ -0,0 +1,48 @@ +defaultClass = 'mastodon-shape' +pieces = [ + 'path#mastodon-tusk-front, path#mastodon-tusk-back', + 'path#mastodon-nose', + 'path#mastodon-cheek', + 'path#mastodon-forehead', + 'path#mastodon-backhead', + 'path#mastodon-ear', +] +pieceIndex = 0 +firstPiece = pieces[0] + +currentTimer = null +delay = 100 +runs = 0 +stop_at_run = 1 + +clearHighlights = -> + $(".#{defaultClass}.highlight").attr('class', defaultClass) + +start = -> + clearHighlights() + pieceIndex = 0 + runs = 0 + pieces.reverse() unless pieces[0] == firstPiece + clearInterval(currentTimer) if currentTimer + currentTimer = setInterval(work, delay) + +stop = -> + clearInterval(currentTimer) + clearHighlights() + +work = -> + clearHighlights() + $(pieces[pieceIndex]).attr('class', "#{defaultClass} highlight") + + if pieceIndex == pieces.length - 1 + pieceIndex = 0 + pieces.reverse() + runs++ + else + pieceIndex++ + + if runs == stop_at_run + stop() + +$ -> + setTimeout(start, 500) |