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