Particles using qml

0

I would like to know how I can make a particle system using qml .
I hope you can help me.
Thanks

    
asked by BrandCodes 09.06.2017 в 18:56
source

1 answer

0

Well, do not just find out how to make a particle system but also leave the fragment of the code.
We can start from the documentation to guide us:
Using the Qt Quick Particle System
Or, we can make use of one of the many examples that come in our fyleSystem: "/opt/Qt5.9.0/Examples/Qt5.9/quick/particles/affectors" ...

For example, I started with the following simple example (and very basic) that generates my particles through an image ...

We start by the most important thing that is the import of the module that corresponds to the Particles :

import QtQuick.Particles 2.0

Later we wrote the following code:

Rectangle {
    id: bg
    width: 360
    height: 360
    color: "black"

    ParticleSystem {
        id: particleSys

    }

    Emitter {
        anchors.fill: parent
        system: particleSys
        ImageParticle {
            id: blip
            anchors.fill: parent
            system: particleSys
            source: "images/blueBlip.png"
            clip: true
        }
        lifeSpan: 6000
    }
}

As you can see inside a Rectangle is where we will send to show our particles.
The rest can be seen within the Documentation that annex to the beginning and so have no doubts.
I hope you serve them.

    
answered by 09.06.2017 / 21:12
source