Files
qml-virtualkey/VirtualKey/TouchVisualRipple.qml
MidoriYakumo 7bad729819 style fix
2016-12-12 23:36:04 +08:00

55 lines
801 B
QML

import QtQuick 2.7
import "."
Item {
function create(x, y, par, color, size, duration) {
var r = component.createObject(par);
r.cx = x;
r.cy = y;
if (color)
r.color = color;
if (size)
r.size = size;
if (duration)
r.duration = duration;
return r;
}
Component {
id: component
Rectangle {
id: ripple
property int cx: 1
property int cy: 1
property int size: Units.gu// * 2
property int duration: 1000
width: 1
height: width
radius: width
x: cx-width/2
y: cy-height/2
opacity: (1-(width/size))*.7
color: "skyblue"
Behavior on width {
NumberAnimation {
duration: ripple.duration
}
}
onOpacityChanged: {
if (opacity <= 0)
destroy();
}
Component.onCompleted: {
width = size + 1;
}
}
}
}