diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-10-09 03:48:58 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-10-09 03:48:58 +0200 |
commit | 25f19c11b1ab583002e0ba02acd0b4da67fbb164 (patch) | |
tree | 00a7c3fb25c8f844fbafb1d83d04ac39d0dd4282 /resources | |
parent | Fix typing notifications (diff) | |
download | nheko-25f19c11b1ab583002e0ba02acd0b4da67fbb164.tar.xz |
Fix high CPU use caused by ItemParticle
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/ui/TimelineEffects.qml | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/resources/qml/ui/TimelineEffects.qml b/resources/qml/ui/TimelineEffects.qml index 72237e31..4e2acea4 100644 --- a/resources/qml/ui/TimelineEffects.qml +++ b/resources/qml/ui/TimelineEffects.qml @@ -9,6 +9,7 @@ Item { id: effectRoot readonly property int maxLifespan: Math.max(confettiEmitter.lifeSpan, rainfallEmitter.lifeSpan) required property bool shouldEffectsRun + visible: effectRoot.shouldEffectsRun function pulseConfetti() { @@ -25,11 +26,13 @@ Item { Component.onCompleted: pause(); paused: !effectRoot.shouldEffectsRun + running: effectRoot.shouldEffectsRun } Emitter { id: confettiEmitter + Component.onCompleted: stop(); group: "confetti" width: effectRoot.width * 3/4 enabled: false @@ -89,26 +92,47 @@ Item { enabled: false anchors.horizontalCenter: effectRoot.horizontalCenter y: -60 - emitRate: effectRoot.width / 50 + emitRate: effectRoot.width / 30 lifeSpan: 10000 system: particleSystem velocity: PointDirection { x: 0 - y: 300 + y: 400 xVariation: 0 yVariation: 75 } - ItemParticle { - system: particleSystem - groups: ["rain"] - fade: false - delegate: Rectangle { - width: 2 - height: 30 + 30 * Math.random() - radius: 2 + // causes high CPU load, see: https://bugreports.qt.io/browse/QTBUG-117923 + //ItemParticle { + // system: particleSystem + // groups: ["rain"] + // fade: false + // visible: effectRoot.shouldEffectsRun + // delegate: Rectangle { + // width: 2 + // height: 30 + 30 * Math.random() + // radius: 2 + // color: "#0099ff" + // } + //} + + ImageParticle { + system: particleSystem + groups: ["rain"] + source: "qrc:/confettiparticle.svg" + rotationVelocity: 0 + rotationVelocityVariation: 0 + colorVariation: 0 color: "#0099ff" + entryEffect: ImageParticle.None + xVector: PointDirection { + x: 0.01 + y: 0 + } + yVector: PointDirection { + x: 0 + y: 5 + } } } } -} |