[gnome-shell/wip/paging-release2: 11/22] appDisplay: Animate indicators



commit e80e27c5d64628bb81f13b5a7d67cf7f0d3aa7eb
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Mon Aug 26 12:47:09 2013 +0200

    appDisplay: Animate indicators
    
    Add a translation animation for indicators, following
    design reasons

 js/ui/appDisplay.js |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 0f615f8..66a2240 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -39,6 +39,13 @@ const FOLDER_SUBICON_FRACTION = .4;
 
 const MAX_APPS_PAGES = 20;
 
+const INDICATORS_ANIMATION_TIME = 0.6;
+// 100% means indicators wait for be animated until the previous one
+// is animated completely. 0% means all animators are animated
+// at once without waits
+const INDICATORS_ANIMATION_DELAY_OFFSET_PRECENTAGE = 50;
+const INDICATOR_MOVE_OFFSET = 60;
+
 const PAGE_SWITCH_TIME = 0.3;
 
 // Recursively load a GMenuTreeDirectory; we could put this in ShellAppSystem too
@@ -297,11 +304,34 @@ const AllView = new Lang.Class({
         // we have to tell pagination that the adjustment is not correct (since the allocated size of 
pagination changed)
         // For that problem we return to the first page of pagination.
         this._paginationInvalidated = false;
+
+        this.actor.connect('notify::mapped', Lang.bind(this, this._animateIndicators));
     },
 
     _onNPagesChanged: function(iconGrid, nPages) {
         this._paginationIndicator.nPages = nPages;
         this._paginationInvalidated = true;
+        this._animateIndicators();
+    },
+
+    _animateIndicators: function() {
+        let indicators = this._paginationIndicator.actor.get_children();
+
+        for (let i in indicators)
+            indicators[i].translation_x = INDICATOR_MOVE_OFFSET;
+
+        if (this.actor.mapped) {
+            let timeForEachIndicator = INDICATORS_ANIMATION_TIME / this._grid.nPages();
+            let delay = INDICATORS_ANIMATION_DELAY_OFFSET_PRECENTAGE / 100 * timeForEachIndicator;
+
+            for (let i = 0; i < this._grid.nPages(); i++) {
+                let params = { translation_x: 0,
+                               time: timeForEachIndicator,
+                               delay: delay * i,
+                               transition: 'easeOutQuad' };
+                Tweener.addTween(indicators[i], params);
+            }
+        }
     },
 
     goToPage: function(pageNumber, updateIndicators) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]