Debian Codegraph @

tests/resources/lomirishape/AnimatedShaderEffectSource.qml

raw ◀ ▶
1 Debian patch touch this file
1 /*
2 * Copyright 2015 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 // Test if the LomiriShape is correctly updated when its source is a ShaderEffectSource.
18
19 import QtQuick 2.4
20 import Lomiri.Components 1.2
21
22 Rectangle {
23 id: root
24 width: 300
25 height: 150
26 color: "#c0c0c0"
27
28 Text {
29 id: text
30 anchors.centerIn: parent
•31 font.family: "Noto Sans"
32 font.pixelSize: 34
33 color: "#c0c0c0"
34 text: "This is a scrolling text... "
35 font.bold: true
36 }
37
38 ShaderEffectSource {
39 id: effectSource
40 sourceItem: text
41 hideSource: true
42 visible: false
43 }
44
45 LomiriShape {
46 id: shape
47 anchors.fill: parent
48 anchors.margins: 50
49 backgroundColor: "black"
50 radius: "medium"
51 source: effectSource
52 sourceFillMode: LomiriShape.Pad
53 sourceHorizontalAlignment: LomiriShape.AlignLeft
54 sourceHorizontalWrapMode: LomiriShape.Repeat
55
56 PropertyAnimation on sourceTranslation {
57 from: Qt.vector2d(0.0, 0.0)
58 to: Qt.vector2d(-text.width / shape.width, 0.0)
59 loops: Animation.Infinite
60 duration: 2500
61 }
62 }
63 }