id: root;
property var snow: [];
- readonly property int snowCount: 100;
+ readonly property int snowCount: 25;
readonly property int screenWidth: Qt.application.screens[0].width;
readonly property int screenHeight: Qt.application.screens[0].height;
onClicked: {
- //var screenWidth = Qt.application.screens[0].width;
- //var screenHeight = Qt.application.screens[0].height;
-
for (var i = 0; i < snowCount; i++) {
var component = Qt.createComponent("snowWindow.qml");
snow[i].x = Math.random() * screenWidth;
snow[i].y = Math.random() * screenHeight;
-
+
+ snow[i].width = (Math.random() * 100) % snow[i].radius;
+ snow[i].height = snow[i].width;
+
snow[i].showMaximized();
}
snow[i].x = 1440;
}
- snow[i].y += 2;
+ //snow[i].y += 2;
+ snow[i].y += snow[i].fallingSpeed;
if (snow[i].y > screenHeight) {
+ //snow[i].y = 0;
+
+ snow[i].close();
+ snow[i].destroy();
+
+ var component = Qt.createComponent("snowWindow.qml");
+ snow[i] = component.createObject(root);
+
+ snow[i].x = Math.random() * screenWidth;
snow[i].y = 0;
+ snow[i].width = (Math.random() * 100) % snow[i].radius;
+ snow[i].height = snow[i].width;
+
+ snow[i].showMaximized();
+
}
+
+ if(snow[i].rotationDirection == 0) {
+ snow[i].snowFlakeRotation += snow[i].rotationSpeed;
+ } else {
+ snow[i].snowFlakeRotation -= snow[i].rotationSpeed;
+ }
+
}
}
}
id: root;
property int dir: (Math.random() * 100) % 2; /* could go either left or right */
+ property int radius: 100; /* size of snowflake */
property int swirl: (Math.random() * 1000) % 55 + 2; /* random falling 'swirl' */
property int disposition: 0;
+ property alias snowFlakeRotation: snowFlake.rotation;
+ property int rotationSpeed: (Math.random() * 100) % 3 + 1; /* falling rotation */
+ property int rotationDirection: (Math.random() * 100) % 2;
+ property int fallingSpeed: (Math.random() * 100) % 3 + 2;
- width: 3; height: 3;
- //x: 500; y: 500;
- opacity: 1;
- //title: qsTr("Snowy")
+ //width: 80; height: 80;
+ opacity: 0.5;
+ color: "transparent";
flags: Qt.WindowStaysOnTopHint
| Qt.FramelessWindowHint
| Qt.WA_TranslucentBackground
| Qt.X11BypassWindowManagerHint;
+ Rectangle {
+
+ id: snowFlake;
+
+ anchors.fill: parent;
+ //radius: 3;
+ color: "transparent";
+
+ Image {
+ id: snowFlakeImage;
+
+ anchors.fill: parent;
+ source: "../images/snow1.png";
+ }
+
+ }
+
+
}