Warning, /plasma-mobile/mycroft-plasmoid-mobile/plasmoid/contents/ui/LeftBarAnim.qml is written in an unsupported language. File is not indexed.

0001 /* Copyright 2016 Aditya Mehra <aix.m@outlook.com>                            
0002 
0003     This library is free software; you can redistribute it and/or
0004     modify it under the terms of the GNU Lesser General Public
0005     License as published by the Free Software Foundation; either
0006     version 2.1 of the License, or (at your option) version 3, or any
0007     later version accepted by the membership of KDE e.V. (or its
0008     successor approved by the membership of KDE e.V.), which shall
0009     act as a proxy defined in Section 6 of version 3 of the license.
0010     
0011     This library is distributed in the hope that it will be useful,
0012     but WITHOUT ANY WARRANTY; without even the implied warranty of
0013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014     Lesser General Public License for more details.
0015     
0016     You should have received a copy of the GNU Lesser General Public
0017     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 import QtQuick 2.9
0021 import QtQuick.Controls 2.2
0022 import QtQuick.Layouts 1.3
0023 
0024 Item {
0025 property bool wsocketMsg: false
0026 
0027 function wsocmsganimtoggle() { onreadyanim.running = true; }
0028 
0029         SequentialAnimation {
0030          id: onconanim
0031          ParallelAnimation{
0032             PropertyAnimation {
0033                     target: canvascentersmallgraphic
0034                     property: "anchors.horizontalCenterOffset"
0035                     from: 0
0036                     to: 9
0037                     duration: 300
0038                 }
0039 
0040             PropertyAnimation {
0041                     target: canvascentersmallgraphic
0042                     property: "anchors.verticalCenterOffset"
0043                     from: -13
0044                     to: -9
0045                     duration: 300
0046                     }
0047                 }
0048 
0049             ParallelAnimation{
0050                 PropertyAnimation {
0051                         target: canvascentersmallgraphic
0052                         property: "anchors.horizontalCenterOffset"
0053                         from: 9
0054                         to: 10.5
0055                         duration: 300
0056                     }
0057 
0058             PropertyAnimation {
0059                         target: canvascentersmallgraphic
0060                         property: "anchors.verticalCenterOffset"
0061                         from: -9
0062                         to: -6
0063                         duration: 300
0064                         }
0065                     }
0066             ParallelAnimation{
0067 
0068              PropertyAnimation {
0069                         target: canvascentersmallgraphic
0070                         property: "anchors.horizontalCenterOffset"
0071                         from: 10.5
0072                         to: 11.5
0073                         duration: 300
0074                     }
0075 
0076             PropertyAnimation {
0077                         target: canvascentersmallgraphic
0078                         property: "anchors.verticalCenterOffset"
0079                         from: -6
0080                         to: 6
0081                         duration: 300
0082                         }
0083                     }
0084 
0085         ParallelAnimation{
0086 
0087         PropertyAnimation {
0088                     target: canvascentersmallgraphic
0089                     property: "anchors.horizontalCenterOffset"
0090                     from: 11.5
0091                     to: 10.5
0092                     duration: 300
0093                 }
0094 
0095         PropertyAnimation {
0096                     target: canvascentersmallgraphic
0097                     property: "anchors.verticalCenterOffset"
0098                     from: 6
0099                     to: 9
0100                     duration: 300
0101                     }
0102                 }
0103 
0104         ParallelAnimation{
0105 
0106         PropertyAnimation {
0107                     target: canvascentersmallgraphic
0108                     property: "anchors.horizontalCenterOffset"
0109                     from: 10.5
0110                     to: 0
0111                     duration: 300
0112                 }
0113 
0114         PropertyAnimation {
0115                     target: canvascentersmallgraphic
0116                     property: "anchors.verticalCenterOffset"
0117                     from: 9
0118                     to: 13
0119                     duration: 300
0120                     }
0121                 }
0122 
0123         ParallelAnimation{
0124 
0125         PropertyAnimation {
0126                     target: canvascentersmallgraphic
0127                     property: "anchors.horizontalCenterOffset"
0128                     from: 0
0129                     to: -9
0130                     duration: 300
0131                 }
0132 
0133         PropertyAnimation {
0134                     target: canvascentersmallgraphic
0135                     property: "anchors.verticalCenterOffset"
0136                     from: 13
0137                     to: 9
0138                     duration: 300
0139                     }
0140                 }
0141 
0142         ParallelAnimation{
0143 
0144         PropertyAnimation {
0145                     target: canvascentersmallgraphic
0146                     property: "anchors.horizontalCenterOffset"
0147                     from: -9
0148                     to: -10.5
0149                     duration: 300
0150                 }
0151 
0152         PropertyAnimation {
0153                     target: canvascentersmallgraphic
0154                     property: "anchors.verticalCenterOffset"
0155                     from: 9
0156                     to: 6
0157                     duration: 300
0158                     }
0159                 }
0160 
0161         ParallelAnimation{
0162 
0163          PropertyAnimation {
0164                     target: canvascentersmallgraphic
0165                     property: "anchors.horizontalCenterOffset"
0166                     from: -10.5
0167                     to: -11.5
0168                     duration: 300
0169                 }
0170 
0171         PropertyAnimation {
0172                     target: canvascentersmallgraphic
0173                     property: "anchors.verticalCenterOffset"
0174                     from: 6
0175                     to: -6
0176                     duration: 300
0177                     }
0178                 }
0179         ParallelAnimation{
0180 
0181         PropertyAnimation {
0182                     target: canvascentersmallgraphic
0183                     property: "anchors.horizontalCenterOffset"
0184                     from: -11.5
0185                     to: -10.5
0186                     duration: 300
0187                 }
0188 
0189         PropertyAnimation {
0190                     target: canvascentersmallgraphic
0191                     property: "anchors.verticalCenterOffset"
0192                     from: -6
0193                     to: -9
0194                     duration: 300
0195                     }
0196                 }
0197         ParallelAnimation{
0198 
0199         PropertyAnimation {
0200                     target: canvascentersmallgraphic
0201                     property: "anchors.horizontalCenterOffset"
0202                     from: -10.5
0203                     to: 0
0204                     duration: 300
0205                 }
0206 
0207         PropertyAnimation {
0208                     target: canvascentersmallgraphic
0209                     property: "anchors.verticalCenterOffset"
0210                     from: -9
0211                     to: -13
0212                     duration: 300
0213                     }
0214                 }
0215         }
0216 
0217         SequentialAnimation {
0218          id: onreadyanim
0219             PropertyAnimation {
0220                     target: canvascentersmallgraphic
0221                     property: "anchors.verticalCenterOffset"
0222                     from: -8
0223                     to: 0
0224                     duration: 200
0225                 }
0226 
0227             ParallelAnimation {
0228              PropertyAnimation {
0229                    target: canvascenterhalfgraphic;
0230                    property: "mpie";
0231                    from: 3
0232                    to: 4
0233                    duration: 600
0234                    }
0235 
0236              PropertyAnimation {
0237                 target: canvascentersmallgraphic;
0238                 property: "mpie";
0239                 from: 1
0240                 to: 6
0241                 duration: 600
0242                 }
0243 
0244 //              RotationAnimator {
0245 //                  target: canvascenterbiggraphic;
0246 //                  from: 0;
0247 //                  to: 720;
0248 //                  duration: 2000
0249 //                 }
0250 // 
0251 //              RotationAnimator {
0252 //                  target: canvascenterbggraphic;
0253 //                  from: 0;
0254 //                  to: 90;
0255 //                  duration: 1000
0256 //                 }
0257             }
0258 
0259          ParallelAnimation{
0260             PropertyAnimation {
0261                     target: canvascentersmallgraphic
0262                     property: "anchors.verticalCenterOffset"
0263                     from: 0
0264                     to: -8
0265                     duration: 200
0266                 }
0267              PropertyAnimation {
0268                 target: canvascentersmallgraphic;
0269                 property: "mpie";
0270                 from: 6
0271                 to: 1
0272                 duration: 200
0273                 }
0274 
0275              PropertyAnimation {
0276                    target: canvascenterhalfgraphic;
0277                    property: "mpie";
0278                    from: 4
0279                    to: 3
0280                    duration: 600
0281                    }
0282 
0283 //              RotationAnimator {
0284 //                  target: canvascenterbggraphic;
0285 //                  from: 90;
0286 //                  to: 0;
0287 //                  duration: 1000
0288 //                 }
0289 
0290             }
0291         }
0292 
0293 
0294 
0295             Canvas {
0296                         id:canvascenterbggraphic
0297                         width: parent.width
0298                         height: parent.height
0299                         anchors.verticalCenter: parent.verticalCenter
0300                         anchors.horizontalCenter: parent.horizontalCenter
0301 
0302                         property color strokeStyle:  Qt.darker(fillStyle, 1.5)
0303                         property color fillStyle: Qt.darker("deepskyblue", 1.1)
0304                         property real lineWidth: 1.6
0305                         property bool fill: true
0306                         property bool stroke: false
0307                         property real alpha: 1.0
0308                         property real scale : 1
0309                         property real rotate : 0
0310                         antialiasing: true
0311                         smooth: true
0312 
0313                         onLineWidthChanged:requestPaint();
0314                         onFillChanged:requestPaint();
0315                         onStrokeChanged:requestPaint();
0316                         //onScaleChanged:requestPaint();
0317                         onRotateChanged:requestPaint();
0318 
0319                         renderTarget: Canvas.FramebufferObject
0320                         renderStrategy: Canvas.Cooperative
0321 
0322 
0323             onPaint: {
0324                             var ctxside = canvascenterbggraphic.getContext('2d');
0325                             var hCenter = width * 0.5
0326                             var vCenter = height * 0.5
0327                             var numberOfSides = 6
0328                             var size = 12
0329 
0330                             ctxside.save();
0331                             ctxside.clearRect(0, 0, canvascenterbggraphic.width, canvascenterbggraphic.height);
0332                             ctxside.globalAlpha = canvascenterbggraphic.alpha;
0333                             ctxside.strokeStyle = canvascenterbggraphic.strokeStyle;
0334                             ctxside.fillStyle = canvascenterbggraphic.fillStyle;
0335                             ctxside.lineWidth = canvascenterbggraphic.lineWidth;
0336                             ctxside.scale(canvascenterbggraphic.scale, canvascenterbggraphic.scale);
0337                             ctxside.rotate(canvascenterbggraphic.rotate);
0338                             ctxside.lineJoin = "round";
0339                             ctxside.lineCap = "round";
0340 
0341                             ctxside.beginPath();
0342                             ctxside.moveTo(hCenter +  size * Math.sin(0), vCenter +  size *  Math.cos(0));
0343 
0344                            for (var i = 1; i <= numberOfSides;i += 1) {
0345                             ctxside.lineTo(hCenter + size * Math.sin(i * 2 * Math.PI / numberOfSides), vCenter + size * Math.cos(i * 2 * Math.PI / numberOfSides));
0346                             }
0347                             ctxside.closePath();
0348                             ctxside.fill();
0349                             ctxside.stroke();
0350 
0351                             if (canvascenterbggraphic.fill)
0352                                ctxside.fill();
0353                             if (canvascenterbggraphic.stroke)
0354                                ctxside.stroke();
0355                                ctxside.restore();
0356                 }
0357              }
0358 
0359             Canvas {
0360                                 id:canvascenterbiggraphic
0361                                 width: parent.width
0362                                 height: parent.height
0363                                 anchors.verticalCenter: parent.verticalCenter
0364                                 anchors.horizontalCenter: parent.horizontalCenter
0365                                 anchors.horizontalCenterOffset: 0;
0366                                 anchors.verticalCenterOffset: 0;
0367                                 transformOrigin: Item.Center
0368                                 //anchors.left: canvasleftline.left
0369 
0370                                 //property real viewScale: base.parent.scale
0371 
0372                                 property color strokeStyle:  "white"//Qt.darker("white", 1.4)
0373                                 property color fillStyle: "lightsteelblue" // red
0374                                 property real lineWidth: 1.2
0375                                 property bool fill: false
0376                                 property bool stroke: false
0377                                 property real alpha: 1.0
0378                                 property real scale : 1
0379                                 property real rotate : 0
0380                                 property real mpie: 5
0381                                 antialiasing: true
0382                                 smooth: true
0383 
0384                                 onLineWidthChanged:requestPaint();
0385                                 onFillChanged:requestPaint();
0386                                 onStrokeChanged:requestPaint();
0387                                 onScaleChanged:requestPaint();
0388                                 onRotateChanged:requestPaint();
0389                                 onFillStyleChanged:requestPaint();
0390 
0391                             renderTarget: Canvas.FramebufferObject
0392                                 renderStrategy: Canvas.Cooperative
0393 
0394 
0395                     onPaint: {
0396                                     var ctxcircle = canvascenterbiggraphic.getContext('2d');
0397                                     var offleftcenter = width * 0.50
0398                                     var offrightcenter = width * 0.50
0399                                     var vCenter = height * 0.5
0400                                     var vDelta = height / 6
0401 
0402                                     ctxcircle.save();
0403                                     ctxcircle.clearRect(0, 0, canvascenterbiggraphic.width, canvascenterbiggraphic.height);
0404                                     ctxcircle.globalAlpha = canvascenterbiggraphic.alpha;
0405                                     ctxcircle.strokeStyle = canvascenterbiggraphic.strokeStyle;
0406                                     ctxcircle.fillStyle = canvascenterbiggraphic.fillStyle;
0407                                     ctxcircle.lineWidth = canvascenterbiggraphic.lineWidth;
0408                                     ctxcircle.scale(canvascenterbiggraphic.scale, canvascenterbiggraphic.scale);
0409                                     ctxcircle.rotate(canvascenterbiggraphic.rotate)
0410 
0411                         ctxcircle.beginPath();
0412                         ctxcircle.arc(offleftcenter, vCenter, mpie, 10 * Math.PI, false);
0413                         ctxcircle.stroke();
0414 
0415                         if (canvascenterbiggraphic.stroke)
0416                            ctxcircle.stroke();
0417                            ctxcircle.restore();
0418 
0419                             }
0420                         }
0421             Canvas {
0422                                 id:canvascenterhalfgraphic
0423                                 width: parent.width
0424                                 height: parent.height
0425                                 anchors.verticalCenter: parent.verticalCenter
0426                                 anchors.horizontalCenter: parent.horizontalCenter
0427                                 anchors.horizontalCenterOffset: 0;
0428                                 anchors.verticalCenterOffset: 0;
0429                                 //anchors.left: canvasleftline.left
0430 
0431                                 //property real viewScale: base.parent.scale
0432 
0433                                 property color strokeStyle:  "white"//Qt.darker("white", 1.4)
0434                                 property color fillStyle: "white" // red
0435                                 property real lineWidth: 1.2
0436                                 property bool fill: false
0437                                 property bool stroke: false
0438                                 property real alpha: 1.0
0439                                 property real scale : 1
0440                                 property real rotate : 0
0441                                 property real mpie: 3
0442                                 antialiasing: true
0443                                 smooth: true
0444 
0445                                 onLineWidthChanged:requestPaint();
0446                                 onFillChanged:requestPaint();
0447                                 onStrokeChanged:requestPaint();
0448                                 onScaleChanged:requestPaint();
0449                                 onRotateChanged:requestPaint();
0450                                 onFillStyleChanged:requestPaint();
0451                                 onMpieChanged: requestPaint();
0452 
0453                             renderTarget: Canvas.FramebufferObject
0454                                 renderStrategy: Canvas.Cooperative
0455 
0456 
0457                     onPaint: {
0458                                     var ctxcircle = canvascenterhalfgraphic.getContext('2d');
0459                                     var offleftcenter = width * 0.50
0460                                     var offrightcenter = width * 0.50
0461                                     var vCenter = height * 0.5
0462                                     var vDelta = height / 6
0463 
0464                                     ctxcircle.save();
0465                                     ctxcircle.clearRect(0, 0, canvascenterhalfgraphic.width, canvascenterhalfgraphic.height);
0466                                     ctxcircle.globalAlpha = canvascenterhalfgraphic.alpha;
0467                                     ctxcircle.strokeStyle = canvascenterhalfgraphic.strokeStyle;
0468                                     ctxcircle.fillStyle = canvascenterhalfgraphic.fillStyle;
0469                                     ctxcircle.lineWidth = canvascenterhalfgraphic.lineWidth;
0470                                     ctxcircle.scale(canvascenterhalfgraphic.scale, canvascenterhalfgraphic.scale);
0471                                     ctxcircle.rotate(canvascenterhalfgraphic.rotate);
0472 
0473                         ctxcircle.beginPath();
0474                         ctxcircle.arc(offleftcenter, vCenter, mpie,  2.5 * Math.PI, 3.5 * Math.PI , false);
0475                         ctxcircle.fill();
0476                         ctxcircle.closePath();
0477                         ctxcircle.stroke();
0478 
0479                         if (canvascenterhalfgraphic.stroke)
0480                            ctxcircle.stroke();
0481                            ctxcircle.restore();
0482                             }
0483                         }
0484 
0485             Canvas {
0486                                 id:canvascentersmallgraphic
0487                                 width: parent.width
0488                                 height: parent.height
0489                                 anchors.verticalCenter: parent.verticalCenter
0490                                 anchors.horizontalCenter: parent.horizontalCenter
0491                                 anchors.horizontalCenterOffset: 0;
0492                                 anchors.verticalCenterOffset: -8;
0493                                 //anchors.left: canvasleftline.left
0494 
0495                                 //property real viewScale: base.parent.scale
0496 
0497                                 property color strokeStyle:  "white"//Qt.darker("white", 1.4)
0498                                 property color fillStyle: "white" // red
0499                                 property real lineWidth: 0.4
0500                                 property bool fill: false
0501                                 property bool stroke: false
0502                                 property real alpha: 1.0
0503                                 property real scale : 1
0504                                 property real rotate : 0
0505                                 property real mpie: 1
0506                                 antialiasing: true
0507 
0508                                 onLineWidthChanged:requestPaint();
0509                                 onFillChanged:requestPaint();
0510                                 onStrokeChanged:requestPaint();
0511                                 onScaleChanged:requestPaint();
0512                                 onRotateChanged:requestPaint();
0513                                 onFillStyleChanged:requestPaint();
0514                                 onMpieChanged: requestPaint();
0515 
0516                             renderTarget: Canvas.FramebufferObject
0517                                 renderStrategy: Canvas.Cooperative
0518 
0519 
0520                     onPaint: {
0521                                     var ctxcircle = canvascentersmallgraphic.getContext('2d');
0522                                     var offleftcenter = width * 0.50
0523                                     var offrightcenter = width * 0.50
0524                                     var vCenter = height * 0.5
0525                                     var vDelta = height / 6
0526 
0527                                     ctxcircle.save();
0528                                     ctxcircle.clearRect(0, 0, canvascentersmallgraphic.width, canvascentersmallgraphic.height);
0529                                     ctxcircle.globalAlpha = canvascentersmallgraphic.alpha;
0530                                     ctxcircle.strokeStyle = canvascentersmallgraphic.strokeStyle;
0531                                     ctxcircle.fillStyle = canvascentersmallgraphic.fillStyle;
0532                                     ctxcircle.lineWidth = canvascentersmallgraphic.lineWidth;
0533                                     ctxcircle.scale(canvascentersmallgraphic.scale, canvascentersmallgraphic.scale);
0534                                     ctxcircle.rotate(canvascentersmallgraphic.rotate);
0535 
0536                         ctxcircle.beginPath();
0537                         ctxcircle.arc(offleftcenter, vCenter, mpie, 10 * Math.PI , false);
0538                         ctxcircle.fill();
0539                         ctxcircle.closePath();
0540                         ctxcircle.stroke();
0541 
0542                         if (canvascentersmallgraphic.stroke)
0543                            ctxcircle.stroke();
0544                            ctxcircle.restore();
0545                             }
0546                         }
0547         }