summaryrefslogtreecommitdiffstats
path: root/examples/declarative/effects/test.qml
blob: 73c6839dd7ddc22b64c83949867134c2ab655f55 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import Qt 4.6

Rectangle {
    color: "white"
    width: 600
    height: 600

    Image {
        id: blur
        source: "pic.jpg"

        effect: Blur {
            blurRadius: NumberAnimation {
                id: blurEffect
                from: 0; to: 10
                duration: 200
                repeat: true
            }
        }

        MouseRegion { anchors.fill: parent; onClicked: blurEffect.running = !blurEffect.running }
    }

    Text { text: "Blur"; anchors.top: blur.bottom; anchors.horizontalCenter: blur.horizontalCenter }

    Image {
        id: grayscale
        source: "pic.jpg"
        x: 200

        effect: Grayscale {}
    }

    Text { text: "Grayscale"; anchors.top: grayscale.bottom; anchors.horizontalCenter: grayscale.horizontalCenter }

    Image {
        id: colorize
        source: "pic.jpg"
        x: 400

        effect: Colorize { color: "blue" }
    }

    Text { text: "Colorize"; anchors.top: colorize.bottom; anchors.horizontalCenter: colorize.horizontalCenter }

    Image {
        id: pixelize
        source: "pic.jpg"
        y: 300

        effect: Pixelize {
            pixelSize: NumberAnimation {
                id: pixelizeEffect
                from: 0; to: 10
                duration: 200
                repeat: true
            }
        }

        MouseRegion { anchors.fill: parent; onClicked: pixelizeEffect.running = !pixelizeEffect.running }
    }

    Text { text: "Pixelize"; anchors.top: pixelize.bottom; anchors.horizontalCenter: pixelize.horizontalCenter }

    Image {
        id: dropShadow
        source: "pic.jpg"
        x: 200
        y: 300

        effect: DropShadow {
            blurRadius: 3
            offset.x: 3
            offset.y: NumberAnimation { id: dropShadowEffect; from: 0; to: 10; duration: 200; repeat: true; }
        }

        MouseRegion { anchors.fill: parent; onClicked: dropShadowEffect.running = !dropShadowEffect.running }
    }

    Text { text: "Drop Shadow"; anchors.top: dropShadow.bottom; anchors.horizontalCenter: dropShadow.horizontalCenter }

    Image {
        id: bloom
        source: "pic.jpg"
        x: 400
        y: 300

        effect: Bloom {
            blurRadius: 3
            brightness: 128
            strength: NumberAnimation {
                id: bloomEffect
                from: 0; to: 1
                duration: 200
                repeat: true
            }
        }

        MouseRegion { anchors.fill: parent; onClicked: bloomEffect.running = !bloomEffect.running }
    }

    Text { text: "Bloom"; anchors.top: bloom.bottom; anchors.horizontalCenter: bloom.horizontalCenter }

    Text {
        x: 100; y: 250
        text: "Clicking Blur, Pixelize, Drop Shadow or Bloom will \ntoggle animation."
        color: "black"
    }

}