screenShield: Stop using custom transition

For animating the arrows on the screenshield, we currently use a custom
transition function that tweens the opacity from 0 to maxOpacity in the
first half of the animation, and from maxOpacity back to 0 in the second
half.

This doesn't easily translate to Clutter's own animation framework, so
replace the custom transition with two consecutive tweens which do.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22
This commit is contained in:
Florian Müllner 2019-07-26 02:38:49 +02:00
parent 8eb88d17fe
commit 5d6db923b7

View File

@ -5,7 +5,6 @@ const { AccountsService, Clutter, Cogl, Gio, GLib,
const Cairo = imports.cairo;
const Mainloop = imports.mainloop;
const Signals = imports.signals;
const TweenerEquations = imports.tweener.equations;
const Background = imports.ui.background;
const GnomeSession = imports.misc.gnomeSession;
@ -736,14 +735,16 @@ var ScreenShield = class {
for (let i = 0; i < arrows.length; i++) {
arrows[i].opacity = 0;
Tweener.addTween(arrows[i],
{ opacity: 0,
{ opacity: maxOpacity,
delay: (unitaryDelay * (N_ARROWS - (i + 1))) / 1000,
time: ARROW_ANIMATION_TIME / 1000,
transition(t, b, c, d) {
if (t < d / 2)
return TweenerEquations.easeOutQuad(t, 0, maxOpacity, d / 2);
else
return TweenerEquations.easeInQuad(t - d / 2, maxOpacity, -maxOpacity, d / 2);
time: ARROW_ANIMATION_TIME / (2 * 1000),
transition: 'easeOutQuad',
onComplete: () => {
Tweener.addTween(arrors[i], {
opacity: 0,
time: ARROW_ANIMATION_TIME / (2 * 1000),
transition: 'easeInQuad'
});
}
});
}