9、5 粒子特效-----ItemParticle

ItemParticle是基于delegate的,可用于将QML Item作为粒子,为此,需要为粒子指定自己的代理

import QtQuick
import QtQuick.Particles

Rectangle {
    id: root
    width: 480; height: 240
    color: "#1F1F1F"
    property bool tracer: false

    ParticleSystem {
        id: particleSystem
    }
    ImageParticle {
        id: smokePainter
        system: particleSystem
        groups: ['smoke']
        source: "../images/fire1.png"
        alpha: 0.3
    }

    ItemParticle{
        id:rockPainter
         groups: ['rocket']
         system: particleSystem
         delegate: itemDelegate
    }

    property var images: []
    Component.onCompleted:  {
        images.push("qq.png")
        images.push("rocket.png")
        images.push("spaceship.png")
        images.push("soccer_ball.png")
    }

    Component{
        id:itemDelegate
        Item {
            id: container
            width:32*Math.ceil(M

你可能感兴趣的:(qml资料,qt,3d)