summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/video/qmlvideo/qmlvideo/SceneOverlay.qml
blob: 5863d618ca4e93d959d1b744c2c627d095e32f66 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick

Scene {
    id: root
    property int margin: 20
    property string contentType

    Content {
        id: content
        anchors.centerIn: parent
        width: parent.contentWidth
        contentType: root.contentType
        source: parent.source1
        volume: parent.volume
        onVideoFramePainted: root.videoFramePainted()
    }

    Rectangle {
        id: overlay
        y: 0.5 * parent.height
        width: content.width
        height: content.height
        color: "#e0e0e0"
        opacity: 0.5

        SequentialAnimation on x {
            id: xAnimation
            loops: Animation.Infinite
            property int from: root.margin
            property int to: 100
            property int duration: 1500
            running: false
            PropertyAnimation {
                from: xAnimation.from
                to: xAnimation.to
                duration: xAnimation.duration
                easing.type: Easing.InOutCubic
            }
            PropertyAnimation {
                from: xAnimation.to
                to: xAnimation.from
                duration: xAnimation.duration
                easing.type: Easing.InOutCubic
            }
        }

        SequentialAnimation on y {
            id: yAnimation
            loops: Animation.Infinite
            property int from: root.margin
            property int to: 180
            property int duration: 1500
            running: false
            PropertyAnimation {
                from: yAnimation.from
                to: yAnimation.to
                duration: yAnimation.duration
                easing.type: Easing.InOutCubic
            }
            PropertyAnimation {
                from: yAnimation.to
                to: yAnimation.from
                duration: yAnimation.duration
                easing.type: Easing.InOutCubic
            }
        }
    }

    onWidthChanged: {
        xAnimation.to = root.width - content.width - margin
        xAnimation.start()
    }

    onHeightChanged: {
        //yAnimation.to = root.height - content.height - margin
        yAnimation.start()
    }

    Component.onCompleted: root.content = content
}