authPrompt: Wiggle on failure

WIP
This commit is contained in:
Georges Basile Stavracas Neto 2019-10-15 21:34:35 +02:00
parent e5091ff17c
commit 6fd0aafada

View File

@ -16,6 +16,10 @@ var DEFAULT_BUTTON_WELL_ANIMATION_TIME = 300;
var MESSAGE_FADE_OUT_ANIMATION_TIME = 500; var MESSAGE_FADE_OUT_ANIMATION_TIME = 500;
const WIGGLE_OFFSET = 6;
const WIGGLE_DURATION = 65;
const N_WIGGLES = 3;
var AuthPromptMode = { var AuthPromptMode = {
UNLOCK_ONLY: 0, UNLOCK_ONLY: 0,
UNLOCK_OR_LOG_IN: 1 UNLOCK_OR_LOG_IN: 1
@ -200,6 +204,35 @@ var AuthPrompt = class {
this.updateSensitivity(canRetry); this.updateSensitivity(canRetry);
this.setActorInDefaultButtonWell(null); this.setActorInDefaultButtonWell(null);
this.verificationStatus = AuthPromptStatus.VERIFICATION_FAILED; 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() { _onVerificationComplete() {