js: Use implicit animations for animatable properties

We now have everything in place to replace Tweener for all animatable
properties with implicit animations, which has the following benefits:

 - they run entirely in C, while Tweener requires context switches
   to JS each frame

 - they are more reliable, as Tweener only detects when an animation
   is overwritten with another Tween, while Clutter considers any
   property change

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22
This commit is contained in:
Florian Müllner
2018-07-20 21:46:19 +02:00
parent 007b6ca2e8
commit 0846238f69
38 changed files with 1004 additions and 998 deletions

View File

@ -1,6 +1,5 @@
/* exported PointerA11yTimeout */
const { Clutter, GLib, GObject, Meta, St } = imports.gi;
const Tweener = imports.ui.tweener;
const Main = imports.ui.main;
const Cairo = imports.cairo;
@ -57,7 +56,7 @@ class PieTimer extends St.DrawingArea {
}
start(x, y, duration) {
Tweener.removeTweens(this);
this.remove_all_transitions();
this.x = x - this.width / 2;
this.y = y - this.height / 2;
@ -67,16 +66,16 @@ class PieTimer extends St.DrawingArea {
this._startTime = GLib.get_monotonic_time() / 1000.0;
this._duration = duration;
Tweener.addTween(this,
{ opacity: 255,
time: duration / 1000,
transition: 'easeOutQuad',
onComplete: () => this.stop()
});
this.ease({
opacity: 255,
duration,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => this.stop()
});
}
stop() {
Tweener.removeTweens(this);
this.remove_all_transitions();
this.hide();
}
});