import Quickshell
import QtQuick
import QtQuick.Particles


PanelWindow {
        id: particleRoot
        anchors {
            top: true
            bottom: true
            left: true
            right: true
        }
        color: "transparent"
        exclusionMode: ExclusionMode.Ignore

        screen: Quickshell.screens.find(s => s.name == "DP-1")
        property var mousePos: [width/2, height/2]
        MouseArea {
            id: mouse
            anchors.fill: parent
            hoverEnabled: true
            onPositionChanged: {
                particleRoot.mousePos = [mouse.x, mouse.y];
            }
        }

        ParticleSystem {
            id: sys
            running: true
            anchors.fill: parent

            ItemParticle {
                system: sys
                delegate: Component {
                    Rectangle {
                        color: "black"
                        width: 7
                        height: width
                        radius: width
                        Rectangle {
                            color: "white"
                            width: 5
                            height: width
                            radius: width
                        }
                    }
                }
            }

            Emitter {
                system: sys
                // x: particleRoot.mousePos[0]-10
                // y: particleRoot.mousePos[1]-10
                x: particleRoot.width/2
                y: particleRoot.height/2
                height: 60
                width: 60
                emitRate: 200
                lifeSpan: 3000
                startTime: 0
                velocity: CumulativeDirection {

                    AngleDirection {
                        angle: 0
                        angleVariation: 360
                        magnitude: 10
                        magnitudeVariation: 0.2
                    }

                    
                }
            }

            Attractor {
                pointX: particleRoot.mousePos[0]
                pointY: particleRoot.mousePos[1]
                strength: 200
                affectedParameter: Attractor.Position
                proportionalToDistance: Attractor.InverseLinear
            }
        }
    
	}
