forked from AIIX/Mycroft-Ai-QtApplication
-
Notifications
You must be signed in to change notification settings - Fork 4
/
TopBarAnim.qml
152 lines (125 loc) · 4.93 KB
/
TopBarAnim.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
import QtQuick 2.5
Item {
//property alias topanimrun: seqrun.running
//anchors.fill: parent
function wsistalking() {
seqrun.running = true
canvasmiddlegraphics.visible = !canvasmiddlegraphics.visible
}
SequentialAnimation {
id: seqrun
ParallelAnimation {
NumberAnimation{
target: canvasmiddlegraphics
property: "i"
from: -50
to: -70
duration: 200
}
SequentialAnimation {
loops: 10
ParallelAnimation {
NumberAnimation{
target: canvasmiddlegraphics
property: "amplitude"
from: 0
to: 10 + Math.floor(Math.random() * 6) + 1
duration: 12
}
}
ParallelAnimation {
NumberAnimation{
target: canvasmiddlegraphics
property: "amplitude"
from: 10
to: 16 + Math.floor(Math.random() * 2) + 1
duration: 12
}
}
ParallelAnimation{
NumberAnimation{
target: canvasmiddlegraphics
property: "amplitude"
from: 16 + Math.floor(Math.random() * 2) + 1
to: 10 + Math.floor(Math.random() * 6) + 1
duration: 12
}
}
ParallelAnimation {
NumberAnimation{
target: canvasmiddlegraphics
property: "amplitude"
from: 10 + Math.floor(Math.random() / 6) + 1
to: 0
duration: 12
}
}
}
}
ParallelAnimation {
PropertyAnimation {
target: canvasmiddlegraphics
property: "visible"
from: true
to: false
duration: 20
}
}
}
Canvas {
id:canvasmiddlegraphics
width: parent.width
height: parent.height
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
visible: true
property color strokeStyle: Qt.darker(fillStyle, 1.5)
property color fillStyle: Qt.darker("deepskyblue", 1.1)
property real lineWidth: 1.6
property bool fill: true
property bool stroke: false
property real alpha: 1.0
property real scale : 1
property real rotate : 0
property real i: -50
property real waveSpeed: 10
property real amplitude: 0
antialiasing: true
smooth: true
onLineWidthChanged:requestPaint();
onFillChanged:requestPaint();
onStrokeChanged:requestPaint();
onScaleChanged:requestPaint();
onRotateChanged:requestPaint();
onIChanged: requestPaint();
renderTarget: Canvas.FramebufferObject
renderStrategy: Canvas.Cooperative
onPaint: {
var ctxside = canvasmiddlegraphics.getContext('2d');
var hCenter = width * 0.5
var vCenter = height * 0.5
var size = 12
var period = 15;
var dotSpeed = 5;
function draw_line(i){
var oStartx=0;
var oStarty=( height / 2 )
ctxside.beginPath();
ctxside.moveTo( oStartx, oStarty + amplitude * Math.sin( x / period + ( i / 5 ) ) );
ctxside.lineWidth = 1;
ctxside.strokeStyle = 'steelblue';
for(var Vx = oStartx; Vx < width * 1; Vx++) {
var Vy = amplitude * Math.sin( Vx / period + ( i / 5 + Math.floor(Math.random() * 2) + 0));
ctxside.lineTo( oStartx + Vx, oStarty + Vy);
}
ctxside.stroke();
}
function render(){
var st = i
ctxside.clearRect(0, 0, width, height);
draw_line(st)
}
render();
}
}
}