[gnome-shell/wip/swarm: 8/9] appDisplay: Animate on select app



commit dfa30d6aa91c7e256c816da061e25272e083acf2
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Mon Jun 23 12:34:38 2014 +0200

    appDisplay: Animate on select app

 js/ui/iconGrid.js |   32 ++++++++++++++++++++++++++++++++
 js/ui/search.js   |    9 +++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 0e068ac..662d085 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -31,6 +31,9 @@ const ANIMATION_TYPE_SWARM_SPRING = 2;
 const ANIMATION_DIRECTION_OUT = 0;
 const ANIMATION_DIRECTION_IN = 1;
 
+const APPICON_ANIMATION_OUT_SCALE = 3;
+const APPICON_ANIMATION_OUT_TIME = 0.25;
+
 const BaseIcon = new Lang.Class({
     Name: 'BaseIcon',
 
@@ -188,9 +191,38 @@ const BaseIcon = new Lang.Class({
 
     _onIconThemeChanged: function() {
         this._createIconTexture(this.iconSize);
+    },
+
+    animateOut: function() {
+        actorZoomOut(this.actor);
     }
 });
 
+function actorZoomOut(actor) {
+    let actorClone = new Clutter.Clone({ source: actor,
+                                         reactive: false });
+    let [width, height] = actor.get_transformed_size();
+    let [x, y] = actor.get_transformed_position();
+    log("animation widht hetihg " + [width, height]);
+    log("animation pos " + [x, y]);
+    actorClone.set_size(width, height);
+    actorClone.set_position(x, y);
+    actorClone.opacity = 255;
+    actorClone.set_pivot_point(0.5, 0.5);
+    Main.uiGroup.add_actor(actorClone);
+
+    Tweener.addTween(actorClone,
+                    { time: APPICON_ANIMATION_OUT_TIME,
+                      scale_x: APPICON_ANIMATION_OUT_SCALE,
+                      scale_y: APPICON_ANIMATION_OUT_SCALE,
+                      opacity: 0,
+                      transition: 'easeOutQuad',
+                      onComplete: function() {
+                           actorClone.destroy();
+                        }
+                    });
+}
+
 const IconGrid = new Lang.Class({
     Name: 'IconGrid',
 
diff --git a/js/ui/search.js b/js/ui/search.js
index 8ad6bde..d119ca9 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -6,6 +6,7 @@ const Gio = imports.gi.Gio;
 const Gtk = imports.gi.Gtk;
 const Meta = imports.gi.Meta;
 const Signals = imports.signals;
+const Shell = imports.gi.Shell;
 const St = imports.gi.St;
 const Atk = imports.gi.Atk;
 
@@ -350,6 +351,7 @@ const ListSearchResults = new Lang.Class({
         this.providerIcon.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
         this.providerIcon.connect('clicked', Lang.bind(this,
             function() {
+                this.providerIcon.animateOut();
                 provider.launchSearch(this._terms);
                 Main.overview.toggle();
             }));
@@ -650,5 +652,12 @@ const ProviderIcon = new Lang.Class({
                                  gicon: provider.appInfo.get_icon() });
         this._content.add_actor(icon);
         this._content.add_actor(this.moreIcon);
+    },
+
+    animateOut: function() {
+        let appSys = Shell.AppSystem.get_default();
+        let app = appSys.lookup_app(this.provider.appInfo.get_id());
+        //if (app.state == Shell.AppState.STOPPED)
+        IconGrid.actorZoomOut(this._content);
     }
 });


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