kwin/autotests/integration/effects/scripts/completeTest.js
Vlad Zagorodniy 396d528075 [scripting] Introduce complete function
Summary:
Effects that prefer to manipulate direction of animations sometimes need
to create animations in some particular state so later on they can be
played backward (swapping from and to is not enough and it would be wrong).

The proposed complete function lets such effects to fast-forward animations to
to the target position so they can be played backwards later on.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16450
2018-11-17 13:44:20 +02:00

19 lines
455 B
JavaScript

effects.windowAdded.connect(function (window) {
window.animation = set({
window: window,
curve: QEasingCurve.Linear,
duration: animationTime(1000),
type: Effect.Opacity,
from: 0,
to: 1,
keepAlive: false
});
});
effects.windowMinimized.connect(function (window) {
if (complete(window.animation)) {
sendTestResponse('ok');
} else {
sendTestResponse('fail');
}
});