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

@ -188,7 +188,7 @@ var WorkspacesView = class extends WorkspacesViewBase {
for (let w = 0; w < this._workspaces.length; w++) {
let workspace = this._workspaces[w];
Tweener.removeTweens(workspace.actor);
workspace.actor.remove_all_transitions();
let params = {};
if (workspaceManager.layout_rows == -1)
@ -199,21 +199,21 @@ var WorkspacesView = class extends WorkspacesViewBase {
params.x = (w - active) * this._fullGeometry.width;
if (showAnimation) {
let tweenParams = Object.assign(params, {
time: WORKSPACE_SWITCH_TIME / 1000,
transition: 'easeOutQuad'
let easeParams = Object.assign(params, {
duration: WORKSPACE_SWITCH_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD
});
// we have to call _updateVisibility() once before the
// animation and once afterwards - it does not really
// matter which tween we use, so we pick the first one ...
if (w == 0) {
this._updateVisibility();
tweenParams.onComplete = () => {
easeParams.onComplete = () => {
this._animating = false;
this._updateVisibility();
};
}
Tweener.addTween(workspace.actor, tweenParams);
workspace.actor.ease(easeParams);
} else {
workspace.actor.set(params);
if (w == 0)