| 1 |
/**************************************************************************** |
| 2 |
** |
| 3 |
** Copyright (C) 2020 The Qt Company Ltd. |
| 4 |
** Contact: https://www.qt.io/licensing/ |
| 5 |
** |
| 6 |
** This file is part of the test suite of the Qt Toolkit. |
| 7 |
** |
| 8 |
** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
| 9 |
** Commercial License Usage |
| 10 |
** Licensees holding valid commercial Qt licenses may use this file in |
| 11 |
** accordance with the commercial license agreement provided with the |
| 12 |
** Software or, alternatively, in accordance with the terms contained in |
| 13 |
** a written agreement between you and The Qt Company. For licensing terms |
| 14 |
** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 |
** information use the contact form at https://www.qt.io/contact-us. |
| 16 |
** |
| 17 |
** GNU General Public License Usage |
| 18 |
** Alternatively, this file may be used under the terms of the GNU |
| 19 |
** General Public License version 3 as published by the Free Software |
| 20 |
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
| 21 |
** included in the packaging of this file. Please review the following |
| 22 |
** information to ensure the GNU General Public License requirements will |
| 23 |
** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 24 |
** |
| 25 |
** $QT_END_LICENSE$ |
| 26 |
** |
| 27 |
****************************************************************************/ |
| 28 |
|
| 29 |
import QtQuick 2.12 |
| 30 |
|
| 31 |
Item { |
| 32 |
id: root |
| 33 |
width: 640 |
| 34 |
height: 480 |
| 35 |
objectName: "qtbug86402Container" |
| 36 |
|
| 37 |
property bool finished |
| 38 |
|
| 39 |
Item { |
| 40 |
id: popup |
| 41 |
objectName: "popup" |
| 42 |
width: 200 |
| 43 |
height: 200 |
| 44 |
|
| 45 |
Rectangle { |
| 46 |
id: rect |
| 47 |
objectName: "rect" |
| 48 |
implicitWidth: 100 |
| 49 |
implicitHeight: 100 |
| 50 |
color: "blue" |
| 51 |
|
| 52 |
Item { |
| 53 |
id: ripple |
| 54 |
objectName: "ripple" |
| 55 |
anchors.fill: parent |
| 56 |
visible: false |
| 57 |
|
| 58 |
Rectangle { |
| 59 |
id: rippleBox |
| 60 |
objectName: "rippleBox" |
| 61 |
property real cx |
| 62 |
property real cy |
| 63 |
x: cx - width / 2 |
| 64 |
y: cy - height / 2 |
| 65 |
width: 0 |
| 66 |
height: width |
| 67 |
radius: width / 2 |
| 68 |
color: Qt.darker("red", 1.8) |
| 69 |
} |
| 70 |
layer.effect: ShaderEffect { |
| 71 |
id: mask |
| 72 |
objectName: "shaderEffect" |
| 73 |
property variant source |
| 74 |
property variant mask: rect |
| 75 |
|
| 76 |
fragmentShader: " |
| 77 |
uniform lowp sampler2D source; |
| 78 |
uniform lowp sampler2D mask; |
| 79 |
varying highp vec2 qt_TexCoord0; |
| 80 |
void main() { |
| 81 |
gl_FragColor = texture2D(source, qt_TexCoord0) * texture2D(mask, qt_TexCoord0).a; |
| 82 |
}" |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
SequentialAnimation { |
| 87 |
id: rippleStartAnimation |
| 88 |
running: popup.visible |
| 89 |
onFinished: { |
| 90 |
popup.parent = null |
| 91 |
rippleEndAnimation.start() |
| 92 |
} |
| 93 |
|
| 94 |
ScriptAction { |
| 95 |
script: { |
| 96 |
rippleBox.width = 0 |
| 97 |
rippleBox.opacity = 0.3 |
| 98 |
ripple.visible = true |
| 99 |
ripple.layer.enabled = true |
| 100 |
} |
| 101 |
} |
| 102 |
NumberAnimation { |
| 103 |
target: rippleBox |
| 104 |
property: "width" |
| 105 |
from: 0 |
| 106 |
to: Math.max(rect.width, |
| 107 |
rect.height) * 2.2 |
| 108 |
duration: 100 |
| 109 |
} |
| 110 |
} |
| 111 |
SequentialAnimation { |
| 112 |
id: rippleEndAnimation |
| 113 |
|
| 114 |
onFinished: root.finished = true |
| 115 |
|
| 116 |
//Causes Crash on QT Versions > 5.12.5 |
| 117 |
NumberAnimation { |
| 118 |
target: rippleBox |
| 119 |
property: "opacity" |
| 120 |
to: 0 |
| 121 |
duration: 100 |
| 122 |
} |
| 123 |
ScriptAction { |
| 124 |
script: { |
| 125 |
rippleBox.opacity = 0 |
| 126 |
ripple.layer.enabled = false |
| 127 |
ripple.visible = false |
| 128 |
} |
| 129 |
} |
| 130 |
} |
| 131 |
} |
| 132 |
} |
| 133 |
} |