<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to reuse objects]]></title><description><![CDATA[<p dir="auto">Why is it not creating the particles? i'm not getting any error but the particles aint visible:</p>
<pre><code>import QtQuick 2.5
import QtQuick.Particles 2.0
        
Rectangle {
        id: root
        color: "transparent"
    
        ParticleSystem {
            id: x
        }
        ParticleSystem {
            id: y
        }
     
        Component {
            id: custom
    
            Item {
    
                ImageParticle {
                    source: 'qrc:/files/particles/assets/particle.png'
                    color: '#ff4208'
                    colorVariation: 0.2
                    rotation: 10
                    rotationVariation: 20
                    rotationVelocity: 20
                    rotationVelocityVariation: 20
                    entryEffect: ImageParticle.Scale
                    opacity: 1
                }
    
                Emitter {
                    property string _id: ""
                    anchors.left: parent.left
                    anchors.right: parent.right
                    width: parent.width
                    height: parent.height
    
                    velocity: AngleDirection {
                        angle: 270
                        angleVariation: 180
                        magnitude: 12
                        magnitudeVariation: 20
                    }
                }
            }
        }
    
        function createEmitter(properties) {
            var obj = custom.createObject(root);
    
            for (var i = 0; i &lt; obj.children.length; i++) {
    
                var children = obj.children[i];
                if (children instanceof ImageParticle) {
                    children.system = properties.system;
                    continue;
                }
                if (children instanceof Emitter) {
                    children._id               = properties.id;
                    children.system            = properties.system;
                    children.emitRate          = properties.emitRate;
                    children.lifeSpan          = properties.lifeSpan;
                    children.lifeSpanVariation = properties.lifeSpanVariation;
                    children.size              = properties.size;
                    children.maximumEmitted    = properties.maximumEmitted;
                    continue;
                }
            }
        }
    
        Component.onCompleted: {
    
            createEmitter({ 
                'id'               : 'emitter1',
                'system'           : x, 
                'emitRate'         : 40, 
                'lifeSpan'         : 4000, 
                'lifeSpanVariation': 8000, 
                'size'             : 52, 
                'maximumEmitted'   : 20 });
    
            createEmitter({ 
                'id'               : 'emitter2',
                'system'           : y, 
                'emitRate'         : 50, 
                'lifeSpan'         : 5000, 
                'lifeSpanVariation': 9000, 
                'size'             : 62, 
                'maximumEmitted'   : 30 });
        }
</code></pre>
]]></description><link>https://forum.qt.io/topic/154545/how-to-reuse-objects</link><generator>RSS for Node</generator><lastBuildDate>Sat, 19 Sep 2026 12:09:36 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/154545.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 15 Feb 2024 05:06:34 GMT</pubDate><ttl>60</ttl></channel></rss>