summaryrefslogtreecommitdiffstats
path: root/examples/declarative/effects/effects.qml
blob: feb7c69e5ef9cb5e72abea6d865f8b5cd471fd9c (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
import Qt 4.7

Rectangle {
    width: 400; height: 200

    Image {
        id: blur
        x: 5
        source: "pic.png"

        effect: Blur {
            NumberAnimation on blurRadius {
                id: blurEffect
                running: false
                from: 0; to: 10
                duration: 1000
                loops: Animation.Infinite
            }
        }

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

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

    Image {
        id: dropShadow
        source: "pic.png"
        x: 135

        effect: DropShadow {
            blurRadius: 3
            offset.x: 3

            NumberAnimation on offset.y {
                id: dropShadowEffect
                from: 0; to: 10
                duration: 1000
                running: false
                loops: Animation.Infinite
            }
        }

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

    Image {
        id: colorize
        source: "pic.png"
        x: 265

        effect: Colorize { color: "blue" }
    }

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

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

    Text {
        y: 155; anchors.horizontalCenter: parent.horizontalCenter
        text: "Clicking Blur or Drop Shadow will \ntoggle animation."
        color: "black"
    }

}