Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-08-30 07:58:48 +0300
committerFatih Acet <acetfatih@gmail.com>2016-08-30 07:58:48 +0300
commit0f72fc86004f143571398e88cdaa0b6d83b6661e (patch)
tree55c8696c3ca377d484cc124bb957604ef0b18212 /app/assets/javascripts/logo.js
parent77fd0a0421864b8af04ceb6474f39cf52fc80b46 (diff)
parent12784559316fc2c3860641bee9c6f8e2bc12c4ba (diff)
Merge branch 'css-logo-animation' into 'master'
Change logo animation to CSS ## What does this MR do? Converts the tanuki logo animation from javascript to CSS. You can now animate the tanuki svg logo by adding the CSS Class `animate`to it. ## Are there points in the code the reviewer needs to double check? Just need to double check for browser compatibility ## Why was this MR needed? * Using CSS for simple animations is a best practice (Optimizes DOM, uses GPU to do animation rather than CPU) * Happy DOM :balloon: ## What are the relevant issue numbers? Closes #20607 ## Screenshots (if relevant) Before DOM ![8BrOJAqT4U](/uploads/705a3c7b53c45d32d435cafecfc958bd/8BrOJAqT4U.gif) After DOM ![Screen_Shot_2016-08-03_at_10.30.08_PM](/uploads/e82d9b63501def4dc4e67a5659863680/Screen_Shot_2016-08-03_at_10.30.08_PM.png) Before ![JnEgliIIVO](/uploads/39aaec48fd3e193f20cf455371ea2d13/JnEgliIIVO.gif) After (Basically the same, hard to tell in my gif though because it was hard to get the timings right on the recording) ![fvLeXxmp3U](/uploads/058cf15fffed4be549af2e963eca4412/fvLeXxmp3U.gif) ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - Tests - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5655
Diffstat (limited to 'app/assets/javascripts/logo.js')
-rw-r--r--app/assets/javascripts/logo.js42
1 files changed, 2 insertions, 40 deletions
diff --git a/app/assets/javascripts/logo.js b/app/assets/javascripts/logo.js
index 218f24fe908..e5d4fd44c96 100644
--- a/app/assets/javascripts/logo.js
+++ b/app/assets/javascripts/logo.js
@@ -1,50 +1,12 @@
(function() {
- var clearHighlights, currentTimer, defaultClass, delay, firstPiece, pieceIndex, pieces, start, stop, work;
-
Turbolinks.enableProgressBar();
- defaultClass = 'tanuki-shape';
-
- pieces = ['path#tanuki-right-cheek', 'path#tanuki-right-eye, path#tanuki-right-ear', 'path#tanuki-nose', 'path#tanuki-left-eye, path#tanuki-left-ear', 'path#tanuki-left-cheek'];
-
- pieceIndex = 0;
-
- firstPiece = pieces[0];
-
- currentTimer = null;
-
- delay = 150;
-
- clearHighlights = function() {
- return $("." + defaultClass + ".highlight").attr('class', defaultClass);
- };
-
start = function() {
- clearHighlights();
- pieceIndex = 0;
- if (pieces[0] !== firstPiece) {
- pieces.reverse();
- }
- if (currentTimer) {
- clearInterval(currentTimer);
- }
- return currentTimer = setInterval(work, delay);
+ $('.tanuki-logo').addClass('animate');
};
stop = function() {
- clearInterval(currentTimer);
- return clearHighlights();
- };
-
- work = function() {
- clearHighlights();
- $(pieces[pieceIndex]).attr('class', defaultClass + " highlight");
- if (pieceIndex === pieces.length - 1) {
- pieceIndex = 0;
- return pieces.reverse();
- } else {
- return pieceIndex++;
- }
+ $('.tanuki-logo').removeClass('animate');
};
$(document).on('page:fetch', start);