[gnome-shell/wip/paging-release2: 11/22] appDisplay: Animate indicators
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/paging-release2: 11/22] appDisplay: Animate indicators
- Date: Mon, 26 Aug 2013 13:15:31 +0000 (UTC)
commit 0edc187380887a2554b48fe6825502e072ebccc0
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 | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 11ae2ac..a2b79e2 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 = 1;
+// 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
@@ -309,11 +316,35 @@ 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]