Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Image mask particle system differs
Forum Updated to NodeBB v4.3 + New Features

Image mask particle system differs

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 874 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jiangcaiyang
    wrote on 9 May 2014, 11:04 last edited by
    #1

    Thank you for helping me look at this problem.
    I am imitating example to make particle masked.
    First let me show you some screen shot:
    This is desired:
    !http://i1288.photobucket.com/albums/b485/jiangcaiyang/2_zps193fbb32.png(Desired)!
    This is problematic, the particles are not filled:
    !http://i1288.photobucket.com/albums/b485/jiangcaiyang/1_zpseea56f34.png(problematic)!
    I am using these images as image mask:
    TestSprite.png
    !http://i1288.photobucket.com/albums/b485/jiangcaiyang/TestSprite_zpsfd77056a.png(TestSprite)!
    TestSprite_2.png
    !http://i1288.photobucket.com/albums/b485/jiangcaiyang/TestSprite_2_zpsde05c952.png(TestSprite_2)!
    Here is all my qml code:
    @import QtQuick 2.2
    import QtQuick.Controls 1.1
    import QtQuick.Particles 2.0

    ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    property url targetImageSource: "qrc:/TestSprite_2.png"

    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }
    
    Rectangle
    {
        width: parent.width
        height: parent.height
        color: Qt.black.toString( )
    
        Image
        {
            id: targetImage
            anchors.centerIn: parent
            scale: 0.5
            source: targetImageSource
    
            MouseArea
            {
                anchors.fill: parent
                onClicked:
                {
                    console.log( "The button has been clicked." );
                    //parent.visible = false;
                    maskParticle.start( );
                }
            }
    
            ParticleSystem
            {
                id: maskParticle
                anchors.fill: parent
                running: false
    
                ImageParticle
                {
                    source: "qrc:///particleresources/glowdot.png"
                    z: 2
                    anchors.fill: parent
                    color: "#336666CC"
                    colorVariation: 0.0
                }
    
                Emitter
                {
                    anchors.fill: parent
                    emitRate: 6000
                    lifeSpan: 720
                    size: 10
    
                    shape: MaskShape
                    {
                        source: targetImageSource
                    }
                }
            }
        }
    }
    
    Text
    {
        font.family: "Aerial"
        font.pixelSize: 16
        text: qsTr( "This is a test particle system." )
        color: "#FFFFFF"
    }
    

    }@

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jiangcaiyang
      wrote on 12 May 2014, 13:44 last edited by
      #2

      No any ideas?

      1 Reply Last reply
      0
      • P Offline
        P Offline
        p3c0
        Moderators
        wrote on 13 May 2014, 05:29 last edited by
        #3

        Hi,

        I tested your code on Ubuntu 14.04 with Qt 5.2.1 and it works as desired.
        What is your development environment ?

        !http://i59.tinypic.com/2hdyy9w.png(Output)!

        157

        1 Reply Last reply
        0

        1/3

        9 May 2014, 11:04

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved