forked from skhaz/qtquick-nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nebula.qml
executable file
·79 lines (66 loc) · 2.11 KB
/
nebula.qml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// "THE BEER-WARE LICENSE" (Revision 42):
// Rodrigo 'Skhaz' Delduca wrote this file. As long as you retain this notice you
// can do whatever you want with this stuff. If we meet some day, and you think
// this stuff is worth it, you can buy me a beer
//
// based on http://www.professorcloud.com/mainsite/canvas-nebula.htm
import QtQuick 1.1
Rectangle {
width: 570
height: 570
color: "black"
Repeater {
id: repeater
model: 8
Rectangle {
id: rect
visible: false
color: "transparent"
clip: true
width: 285; height: 285
x: parent.width / 2 - width / 2
y: parent.height / 2 - height / 2
Timer {
id: timer
interval: 500 * index
running: true
repeat: false
onTriggered: {
rect.visible = true
animation.running = true
}
}
Image {
source: "nebula.jpg"
smooth: true
x: -1 * (Math.random() * 285) >> 0
y: -1 * (Math.random() * 285) >> 0
}
ParallelAnimation {
id: animation
running: false
loops: Animation.Infinite
SequentialAnimation {
NumberAnimation {
target: rect
property: "opacity"
from: .0; to: 1.0
duration: 3000
}
NumberAnimation {
target: rect
property: "opacity"
from: 1.0; to: .0
duration: 500
}
}
NumberAnimation {
target: rect
property: "scale"
from: 2.0; to: 4.0
duration: 4000
}
}
}
}
}