Skip to content

Instantly share code, notes, and snippets.

@benaryorg
Last active September 3, 2015 22:05
Show Gist options
  • Save benaryorg/4a0d162ef447594f8768 to your computer and use it in GitHub Desktop.
Save benaryorg/4a0d162ef447594f8768 to your computer and use it in GitHub Desktop.
qml button particles
import QtQuick 2.0
import QtQuick.Particles 2.0
import QtQuick.Window 2.0
import QtQuick.Controls 1.2
Window
{
visible: true
Rectangle
{
id: root
anchors.fill: parent
color: "#1f1f1f"
ParticleSystem
{
id: particleSystem
Gravity
{
anchors.fill: parent
angle: 0
magnitude: 100
}
}
Emitter
{
id: emitter
width: parent.width*.9
height: 10
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
system: particleSystem
emitRate: 2
lifeSpan: 5000
velocity: AngleDirection
{
angle: 270
angleVariation: 45
magnitude: 200
}
}
ItemParticle
{
delegate: Button
{
text: "Quit"
rotation: Math.random()*360
onClicked:
{
Qt.quit();
}
}
system: particleSystem
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment