aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/material/StackView.qml
blob: c3182442a2a4312fabd01e76738301d280d2b24d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.Material

T.StackView {
    id: control

    component LineAnimation: NumberAnimation {
        duration: 200
        easing.type: Easing.OutCubic
    }

    component FadeIn: LineAnimation {
        property: "opacity"
        from: 0.0
        to: 1.0
    }

    component FadeOut: LineAnimation {
        property: "opacity"
        from: 1.0
        to: 0.0
    }

    popEnter: Transition {
        // slide_in_left
        LineAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) *  -control.width; to: 0 }
        FadeIn {}
    }

    popExit: Transition {
        // slide_out_right
        LineAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * control.width }
        FadeOut {}
    }

    pushEnter: Transition {
        // slide_in_right
        LineAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) * control.width; to: 0 }
        FadeIn {}
    }

    pushExit: Transition {
        // slide_out_left
        LineAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * -control.width }
        FadeOut {}
    }

    replaceEnter: Transition {
        // slide_in_right
        LineAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) * control.width; to: 0 }
        FadeIn {}
    }

    replaceExit: Transition {
        // slide_out_left
        LineAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * -control.width }
        FadeOut {}
    }
}