Warning, /plasma/polkit-kde-agent-1/qml/RejectPasswordPathAnimation.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2022 ivan (@ratijas) tkachenko <me@ratijas.tk>
0003
0004 SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 import QtQuick 2.15
0007 import QtQml 2.15
0008
0009 import org.kde.kirigami 2.20 as Kirigami
0010
0011 PathAnimation {
0012 id: root
0013
0014 /** The magnitude/distance/offset of the animation, in the usual device-independent pixels. */
0015 property real swing: 15
0016
0017 /**
0018 * In which direction the target starts moving first.
0019 * Must be either Qt.LeftToRight or Qt.RightToLeft.
0020 *
0021 * By default it is opposite to the application's layout direction, to
0022 * make an animation feel more "disturbing".
0023 */
0024 property int initialDirection: Qt.application.layoutDirection === Qt.RightToLeft ? Qt.LeftToRight : Qt.RightToLeft
0025
0026 alwaysRunToEnd: true
0027
0028 // This animation's speed does not depend on user preferences, except when
0029 // we honor the "reduced animations" special case.
0030 // Animators with a duration of 0 do not fire reliably, which is why duration is at least 1.
0031 // see Bug 357532 and QTBUG-39766
0032 duration: Kirigami.Units.longDuration <= 1 ? 1 : 600
0033 easing.type: Easing.OutCubic
0034
0035 path: Path {
0036 PathPolyline {
0037 path: {
0038 const directionFactor = root.initialDirection === Qt.RightToLeft ? -1 : 1;
0039 const extreme = root.swing * directionFactor;
0040 const here = Qt.point(extreme, 0);
0041 const there = Qt.point(-extreme, 0);
0042 return [
0043 Qt.point(0, 0),
0044 here, there,
0045 here, there,
0046 here, there,
0047 Qt.point(0, 0),
0048 ];
0049 }
0050 }
0051 }
0052 }
0053