[gnome-shell/gbsneto/new-lock-screen: 21/22] environment: Parse repeat-count and auto-reverse



commit e5091ff17c95240c22892afbb4d35baf1e09ba3c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Oct 15 21:32:21 2019 +0200

    environment: Parse repeat-count and auto-reverse
    
    Those are two useful ClutterTimeline properties and
    will be needed for wiggling the search entry when
    failing the password.
    
    Add support for passing repeat-count and auto-reverse
    to ClutterActor.ease and ClutterActor.ease_property.

 js/ui/environment.js | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/environment.js b/js/ui/environment.js
index 38d1d281a6..e28c999b7e 100644
--- a/js/ui/environment.js
+++ b/js/ui/environment.js
@@ -105,6 +105,16 @@ function _easeActor(actor, params) {
         actor.set_easing_delay(params.delay);
     delete params.delay;
 
+    let repeat_count = 0;
+    if (params.repeat_count != undefined)
+        repeat_count = params.repeat_count;
+    delete params.repeat_count;
+
+    let auto_reverse = false;
+    if (params.auto_reverse != undefined)
+        auto_reverse = params.auto_reverse;
+    delete params.auto_reverse;
+
     if (params.mode != undefined)
         actor.set_easing_mode(params.mode);
     delete params.mode;
@@ -124,10 +134,14 @@ function _easeActor(actor, params) {
     let transition = animatedProps.map(p => actor.get_transition(p))
         .find(t => t !== null);
 
-    if (transition)
+    if (transition) {
+        transition.repeat_count = repeat_count;
+        transition.auto_reverse = auto_reverse;
+
         transition.connect('stopped', (t, finished) => callback(finished));
-    else
+    } else {
         callback(true);
+    }
 }
 
 function _easeActorProperty(actor, propName, target, params) {
@@ -140,6 +154,16 @@ function _easeActorProperty(actor, propName, target, params) {
         params.duration = adjustAnimationTime(params.duration);
     let duration = Math.floor(params.duration || 0);
 
+    let repeat_count = 0;
+    if (params.repeat_count != undefined)
+        repeat_count = params.repeat_count;
+    delete params.repeat_count;
+
+    let auto_reverse = false;
+    if (params.auto_reverse != undefined)
+        auto_reverse = params.auto_reverse;
+    delete params.auto_reverse;
+
     // Copy Clutter's behavior for implicit animations, see
     // should_skip_implicit_transition()
     if (actor instanceof Clutter.Actor && !actor.mapped)
@@ -166,7 +190,9 @@ function _easeActorProperty(actor, propName, target, params) {
     let transition = new Clutter.PropertyTransition(Object.assign({
         property_name: propName,
         interval: new Clutter.Interval({ value_type: pspec.value_type }),
-        remove_on_complete: true
+        remove_on_complete: true,
+        repeat_count: repeat_count,
+        auto_reverse: auto_reverse,
     }, params));
     actor.add_transition(propName, transition);
 


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