aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/particles/affectors
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/particles/affectors')
-rw-r--r--examples/quick/particles/affectors/CMakeLists.txt145
-rw-r--r--examples/quick/particles/affectors/GreyButton.qml (renamed from examples/quick/particles/affectors/content/GreyButton.qml)0
-rw-r--r--examples/quick/particles/affectors/affectors.pro1
-rw-r--r--examples/quick/particles/affectors/affectors.qml28
-rw-r--r--examples/quick/particles/affectors/affectors.qrc39
-rw-r--r--examples/quick/particles/affectors/age.qml (renamed from examples/quick/particles/affectors/content/age.qml)8
-rw-r--r--examples/quick/particles/affectors/attractor.qml (renamed from examples/quick/particles/affectors/content/attractor.qml)12
-rw-r--r--examples/quick/particles/affectors/customaffector.qml (renamed from examples/quick/particles/affectors/content/customaffector.qml)18
-rw-r--r--examples/quick/particles/affectors/doc/src/affectors.qdoc34
-rw-r--r--examples/quick/particles/affectors/friction.qml (renamed from examples/quick/particles/affectors/content/friction.qml)18
-rw-r--r--examples/quick/particles/affectors/gravity.qml (renamed from examples/quick/particles/affectors/content/gravity.qml)8
-rw-r--r--examples/quick/particles/affectors/groupgoal.qml (renamed from examples/quick/particles/affectors/content/groupgoal.qml)12
-rw-r--r--examples/quick/particles/affectors/images/_explo.pngbin0 -> 81528 bytes
-rw-r--r--examples/quick/particles/affectors/images/backgroundLeaves.jpgbin0 -> 78665 bytes
-rw-r--r--examples/quick/particles/affectors/images/candle.pngbin0 -> 1348 bytes
-rw-r--r--examples/quick/particles/affectors/images/finalfrontier.pngbin0 -> 695061 bytes
-rw-r--r--examples/quick/particles/affectors/images/matchmask.pngbin0 -> 2369 bytes
-rw-r--r--examples/quick/particles/affectors/images/meteor.pngbin0 -> 83169 bytes
-rw-r--r--examples/quick/particles/affectors/images/nullRock.pngbin0 -> 140 bytes
-rw-r--r--examples/quick/particles/affectors/images/particleA.pngbin0 -> 870 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf1.pngbin0 -> 15625 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf2.pngbin0 -> 13660 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf3.pngbin0 -> 23809 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf4.pngbin0 -> 23655 bytes
-rw-r--r--examples/quick/particles/affectors/images/rocket.pngbin0 -> 7315 bytes
-rw-r--r--examples/quick/particles/affectors/images/rocket2.pngbin0 -> 1918 bytes
-rw-r--r--examples/quick/particles/affectors/images/snowflake.pngbin0 -> 189327 bytes
-rw-r--r--examples/quick/particles/affectors/main.cpp2
-rw-r--r--examples/quick/particles/affectors/move.qml (renamed from examples/quick/particles/affectors/content/move.qml)0
-rw-r--r--examples/quick/particles/affectors/spritegoal.qml (renamed from examples/quick/particles/affectors/content/spritegoal.qml)14
-rw-r--r--examples/quick/particles/affectors/turbulence.qml (renamed from examples/quick/particles/affectors/content/turbulence.qml)6
-rw-r--r--examples/quick/particles/affectors/wander.qml (renamed from examples/quick/particles/affectors/content/wander.qml)6
32 files changed, 152 insertions, 199 deletions
diff --git a/examples/quick/particles/affectors/CMakeLists.txt b/examples/quick/particles/affectors/CMakeLists.txt
index 4766ee1100..9434063429 100644
--- a/examples/quick/particles/affectors/CMakeLists.txt
+++ b/examples/quick/particles/affectors/CMakeLists.txt
@@ -1,13 +1,10 @@
-# Generated from affectors.pro.
-
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(affectors LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
@@ -15,119 +12,61 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/affectors")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Core Gui Quick Qml)
+
+add_subdirectory("../../shared" "shared")
-qt_add_executable(affectors
+qt_add_executable(affectorsexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(affectors PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(affectors PUBLIC
+target_link_libraries(affectorsexample PRIVATE
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
+add_dependencies(affectorsexample affectors_shared)
# Resources:
-set(affectors_resource_files
- "affectors.qml"
- "content/GreyButton.qml"
- "content/age.qml"
- "content/attractor.qml"
- "content/customaffector.qml"
- "content/friction.qml"
- "content/gravity.qml"
- "content/groupgoal.qml"
- "content/move.qml"
- "content/spritegoal.qml"
- "content/turbulence.qml"
- "content/wander.qml"
-)
-
-qt6_add_resources(affectors "affectors"
- PREFIX
- "/particles/affectors"
- FILES
- ${affectors_resource_files}
-)
-set(images_resource_files
- "../images/_explo.png"
- "../images/backgroundLeaves.jpg"
- "../images/bear_tiles.png"
- "../images/candle.png"
- "../images/colortable.png"
- "../images/finalfrontier.png"
- "../images/flower.png"
- "../images/matchmask.png"
- "../images/meteor.png"
- "../images/meteor_explo.png"
- "../images/meteors.png"
- "../images/nullRock.png"
- "../images/particle2.png"
- "../images/particle3.png"
- "../images/particleA.png"
- "../images/portal_bg.png"
- "../images/realLeaf1.png"
- "../images/realLeaf2.png"
- "../images/realLeaf3.png"
- "../images/realLeaf4.png"
- "../images/rocket.png"
- "../images/rocket2.png"
- "../images/sizeInOut.png"
- "../images/snowflake.png"
- "../images/sparkleSize.png"
- "../images/starfish_0.png"
- "../images/starfish_1.png"
- "../images/starfish_2.png"
- "../images/starfish_3.png"
- "../images/starfish_4.png"
- "../images/starfish_mask.png"
+qt_add_qml_module(affectorsexample
+ URI affectors
+ VERSION 1.0
+ QML_FILES
+ "affectors.qml"
+ "GreyButton.qml"
+ "age.qml"
+ "attractor.qml"
+ "customaffector.qml"
+ "friction.qml"
+ "gravity.qml"
+ "groupgoal.qml"
+ "move.qml"
+ "spritegoal.qml"
+ "turbulence.qml"
+ "wander.qml"
+ RESOURCES
+ "images/snowflake.png"
+ "images/finalfrontier.png"
+ "images/meteor.png"
+ "images/rocket.png"
+ "images/rocket2.png"
+ "images/backgroundLeaves.jpg"
+ "images/realLeaf1.png"
+ "images/realLeaf2.png"
+ "images/realLeaf3.png"
+ "images/realLeaf4.png"
+ "images/particleA.png"
+ "images/matchmask.png"
+ "images/nullRock.png"
+ "images/_explo.png"
+ "images/candle.png"
)
-qt6_add_resources(affectors "images"
- PREFIX
- "/particles"
- BASE
- ".."
- FILES
- ${images_resource_files}
-)
-set(shared_resource_files
- "../../shared/Button.qml"
- "../../shared/CheckBox.qml"
- "../../shared/FlickrRssModel.qml"
- "../../shared/Label.qml"
- "../../shared/LauncherList.qml"
- "../../shared/SimpleLauncherDelegate.qml"
- "../../shared/Slider.qml"
- "../../shared/TabSet.qml"
- "../../shared/TextField.qml"
- "../../shared/images/back.png"
- "../../shared/images/checkmark.png"
- "../../shared/images/next.png"
- "../../shared/images/qt-logo.png"
- "../../shared/images/slider_handle.png"
- "../../shared/images/tab.png"
-)
-
-qt6_add_resources(affectors "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS affectors
+install(TARGETS affectorsexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+
+bundle_shared(affectorsexample)
diff --git a/examples/quick/particles/affectors/content/GreyButton.qml b/examples/quick/particles/affectors/GreyButton.qml
index d78d913cf0..d78d913cf0 100644
--- a/examples/quick/particles/affectors/content/GreyButton.qml
+++ b/examples/quick/particles/affectors/GreyButton.qml
diff --git a/examples/quick/particles/affectors/affectors.pro b/examples/quick/particles/affectors/affectors.pro
index 673ccfbb81..fc049c21b0 100644
--- a/examples/quick/particles/affectors/affectors.pro
+++ b/examples/quick/particles/affectors/affectors.pro
@@ -4,7 +4,6 @@ QT += quick qml
SOURCES += main.cpp
RESOURCES += \
affectors.qrc \
- ../images.qrc \
../../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/affectors
diff --git a/examples/quick/particles/affectors/affectors.qml b/examples/quick/particles/affectors/affectors.qml
index 81240fed9b..9fa067713e 100644
--- a/examples/quick/particles/affectors/affectors.qml
+++ b/examples/quick/particles/affectors/affectors.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,26 +48,26 @@
**
****************************************************************************/
-import QtQuick 2.0
-import "../../shared" as Examples
+import QtQuick
+import shared
Item {
height: 480
width: 320
- Examples.LauncherList {
+ LauncherList {
id: ll
anchors.fill: parent
Component.onCompleted: {
- addExample("Age", "Kills off particles that enter the affector", Qt.resolvedUrl("content/age.qml"));
- addExample("Attractor", "Simulates a small black hole", Qt.resolvedUrl("content/attractor.qml"));
- addExample("Custom Affector", "Custom falling leaves", Qt.resolvedUrl("content/customaffector.qml"));
- addExample("Friction", "Leaves that slow down as they fall", Qt.resolvedUrl("content/friction.qml"));
- addExample("Gravity", "Leaves that fall towards the earth as you move it", Qt.resolvedUrl("content/gravity.qml"));
- addExample("GroupGoal", "Balls that can be set on fire various ways", Qt.resolvedUrl("content/groupgoal.qml"));
- addExample("Move", "Some effects you can get by altering trajectory midway", Qt.resolvedUrl("content/move.qml"));
- addExample("SpriteGoal", "A ship that makes asteroids explode", Qt.resolvedUrl("content/spritegoal.qml"));
- addExample("Turbulence", "A candle with faint wind", Qt.resolvedUrl("content/turbulence.qml"));
- addExample("Wander", "Drifting snow flakes", Qt.resolvedUrl("content/wander.qml"));
+ addExample("Age", "Kills off particles that enter the affector", Qt.resolvedUrl("age.qml"));
+ addExample("Attractor", "Simulates a small black hole", Qt.resolvedUrl("attractor.qml"));
+ addExample("Custom Affector", "Custom falling leaves", Qt.resolvedUrl("customaffector.qml"));
+ addExample("Friction", "Leaves that slow down as they fall", Qt.resolvedUrl("friction.qml"));
+ addExample("Gravity", "Leaves that fall towards the earth as you move it", Qt.resolvedUrl("gravity.qml"));
+ addExample("GroupGoal", "Balls that can be set on fire various ways", Qt.resolvedUrl("groupgoal.qml"));
+ addExample("Move", "Some effects you can get by altering trajectory midway", Qt.resolvedUrl("move.qml"));
+ addExample("SpriteGoal", "A ship that makes asteroids explode", Qt.resolvedUrl("spritegoal.qml"));
+ addExample("Turbulence", "A candle with faint wind", Qt.resolvedUrl("turbulence.qml"));
+ addExample("Wander", "Drifting snow flakes", Qt.resolvedUrl("wander.qml"));
}
}
}
diff --git a/examples/quick/particles/affectors/affectors.qrc b/examples/quick/particles/affectors/affectors.qrc
index c1d797e4d8..e26bf0b173 100644
--- a/examples/quick/particles/affectors/affectors.qrc
+++ b/examples/quick/particles/affectors/affectors.qrc
@@ -1,16 +1,31 @@
<RCC>
- <qresource prefix="/particles/affectors">
+ <qresource prefix="/affectors">
<file>affectors.qml</file>
- <file>content/age.qml</file>
- <file>content/attractor.qml</file>
- <file>content/customaffector.qml</file>
- <file>content/friction.qml</file>
- <file>content/gravity.qml</file>
- <file>content/GreyButton.qml</file>
- <file>content/groupgoal.qml</file>
- <file>content/move.qml</file>
- <file>content/spritegoal.qml</file>
- <file>content/turbulence.qml</file>
- <file>content/wander.qml</file>
+ <file>age.qml</file>
+ <file>attractor.qml</file>
+ <file>customaffector.qml</file>
+ <file>friction.qml</file>
+ <file>gravity.qml</file>
+ <file>GreyButton.qml</file>
+ <file>groupgoal.qml</file>
+ <file>move.qml</file>
+ <file>spritegoal.qml</file>
+ <file>turbulence.qml</file>
+ <file>wander.qml</file>
+ <file>images/snowflake.png</file>
+ <file>images/finalfrontier.png</file>
+ <file>images/meteor.png</file>
+ <file>images/rocket.png</file>
+ <file>images/rocket2.png</file>
+ <file>images/backgroundLeaves.jpg</file>
+ <file>images/realLeaf1.png</file>
+ <file>images/realLeaf2.png</file>
+ <file>images/realLeaf3.png</file>
+ <file>images/realLeaf4.png</file>
+ <file>images/particleA.png</file>
+ <file>images/matchmask.png</file>
+ <file>images/nullRock.png</file>
+ <file>images/_explo.png</file>
+ <file>images/candle.png</file>
</qresource>
</RCC>
diff --git a/examples/quick/particles/affectors/content/age.qml b/examples/quick/particles/affectors/age.qml
index ff5114a596..a787563506 100644
--- a/examples/quick/particles/affectors/content/age.qml
+++ b/examples/quick/particles/affectors/age.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
@@ -63,7 +63,7 @@ Rectangle {
system: particles
sprites: Sprite {
name: "snow"
- source: "../../images/snowflake.png"
+ source: "images/snowflake.png"
frameCount: 51
frameDuration: 40
frameDurationVariation: 8
diff --git a/examples/quick/particles/affectors/content/attractor.qml b/examples/quick/particles/affectors/attractor.qml
index 7fbb6069b2..41055e3629 100644
--- a/examples/quick/particles/affectors/content/attractor.qml
+++ b/examples/quick/particles/affectors/attractor.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
@@ -57,7 +57,7 @@ Rectangle {
height: 540
color: "black"
Image {
- source: "../../images/finalfrontier.png"
+ source: "images/finalfrontier.png"
anchors.centerIn:parent
}
ParticleSystem {
@@ -98,7 +98,7 @@ Rectangle {
sprites: Sprite {
id: spinState
name: "spinning"
- source: "../../images/meteor.png"
+ source: "images/meteor.png"
frameCount: 35
frameDuration: 60
}
@@ -156,7 +156,7 @@ Rectangle {
}
Image {
- source:"../../images/rocket2.png"
+ source:"images/rocket2.png"
id: ship
width: 45
height: 22
diff --git a/examples/quick/particles/affectors/content/customaffector.qml b/examples/quick/particles/affectors/customaffector.qml
index 76fc4dc302..ea26b2de84 100644
--- a/examples/quick/particles/affectors/content/customaffector.qml
+++ b/examples/quick/particles/affectors/customaffector.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,15 +48,15 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Item {
width: 360
height: 600
Image {
- source: "../../images/backgroundLeaves.jpg"
+ source: "images/backgroundLeaves.jpg"
anchors.fill: parent
}
ParticleSystem {
@@ -120,31 +120,31 @@ Item {
anchors.fill: parent
id: particles
sprites: [Sprite {
- source: "../../images/realLeaf1.png"
+ source: "images/realLeaf1.png"
frameCount: 1
frameDuration: 1
to: {"a":1, "b":1, "c":1, "d":1}
}, Sprite {
name: "a"
- source: "../../images/realLeaf1.png"
+ source: "images/realLeaf1.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "b"
- source: "../../images/realLeaf2.png"
+ source: "images/realLeaf2.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "c"
- source: "../../images/realLeaf3.png"
+ source: "images/realLeaf3.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "d"
- source: "../../images/realLeaf4.png"
+ source: "images/realLeaf4.png"
frameCount: 1
frameDuration: 10000
}
diff --git a/examples/quick/particles/affectors/doc/src/affectors.qdoc b/examples/quick/particles/affectors/doc/src/affectors.qdoc
index 9857a86241..c3469fd957 100644
--- a/examples/quick/particles/affectors/doc/src/affectors.qdoc
+++ b/examples/quick/particles/affectors/doc/src/affectors.qdoc
@@ -35,7 +35,7 @@
Each example is a small QML file emphasizing a particular type or feature.
Age demonstrates using an Age affector to prematurely end the lives of particles.
- \snippet particles/affectors/content/age.qml 0
+ \snippet particles/affectors/age.qml 0
As you move the affector around the screen, the particles inside it
(which haven't already been affected) jump to a period near the end
@@ -44,7 +44,7 @@
the end of their life instantly.
Attractor demonstrates using an Attractor affector to simulate a black hole
- \snippet particles/affectors/content/attractor.qml 0
+ \snippet particles/affectors/attractor.qml 0
All particles in the scene, including the rocket ship's exhaust and pellets, are pulled
towards the black hole. This effect is stronger closer to the black hole, so the
@@ -55,58 +55,58 @@
Custom Affector manipulates the properties of the particles directly in javascript.
One Affector is used to make the leaves rock back and forth as they fall, looking more
leaf-like than just spinning in circles:
- \snippet particles/affectors/content/customaffector.qml 0
+ \snippet particles/affectors/customaffector.qml 0
Another is used to provide a slightly varying friction to the leaves as they 'land',
to look more natural:
- \snippet particles/affectors/content/customaffector.qml 1
+ \snippet particles/affectors/customaffector.qml 1
Friction is similar to the falling leaves in the custom affector, except that it uses a
flat friction the whole way down instead of custom affectors.
- \snippet particles/affectors/content/friction.qml 0
+ \snippet particles/affectors/friction.qml 0
Gravity is a convenience affector for applying a constant acceleration to particles inside it
- \snippet particles/affectors/content/gravity.qml 0
+ \snippet particles/affectors/gravity.qml 0
GroupGoal sets up two particle groups for flaming and non-flaming balls, and gives you various
ways to transition between them.
- \snippet particles/affectors/content/groupgoal.qml unlit
+ \snippet particles/affectors/groupgoal.qml unlit
The non-flaming balls have a one in a hundred chance of lighting on their own each second, but they also
have a GroupGoal set on the whole group. This affector affects all particles of the unlit group, when colliding
with particles in the lit group, and cause them to move to the lighting group.
- \snippet particles/affectors/content/groupgoal.qml lighting
+ \snippet particles/affectors/groupgoal.qml lighting
lighting is an intermediate group so that the glow builds up and the transition is less jarring. So it automatically
moves into the lit group after 100ms.
- \snippet particles/affectors/content/groupgoal.qml lit
+ \snippet particles/affectors/groupgoal.qml lit
The lit group also has TrailEmitters on it for additional fire and smoke, but does not transition anywhere.
There are two more GroupGoal objects that allow particles in the unlit group to transition to the lighting group
(and then to the lit group).
- \snippet particles/affectors/content/groupgoal.qml groupgoal-pilot
+ \snippet particles/affectors/groupgoal.qml groupgoal-pilot
The first is just an area bound to the location of an image of a pilot flame. When unlit balls pass through the flame,
they go straight to lit because the pilot flame is so hot.
- \snippet particles/affectors/content/groupgoal.qml groupgoal-ma
+ \snippet particles/affectors/groupgoal.qml groupgoal-ma
The second is bound to the location of the last pointer interaction, so that touching or clicking on unlit balls (which
is hard due to their constant movement) causes them to move to the lighting group.
Move shows some simple effects you can get by altering trajectory midway.
The red particles have an affector that affects their position, jumping them forwards by 120px.
- \snippet particles/affectors/content/move.qml A
+ \snippet particles/affectors/move.qml A
The green particles have an affector that affects their velocity, but with some angle variation. By adding some random direction
velocity to their existing forwards velocity, they begin to spray off in a cone.
- \snippet particles/affectors/content/move.qml B
+ \snippet particles/affectors/move.qml B
The blue particles have an affector that affects their acceleration, and because it sets relative to false this resets the acceleration instead of
adding to it. Once the blue particles reach the affector, their horizontal velocity stops increasing as their vertical velocity decreases.
- \snippet particles/affectors/content/move.qml C
+ \snippet particles/affectors/move.qml C
SpriteGoal has an affector which interacts with the sprite engine of particles, if they are being drawn as sprites by ImageParticle.
- \snippet particles/affectors/content/spritegoal.qml 0
+ \snippet particles/affectors/spritegoal.qml 0
The SpriteGoal follows the image of the rocket ship on screen, and when it interacts with particles drawn by ImageParticle as sprites,
it instructs them to move immediately to the "explode" state, which in this case is the animation of the asteroid breaking into many pieces.
Turbulence has a flame with smoke, and both sets of particles being affected by a Turbulence affector. This gives a faint wind effect.
- \snippet particles/affectors/content/turbulence.qml 0
+ \snippet particles/affectors/turbulence.qml 0
To make the wind change direction, subsitute a black and white noise image in the noiseSource parameter (it currently uses a default noise source).
Wander uses a Wander affector to add some horizontal drift to snowflakes as they fall down.
- \snippet particles/affectors/content/wander.qml 0
+ \snippet particles/affectors/wander.qml 0
There are different movements given by applying the Wander to different attributes of the trajectory, so the example makes it easy to play around and see the difference.
*/
diff --git a/examples/quick/particles/affectors/content/friction.qml b/examples/quick/particles/affectors/friction.qml
index 1fa85ec2fe..aa2d1c72d7 100644
--- a/examples/quick/particles/affectors/content/friction.qml
+++ b/examples/quick/particles/affectors/friction.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,15 +48,15 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Item {
width: 360
height: 600
Image {
- source: "../../images/backgroundLeaves.jpg"
+ source: "images/backgroundLeaves.jpg"
anchors.fill: parent
}
ParticleSystem {
@@ -73,31 +73,31 @@ Item {
anchors.fill: parent
id: particles
sprites: [Sprite {
- source: "../../images/realLeaf1.png"
+ source: "images/realLeaf1.png"
frameCount: 1
frameDuration: 1
to: {"a":1, "b":1, "c":1, "d":1}
}, Sprite {
name: "a"
- source: "../../images/realLeaf1.png"
+ source: "images/realLeaf1.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "b"
- source: "../../images/realLeaf2.png"
+ source: "images/realLeaf2.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "c"
- source: "../../images/realLeaf3.png"
+ source: "images/realLeaf3.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "d"
- source: "../../images/realLeaf4.png"
+ source: "images/realLeaf4.png"
frameCount: 1
frameDuration: 10000
}
diff --git a/examples/quick/particles/affectors/content/gravity.qml b/examples/quick/particles/affectors/gravity.qml
index 99b14f3b1f..cf517ae319 100644
--- a/examples/quick/particles/affectors/content/gravity.qml
+++ b/examples/quick/particles/affectors/gravity.qml
@@ -1,6 +1,6 @@
/****************************************************************************
*
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Item {
id: window
@@ -109,7 +109,7 @@ Item {
ImageParticle {
anchors.fill: parent
system: sys
- source: "../../images/realLeaf1.png"
+ source: "images/realLeaf1.png"
}
}
diff --git a/examples/quick/particles/affectors/content/groupgoal.qml b/examples/quick/particles/affectors/groupgoal.qml
index 9910531a98..27c910e69a 100644
--- a/examples/quick/particles/affectors/content/groupgoal.qml
+++ b/examples/quick/particles/affectors/groupgoal.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
@@ -74,7 +74,7 @@ Rectangle {
duration: 1000
to: {"lighting":1, "unlit":99}
ImageParticle {
- source: "../../images/particleA.png"
+ source: "images/particleA.png"
colorVariation: 0.1
color: "#2060160f"
}
@@ -151,7 +151,7 @@ Rectangle {
id: flame
anchors.fill: parent
groups: ["flame", "lit", "lighting"]
- source: "../../images/particleA.png"
+ source: "images/particleA.png"
colorVariation: 0.1
color: "#00ff400f"
}
@@ -188,7 +188,7 @@ Rectangle {
y: -55
height: 75
width: 30
- shape: MaskShape {source: "../../images/matchmask.png"}
+ shape: MaskShape {source: "images/matchmask.png"}
}
// ![groupgoal-pilot]
}
diff --git a/examples/quick/particles/affectors/images/_explo.png b/examples/quick/particles/affectors/images/_explo.png
new file mode 100644
index 0000000000..4297245d49
--- /dev/null
+++ b/examples/quick/particles/affectors/images/_explo.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/backgroundLeaves.jpg b/examples/quick/particles/affectors/images/backgroundLeaves.jpg
new file mode 100644
index 0000000000..08be16751d
--- /dev/null
+++ b/examples/quick/particles/affectors/images/backgroundLeaves.jpg
Binary files differ
diff --git a/examples/quick/particles/affectors/images/candle.png b/examples/quick/particles/affectors/images/candle.png
new file mode 100644
index 0000000000..8fa3193719
--- /dev/null
+++ b/examples/quick/particles/affectors/images/candle.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/finalfrontier.png b/examples/quick/particles/affectors/images/finalfrontier.png
new file mode 100644
index 0000000000..2ba1815230
--- /dev/null
+++ b/examples/quick/particles/affectors/images/finalfrontier.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/matchmask.png b/examples/quick/particles/affectors/images/matchmask.png
new file mode 100644
index 0000000000..e575875c55
--- /dev/null
+++ b/examples/quick/particles/affectors/images/matchmask.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/meteor.png b/examples/quick/particles/affectors/images/meteor.png
new file mode 100644
index 0000000000..e8c368aea7
--- /dev/null
+++ b/examples/quick/particles/affectors/images/meteor.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/nullRock.png b/examples/quick/particles/affectors/images/nullRock.png
new file mode 100644
index 0000000000..4076327a1a
--- /dev/null
+++ b/examples/quick/particles/affectors/images/nullRock.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/particleA.png b/examples/quick/particles/affectors/images/particleA.png
new file mode 100644
index 0000000000..d86fc9696b
--- /dev/null
+++ b/examples/quick/particles/affectors/images/particleA.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/realLeaf1.png b/examples/quick/particles/affectors/images/realLeaf1.png
new file mode 100644
index 0000000000..6cabf29efd
--- /dev/null
+++ b/examples/quick/particles/affectors/images/realLeaf1.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/realLeaf2.png b/examples/quick/particles/affectors/images/realLeaf2.png
new file mode 100644
index 0000000000..bfeca861d5
--- /dev/null
+++ b/examples/quick/particles/affectors/images/realLeaf2.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/realLeaf3.png b/examples/quick/particles/affectors/images/realLeaf3.png
new file mode 100644
index 0000000000..b1071e862b
--- /dev/null
+++ b/examples/quick/particles/affectors/images/realLeaf3.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/realLeaf4.png b/examples/quick/particles/affectors/images/realLeaf4.png
new file mode 100644
index 0000000000..d61d53d10e
--- /dev/null
+++ b/examples/quick/particles/affectors/images/realLeaf4.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/rocket.png b/examples/quick/particles/affectors/images/rocket.png
new file mode 100644
index 0000000000..a171610b03
--- /dev/null
+++ b/examples/quick/particles/affectors/images/rocket.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/rocket2.png b/examples/quick/particles/affectors/images/rocket2.png
new file mode 100644
index 0000000000..7110f8fdc6
--- /dev/null
+++ b/examples/quick/particles/affectors/images/rocket2.png
Binary files differ
diff --git a/examples/quick/particles/affectors/images/snowflake.png b/examples/quick/particles/affectors/images/snowflake.png
new file mode 100644
index 0000000000..490887a82f
--- /dev/null
+++ b/examples/quick/particles/affectors/images/snowflake.png
Binary files differ
diff --git a/examples/quick/particles/affectors/main.cpp b/examples/quick/particles/affectors/main.cpp
index 9e90217000..854f1d92a8 100644
--- a/examples/quick/particles/affectors/main.cpp
+++ b/examples/quick/particles/affectors/main.cpp
@@ -48,4 +48,4 @@
**
****************************************************************************/
#include "../../shared/shared.h"
-DECLARATIVE_EXAMPLE_MAIN(particles/affectors/affectors)
+DECLARATIVE_EXAMPLE_MAIN(affectors/affectors)
diff --git a/examples/quick/particles/affectors/content/move.qml b/examples/quick/particles/affectors/move.qml
index b33d7f4006..b33d7f4006 100644
--- a/examples/quick/particles/affectors/content/move.qml
+++ b/examples/quick/particles/affectors/move.qml
diff --git a/examples/quick/particles/affectors/content/spritegoal.qml b/examples/quick/particles/affectors/spritegoal.qml
index 294f693221..1ba7b46dd6 100644
--- a/examples/quick/particles/affectors/content/spritegoal.qml
+++ b/examples/quick/particles/affectors/spritegoal.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Item {
id: root
@@ -62,7 +62,7 @@ Item {
ParticleSystem { id: sys }
Image {
- source: "../../images/finalfrontier.png"
+ source: "images/finalfrontier.png"
transformOrigin: Item.Center
anchors.centerIn: parent
NumberAnimation on rotation {
@@ -113,20 +113,20 @@ Item {
sprites:[Sprite {
id: spinState
name: "spinning"
- source: "../../images/meteor.png"
+ source: "images/meteor.png"
frameCount: 35
frameDuration: 40
randomStart: true
to: {"explode":0, "spinning":1}
},Sprite {
name: "explode"
- source: "../../images/_explo.png"
+ source: "images/_explo.png"
frameCount: 22
frameDuration: 40
to: {"nullFrame":1}
},Sprite {//Not sure if this is needed, but seemed easiest
name: "nullFrame"
- source: "../../images/nullRock.png"
+ source: "images/nullRock.png"
frameCount: 1
frameDuration: 1000
}
@@ -145,7 +145,7 @@ Item {
//! [0]
Image {
id: rocketShip
- source: "../../images/rocket.png"
+ source: "images/rocket.png"
anchors.centerIn: holder
rotation: (circle.percent+0.25) * 360
z: 2
diff --git a/examples/quick/particles/affectors/content/turbulence.qml b/examples/quick/particles/affectors/turbulence.qml
index e58b3ede7f..83c2b1744f 100644
--- a/examples/quick/particles/affectors/content/turbulence.qml
+++ b/examples/quick/particles/affectors/turbulence.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
width: 320
@@ -57,7 +57,7 @@ Rectangle {
color: "#222222"
id: root
Image {
- source: "../../images/candle.png"
+ source: "images/candle.png"
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: -60
diff --git a/examples/quick/particles/affectors/content/wander.qml b/examples/quick/particles/affectors/wander.qml
index 736fc1af76..613298eb4f 100644
--- a/examples/quick/particles/affectors/content/wander.qml
+++ b/examples/quick/particles/affectors/wander.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
width: 360
@@ -59,7 +59,7 @@ Rectangle {
system: particles
sprites: Sprite {
name: "snow"
- source: "../../images/snowflake.png"
+ source: "images/snowflake.png"
frameCount: 51
frameDuration: 40
frameDurationVariation: 8