[gnome-shell/gbsneto/new-lock-screen: 22/22] authPrompt: Wiggle on failure



commit 6fd0aafada7091c929920910a94cd71c6334ec1f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Oct 15 21:34:35 2019 +0200

    authPrompt: Wiggle on failure
    
    WIP

 js/gdm/authPrompt.js | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index f01a2fce14..13fc6223b2 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -16,6 +16,10 @@ var DEFAULT_BUTTON_WELL_ANIMATION_TIME = 300;
 
 var MESSAGE_FADE_OUT_ANIMATION_TIME = 500;
 
+const WIGGLE_OFFSET = 6;
+const WIGGLE_DURATION = 65;
+const N_WIGGLES = 3;
+
 var AuthPromptMode = {
     UNLOCK_ONLY: 0,
     UNLOCK_OR_LOG_IN: 1
@@ -200,6 +204,35 @@ var AuthPrompt = class {
         this.updateSensitivity(canRetry);
         this.setActorInDefaultButtonWell(null);
         this.verificationStatus = AuthPromptStatus.VERIFICATION_FAILED;
+
+        this._wiggle();
+    }
+
+    _wiggle() {
+        // Accelerate before wiggling
+        this._entry.ease({
+            translation_x: -WIGGLE_OFFSET,
+            duration: WIGGLE_DURATION,
+            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+            onComplete: () => {
+                // Wiggle
+                this._entry.ease({
+                    translation_x: WIGGLE_OFFSET,
+                    duration: WIGGLE_DURATION,
+                    mode: Clutter.AnimationMode.LINEAR,
+                    repeat_count: N_WIGGLES,
+                    auto_reverse: true,
+                    onComplete: () => {
+                        // Decelerate and return to the original position
+                        this._entry.ease({
+                            translation_x: 0,
+                            duration: WIGGLE_DURATION,
+                            mode: Clutter.AnimationMode.EASE_IN_QUAD,
+                        });
+                    }
+                });
+            }
+        });
     }
 
     _onVerificationComplete() {


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