-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSpinner.qml
185 lines (160 loc) · 3.35 KB
/
Spinner.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
import QtQuick 2.3
import QtQuick.Particles 2.0
import QtGraphicalEffects 1.0
Item {
id: spinner;
property int count: 1;
property int border: 60;
property color color: '#00d4ff';
property int duration: 3000;
property var easingType: Easing.Linear;
property real from: 0;
property real to: 360;
property real unitAngle: 360 / spinner.count;
property real angleMarginFactor: 0;
property bool initialAnimation: true;
Item {
id: circle;
anchors.fill: parent;
property real angleOffset: 0;
Circle {
id: circleItem;
anchors.fill: parent;
color: spinner.color;
border: spinner.border;
mark: spinner.count;
angleMarginFactor: spinner.angleMarginFactor;
/*
SequentialAnimation on color {
loops: Animation.Infinite
running: true
ColorAnimation {
duration: spinner.duration;
to: '#33bbff';
}
ColorAnimation {
duration: spinner.duration;
to: spinner.color;
}
}
*/
/*
layer.enabled: true;
layer.effect: InnerShadow {
radius: 8;
samples: 16;
horizontalOffset: 0;
verticalOffset: 0;
spread: 0.1;
cached: true;
color: '#eeffffff';
source: circleItem;
}
*/
}
transform: Rotation {
origin.x: spinner.width * 0.5;
origin.y: spinner.height * 0.5;
angle: 0;
SequentialAnimation on angle {
loops: Animation.Infinite
running: true
NumberAnimation {
duration: spinner.duration;
easing.type: spinner.easingType;
from: spinner.from;
to: spinner.to;
}
}
}
/*
SequentialAnimation on angleOffset {
loops: Animation.Infinite
running: true
NumberAnimation {
duration: spinner.duration;
from: spinner.from;
to: spinner.to;
}
}
*/
}
SequentialAnimation on scale {
running: spinner.visible && spinner.initialAnimation;
NumberAnimation {
duration: spinner.duration / 4;
easing.type: Easing.OutBack;
from: 0;
to: 1;
}
}
/*
ParticleSystem {
id: sys1
}
ImageParticle {
system: sys1
source: 'qrc:///particleresources/glowdot.png'
color: 'cyan'
alpha: 0
SequentialAnimation on color {
loops: Animation.Infinite
ColorAnimation {
from: 'cyan'
to: 'magenta'
duration: 1000
}
ColorAnimation {
from: 'magenta'
to: 'blue'
duration: 2000
}
ColorAnimation {
from: 'blue'
to: 'violet'
duration: 2000
}
ColorAnimation {
from: 'violet'
to: 'cyan'
duration: 2000
}
}
colorVariation: 0.3
}
Emitter {
id: trailsNormal
system: sys1
emitRate: 500
lifeSpan: 4000
y: circlePath.cy
x: circlePath.cx
velocity: PointDirection { xVariation: 4; yVariation: 4; }
acceleration: PointDirection {xVariation: 10; yVariation: 10;}
velocityFromMovement: 8
size: 16;
sizeVariation: 8
}
Item {
id: circlePath
property int circleSize: spinner.height;
property int interval: spinner.duration;
property real radius: circleSize * 0.5 - spinner.border;
property real dx: parent.width / 2
property real dy: parent.height / 2
property real cx: radius * Math.sin(percent * 6.283185307179) + dx
property real cy: radius * Math.cos(percent * 6.283185307179) + dy
property real percent: 0
SequentialAnimation on percent {
loops: Animation.Infinite
running: true
NumberAnimation {
duration: circlePath.interval;
from: spinner.to / 360;
to: spinner.from / 360
loops: 8
}
}
}
*/
}