粒子模拟(四-粒子项)

2021/4/9 10:29:12

本文主要是介绍粒子模拟(四-粒子项),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

到目前为止我们只使用了基于粒子画笔的图像来实现粒子可视化
Qt也提供了一些其它的粒子画笔:

  • 粒子项(ItemParticle):基于粒子画笔的代理
  • 自定义粒子(CustomParticle):基于粒子画笔的着色器

粒子项

            ItemParticle{
                id:particle
                system: particleSystem
                delegate: itemDelegate
            }

            Component{
                id:itemDelegate
                Rectangle{
                    id:container
                    width: 150
                    height: 100

                    Image{
                        anchors.fill: parent
                        source: "qrc:/new/preImg/images/"
                                + Math.floor(((Math.random() * 5) + 1))
                                +".jpg"
                    }
                }
            }

可以像控制普通粒子一样来控制粒子项!



这篇关于粒子模拟(四-粒子项)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程