UnifiedSearchResultItemSkeletonGradientRectangle.qml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (C) 2022 by Claudio Cambra <claudio.cambra@nextcloud.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. */
  14. import QtQml 2.15
  15. import QtQuick 2.15
  16. import QtQuick.Layouts 1.15
  17. import QtGraphicalEffects 1.15
  18. import Style 1.0
  19. Rectangle {
  20. id: root
  21. property color progressGradientColor: Style.darkMode ? Qt.lighter(palette.light, 1.2) : Qt.darker(palette.light, 1.1)
  22. property int animationStartX: -width
  23. property int animationEndX: width
  24. gradient: Gradient {
  25. orientation: Gradient.Horizontal
  26. GradientStop {
  27. position: 0
  28. color: "transparent"
  29. }
  30. GradientStop {
  31. position: 0.4
  32. color: root.progressGradientColor
  33. }
  34. GradientStop {
  35. position: 0.6
  36. color: root.progressGradientColor
  37. }
  38. GradientStop {
  39. position: 1.0
  40. color: "transparent"
  41. }
  42. }
  43. NumberAnimation on x {
  44. from: root.animationStartX
  45. to: root.animationEndX
  46. duration: 1000
  47. loops: Animation.Infinite
  48. running: true
  49. }
  50. }