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.txt312
-rw-r--r--examples/quick/particles/affectors/GreyButton.qml44
-rw-r--r--examples/quick/particles/affectors/affectors.pro1
-rw-r--r--examples/quick/particles/affectors/affectors.qml77
-rw-r--r--examples/quick/particles/affectors/affectors.qrc39
-rw-r--r--examples/quick/particles/affectors/age.qml62
-rw-r--r--examples/quick/particles/affectors/attractor.qml (renamed from examples/quick/particles/affectors/content/attractor.qml)62
-rw-r--r--examples/quick/particles/affectors/content/GreyButton.qml91
-rw-r--r--examples/quick/particles/affectors/content/age.qml109
-rw-r--r--examples/quick/particles/affectors/content/customaffector.qml156
-rw-r--r--examples/quick/particles/affectors/content/friction.qml121
-rw-r--r--examples/quick/particles/affectors/content/gravity.qml115
-rw-r--r--examples/quick/particles/affectors/content/move.qml157
-rw-r--r--examples/quick/particles/affectors/content/turbulence.qml142
-rw-r--r--examples/quick/particles/affectors/content/wander.qml107
-rw-r--r--examples/quick/particles/affectors/customaffector.qml109
-rw-r--r--examples/quick/particles/affectors/doc/src/affectors.qdoc63
-rw-r--r--examples/quick/particles/affectors/friction.qml74
-rw-r--r--examples/quick/particles/affectors/gravity.qml68
-rw-r--r--examples/quick/particles/affectors/groupgoal.qml (renamed from examples/quick/particles/affectors/content/groupgoal.qml)61
-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.cpp53
-rw-r--r--examples/quick/particles/affectors/move.qml110
-rw-r--r--examples/quick/particles/affectors/spritegoal.qml (renamed from examples/quick/particles/affectors/content/spritegoal.qml)70
-rw-r--r--examples/quick/particles/affectors/turbulence.qml94
-rw-r--r--examples/quick/particles/affectors/wander.qml60
40 files changed, 768 insertions, 1589 deletions
diff --git a/examples/quick/particles/affectors/CMakeLists.txt b/examples/quick/particles/affectors/CMakeLists.txt
index 1e65a15d2e..dc29e1787b 100644
--- a/examples/quick/particles/affectors/CMakeLists.txt
+++ b/examples/quick/particles/affectors/CMakeLists.txt
@@ -1,271 +1,73 @@
-# Generated from affectors.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(affectors LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
+qt_standard_project_setup(REQUIRES 6.5)
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
+add_subdirectory("../../shared" "shared")
-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)
-
-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
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
-)
-
-# 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"
+target_link_libraries(affectorsexample PRIVATE
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Qml
+ Qt6::Quick
)
-qt6_add_resources(affectors "affectors"
- PREFIX
- "/particles/affectors"
- FILES
- ${affectors_resource_files}
-)
-set_source_files_properties("../images/_explo.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/_explo.png"
-)
-set_source_files_properties("../images/backgroundLeaves.jpg"
- PROPERTIES QT_RESOURCE_ALIAS "images/backgroundLeaves.jpg"
-)
-set_source_files_properties("../images/bear_tiles.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/bear_tiles.png"
-)
-set_source_files_properties("../images/candle.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/candle.png"
-)
-set_source_files_properties("../images/colortable.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/colortable.png"
-)
-set_source_files_properties("../images/finalfrontier.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/finalfrontier.png"
-)
-set_source_files_properties("../images/flower.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/flower.png"
-)
-set_source_files_properties("../images/matchmask.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/matchmask.png"
-)
-set_source_files_properties("../images/meteor.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/meteor.png"
-)
-set_source_files_properties("../images/meteor_explo.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/meteor_explo.png"
-)
-set_source_files_properties("../images/meteors.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/meteors.png"
-)
-set_source_files_properties("../images/nullRock.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/nullRock.png"
-)
-set_source_files_properties("../images/particle2.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/particle2.png"
-)
-set_source_files_properties("../images/particle3.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/particle3.png"
-)
-set_source_files_properties("../images/particleA.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/particleA.png"
-)
-set_source_files_properties("../images/portal_bg.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/portal_bg.png"
-)
-set_source_files_properties("../images/realLeaf1.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf1.png"
-)
-set_source_files_properties("../images/realLeaf2.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf2.png"
-)
-set_source_files_properties("../images/realLeaf3.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf3.png"
-)
-set_source_files_properties("../images/realLeaf4.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/realLeaf4.png"
-)
-set_source_files_properties("../images/rocket.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/rocket.png"
-)
-set_source_files_properties("../images/rocket2.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/rocket2.png"
-)
-set_source_files_properties("../images/sizeInOut.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/sizeInOut.png"
-)
-set_source_files_properties("../images/snowflake.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/snowflake.png"
-)
-set_source_files_properties("../images/sparkleSize.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/sparkleSize.png"
-)
-set_source_files_properties("../images/starfish_0.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/starfish_0.png"
-)
-set_source_files_properties("../images/starfish_1.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/starfish_1.png"
-)
-set_source_files_properties("../images/starfish_2.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/starfish_2.png"
-)
-set_source_files_properties("../images/starfish_3.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/starfish_3.png"
-)
-set_source_files_properties("../images/starfish_4.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/starfish_4.png"
-)
-set_source_files_properties("../images/starfish_mask.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/starfish_mask.png"
-)
-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"
-)
+add_dependencies(affectorsexample affectors_shared)
-qt6_add_resources(affectors "images"
- PREFIX
- "/particles"
- BASE
- ".."
- FILES
- ${images_resource_files}
-)
-set_source_files_properties("../../shared/Button.qml"
- PROPERTIES QT_RESOURCE_ALIAS "Button.qml"
-)
-set_source_files_properties("../../shared/CheckBox.qml"
- PROPERTIES QT_RESOURCE_ALIAS "CheckBox.qml"
-)
-set_source_files_properties("../../shared/FlickrRssModel.qml"
- PROPERTIES QT_RESOURCE_ALIAS "FlickrRssModel.qml"
-)
-set_source_files_properties("../../shared/Label.qml"
- PROPERTIES QT_RESOURCE_ALIAS "Label.qml"
-)
-set_source_files_properties("../../shared/LauncherList.qml"
- PROPERTIES QT_RESOURCE_ALIAS "LauncherList.qml"
-)
-set_source_files_properties("../../shared/SimpleLauncherDelegate.qml"
- PROPERTIES QT_RESOURCE_ALIAS "SimpleLauncherDelegate.qml"
-)
-set_source_files_properties("../../shared/Slider.qml"
- PROPERTIES QT_RESOURCE_ALIAS "Slider.qml"
-)
-set_source_files_properties("../../shared/TabSet.qml"
- PROPERTIES QT_RESOURCE_ALIAS "TabSet.qml"
-)
-set_source_files_properties("../../shared/TextField.qml"
- PROPERTIES QT_RESOURCE_ALIAS "TextField.qml"
-)
-set_source_files_properties("../../shared/images/back.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/back.png"
-)
-set_source_files_properties("../../shared/images/checkmark.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/checkmark.png"
-)
-set_source_files_properties("../../shared/images/next.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/next.png"
-)
-set_source_files_properties("../../shared/images/qt-logo.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/qt-logo.png"
-)
-set_source_files_properties("../../shared/images/slider_handle.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/slider_handle.png"
-)
-set_source_files_properties("../../shared/images/tab.png"
- PROPERTIES QT_RESOURCE_ALIAS "images/tab.png"
-)
-set(shared_resource_files
- "Button.qml"
- "CheckBox.qml"
- "FlickrRssModel.qml"
- "Label.qml"
- "LauncherList.qml"
- "SimpleLauncherDelegate.qml"
- "Slider.qml"
- "TabSet.qml"
- "TextField.qml"
- "images/back.png"
- "images/checkmark.png"
- "images/next.png"
- "images/qt-logo.png"
- "images/slider_handle.png"
- "images/tab.png"
+# Resources:
+qt_add_qml_module(affectorsexample
+ URI affectors
+ 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 "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
+install(TARGETS affectorsexample
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
-install(TARGETS affectors
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
+qt_generate_deploy_qml_app_script(
+ TARGET affectorsexample
+ OUTPUT_SCRIPT deploy_script
+ MACOS_BUNDLE_POST_BUILD
+ NO_UNSUPPORTED_PLATFORM_ERROR
+ DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
+)
+install(SCRIPT ${deploy_script})
diff --git a/examples/quick/particles/affectors/GreyButton.qml b/examples/quick/particles/affectors/GreyButton.qml
new file mode 100644
index 0000000000..412a6dfa60
--- /dev/null
+++ b/examples/quick/particles/affectors/GreyButton.qml
@@ -0,0 +1,44 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+
+Item {
+ id: container
+
+ required property string text
+ property string subText: ""
+ signal clicked
+
+ width: buttonLabel.width + 20; height: col.height + 12
+
+ MouseArea {
+ id: mouseArea;
+ anchors.fill: parent;
+ onClicked: container.clicked();
+ onPressed: background.color = Qt.darker("lightgrey");
+ onReleased: background.color="lightgrey";
+ }
+
+ Rectangle {
+ id: background
+ anchors.fill: parent
+ color: "lightgrey"
+ radius: 4
+ border.width: 1
+ border.color: Qt.darker(color)
+ }
+
+ Column {
+ spacing: 2
+ id: col
+ x: 10
+ y: 6
+ Text {
+ id: buttonLabel; text: container.text; color: "black"; font.pixelSize: 24
+ }
+ Text {
+ id: buttonLabel2; text: container.subText; color: "black"; font.pixelSize: 12
+ }
+ }
+}
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..f4f746471a 100644
--- a/examples/quick/particles/affectors/affectors.qml
+++ b/examples/quick/particles/affectors/affectors.qml
@@ -1,73 +1,26 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-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..a826d351a8 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="/qt/qml/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/age.qml b/examples/quick/particles/affectors/age.qml
new file mode 100644
index 0000000000..a43a9a08ef
--- /dev/null
+++ b/examples/quick/particles/affectors/age.qml
@@ -0,0 +1,62 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ id: root
+ width: 360
+ height: 600
+ color: "white"
+
+ ParticleSystem { id: particles }
+
+ ImageParticle {
+ system: particles
+ sprites: Sprite {
+ name: "snow"
+ source: "images/snowflake.png"
+ frameCount: 51
+ frameDuration: 40
+ frameDurationVariation: 8
+ }
+ }
+
+ Emitter {
+ system: particles
+ emitRate: 20
+ lifeSpan: 8000
+ velocity: PointDirection { y:80; yVariation: 40; }
+ acceleration: PointDirection { y: 4 }
+ size: 36
+ endSize: 12
+ sizeVariation: 8
+ width: parent.width
+ height: 100
+ }
+
+ MouseArea {
+ id: ma
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+
+ Rectangle {
+ color: "#803333AA"
+ border.color: "black"
+ x: ma.mouseX - 36
+ y: ma.mouseY - 36
+ width: 72
+ height: 72
+ //! [0]
+ Age {
+ anchors.fill: parent
+ system: particles
+ once: true
+ lifeLeft: 1200
+ advancePosition: false
+ }
+ //! [0]
+ }
+}
diff --git a/examples/quick/particles/affectors/content/attractor.qml b/examples/quick/particles/affectors/attractor.qml
index 7fbb6069b2..c5b95ee2a0 100644
--- a/examples/quick/particles/affectors/content/attractor.qml
+++ b/examples/quick/particles/affectors/attractor.qml
@@ -1,55 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
@@ -57,7 +10,7 @@ Rectangle {
height: 540
color: "black"
Image {
- source: "../../images/finalfrontier.png"
+ source: "images/finalfrontier.png"
anchors.centerIn:parent
}
ParticleSystem {
@@ -98,7 +51,7 @@ Rectangle {
sprites: Sprite {
id: spinState
name: "spinning"
- source: "../../images/meteor.png"
+ source: "images/meteor.png"
frameCount: 35
frameDuration: 60
}
@@ -116,7 +69,6 @@ Rectangle {
groups: ["engine"]
source: "qrc:///particleresources/fuzzydot.png"
- color: "orange"
SequentialAnimation on color {
loops: Animation.Infinite
ColorAnimation {
@@ -156,7 +108,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/GreyButton.qml b/examples/quick/particles/affectors/content/GreyButton.qml
deleted file mode 100644
index d78d913cf0..0000000000
--- a/examples/quick/particles/affectors/content/GreyButton.qml
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Item {
- id: container
-
- property string text: "Button"
- property string subText: ""
- signal clicked
-
- width: buttonLabel.width + 20; height: col.height + 12
-
- MouseArea {
- id: mouseArea;
- anchors.fill: parent;
- onClicked: container.clicked();
- onPressed: background.color = Qt.darker("lightgrey");
- onReleased: background.color="lightgrey";
- }
-
- Rectangle {
- id: background
- anchors.fill: parent
- color: "lightgrey"
- radius: 4
- border.width: 1
- border.color: Qt.darker(color)
- }
-
- Column {
- spacing: 2
- id: col
- x: 10
- y: 6
- Text {
- id: buttonLabel; text: container.text; color: "black"; font.pixelSize: 24
- }
- Text {
- id: buttonLabel2; text: container.subText; color: "black"; font.pixelSize: 12
- }
- }
-}
diff --git a/examples/quick/particles/affectors/content/age.qml b/examples/quick/particles/affectors/content/age.qml
deleted file mode 100644
index ff5114a596..0000000000
--- a/examples/quick/particles/affectors/content/age.qml
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Particles 2.0
-
-Rectangle {
- id: root
- width: 360
- height: 600
- color: "white"
-
- ParticleSystem { id: particles }
-
- ImageParticle {
- system: particles
- sprites: Sprite {
- name: "snow"
- source: "../../images/snowflake.png"
- frameCount: 51
- frameDuration: 40
- frameDurationVariation: 8
- }
- }
-
- Emitter {
- system: particles
- emitRate: 20
- lifeSpan: 8000
- velocity: PointDirection { y:80; yVariation: 40; }
- acceleration: PointDirection { y: 4 }
- size: 36
- endSize: 12
- sizeVariation: 8
- width: parent.width
- height: 100
- }
-
- MouseArea {
- id: ma
- anchors.fill: parent
- hoverEnabled: true
- }
-
- Rectangle {
- color: "#803333AA"
- border.color: "black"
- x: ma.mouseX - 36
- y: ma.mouseY - 36
- width: 72
- height: 72
- //! [0]
- Age {
- anchors.fill: parent
- system: particles
- once: true
- lifeLeft: 1200
- advancePosition: false
- }
- //! [0]
- }
-}
diff --git a/examples/quick/particles/affectors/content/customaffector.qml b/examples/quick/particles/affectors/content/customaffector.qml
deleted file mode 100644
index 76fc4dc302..0000000000
--- a/examples/quick/particles/affectors/content/customaffector.qml
+++ /dev/null
@@ -1,156 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Particles 2.0
-
-Item {
- width: 360
- height: 600
-
- Image {
- source: "../../images/backgroundLeaves.jpg"
- anchors.fill: parent
- }
- ParticleSystem {
- anchors.fill: parent
- Emitter {
- width: parent.width
- emitRate: 4
- lifeSpan: 14000
- size: 80
- velocity: PointDirection { y: 60 }
- }
- Wander {
- anchors.fill: parent
- anchors.bottomMargin: 100
- xVariance: 60
- pace: 60
- }
-
- //! [0]
- Affector {
- width: parent.width
- height: parent.height - 100
- onAffectParticles: (particles, dt) => {
- //Wobbly movement
- for (var i=0; i<particles.length; i++) {
- var particle = particles[i];
- particle.rotation += particle.vx * 0.15 * dt;
- particle.update = true;
- }
- }
- }
- //! [0]
-
- //! [1]
- Affector {//Custom Friction, adds some 'randomness'
- x: -60
- width: parent.width + 120
- height: 100
- anchors.bottom: parent.bottom
- onAffectParticles: (particles, dt) => {
- for (var i=0; i<particles.length; i++) {
- var particle = particles[i];
- var pseudoRand = (Math.floor(particle.t*1327) % 10) + 1;
- var yslow = dt * pseudoRand * 0.5 + 1;
- var xslow = dt * pseudoRand * 0.05 + 1;
- if (particle.vy < 1)
- particle.vy = 0;
- else
- particle.vy = (particle.vy / yslow);
- if (particle.vx < 1)
- particle.vx = 0;
- else
- particle.vx = (particle.vx / xslow);
- particle.update = true;
- }
- }
- }
- //! [1]
-
- ImageParticle {
- anchors.fill: parent
- id: particles
- sprites: [Sprite {
- source: "../../images/realLeaf1.png"
- frameCount: 1
- frameDuration: 1
- to: {"a":1, "b":1, "c":1, "d":1}
- }, Sprite {
- name: "a"
- source: "../../images/realLeaf1.png"
- frameCount: 1
- frameDuration: 10000
- },
- Sprite {
- name: "b"
- source: "../../images/realLeaf2.png"
- frameCount: 1
- frameDuration: 10000
- },
- Sprite {
- name: "c"
- source: "../../images/realLeaf3.png"
- frameCount: 1
- frameDuration: 10000
- },
- Sprite {
- name: "d"
- source: "../../images/realLeaf4.png"
- frameCount: 1
- frameDuration: 10000
- }
- ]
-
- z:4
- }
- }
-}
diff --git a/examples/quick/particles/affectors/content/friction.qml b/examples/quick/particles/affectors/content/friction.qml
deleted file mode 100644
index 1fa85ec2fe..0000000000
--- a/examples/quick/particles/affectors/content/friction.qml
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Particles 2.0
-
-Item {
- width: 360
- height: 600
-
- Image {
- source: "../../images/backgroundLeaves.jpg"
- anchors.fill: parent
- }
- ParticleSystem {
- anchors.fill: parent
- Emitter {
- width: parent.width
- emitRate: 4
- lifeSpan: 14000
- size: 80
- velocity: PointDirection { y: 160; yVariation: 80; xVariation: 20 }
- }
-
- ImageParticle {
- anchors.fill: parent
- id: particles
- sprites: [Sprite {
- source: "../../images/realLeaf1.png"
- frameCount: 1
- frameDuration: 1
- to: {"a":1, "b":1, "c":1, "d":1}
- }, Sprite {
- name: "a"
- source: "../../images/realLeaf1.png"
- frameCount: 1
- frameDuration: 10000
- },
- Sprite {
- name: "b"
- source: "../../images/realLeaf2.png"
- frameCount: 1
- frameDuration: 10000
- },
- Sprite {
- name: "c"
- source: "../../images/realLeaf3.png"
- frameCount: 1
- frameDuration: 10000
- },
- Sprite {
- name: "d"
- source: "../../images/realLeaf4.png"
- frameCount: 1
- frameDuration: 10000
- }
- ]
-
- width: 100
- height: 100
- x: 20
- y: 20
- z:4
- }
-
- //! [0]
- Friction {
- anchors.fill: parent
- anchors.margins: -40
- factor: 0.4
- }
- //! [0]
- }
-}
diff --git a/examples/quick/particles/affectors/content/gravity.qml b/examples/quick/particles/affectors/content/gravity.qml
deleted file mode 100644
index 99b14f3b1f..0000000000
--- a/examples/quick/particles/affectors/content/gravity.qml
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-*
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Particles 2.0
-
-Item {
- id: window
- width: 320; height: 480
- Rectangle {
- id: sky
- anchors.fill: parent
- gradient: Gradient {
- GradientStop {
- position: 0.0
- color: "DeepSkyBlue"
- }
- GradientStop {
- position: 1.0
- color: "SkyBlue"
- }
- }
- }
-
- Rectangle {
- id: ground
- width: parent.height * 2
- height: parent.height
- y: parent.height/2
- x: parent.width/2 - parent.height
- transformOrigin: Item.Top
- rotation: 0
- gradient: Gradient {
- GradientStop { position: 0.0; color: "ForestGreen"; }
- GradientStop { position: 1.0; color: "DarkGreen"; }
- }
- }
-
- MouseArea {
- anchors.fill: parent
- onPositionChanged: {
- var rot = Math.atan2(mouseY - window.height/2,mouseX - window.width/2) * 180/Math.PI;
- ground.rotation = rot;
- }
- }
-
- ParticleSystem { id: sys }
- //! [0]
- Gravity {
- system: sys
- magnitude: 32
- angle: ground.rotation + 90
- }
- //! [0]
- Emitter {
- system: sys
- anchors.centerIn: parent
- emitRate: 1
- lifeSpan: 10000
- size: 64
- }
- ImageParticle {
- anchors.fill: parent
- system: sys
- source: "../../images/realLeaf1.png"
- }
-
-}
diff --git a/examples/quick/particles/affectors/content/move.qml b/examples/quick/particles/affectors/content/move.qml
deleted file mode 100644
index b33d7f4006..0000000000
--- a/examples/quick/particles/affectors/content/move.qml
+++ /dev/null
@@ -1,157 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Particles 2.0
-
-Rectangle {
- width: 360
- height: 540
- color: "black"
- ParticleSystem {
- anchors.fill: parent
- ImageParticle {
- groups: ["A"]
- anchors.fill: parent
- source: "qrc:///particleresources/star.png"
- color:"#FF1010"
- redVariation: 0.8
- }
-
- Emitter {
- group: "A"
- emitRate: 100
- lifeSpan: 2800
- size: 32
- sizeVariation: 8
- velocity: PointDirection{ x: 66; xVariation: 20 }
- width: 80
- height: 80
- }
-
- //! [A]
- Affector {
- groups: ["A"]
- x: 120
- width: 80
- height: 80
- once: true
- position: PointDirection { x: 120; }
- }
- //! [A]
-
- ImageParticle {
- groups: ["B"]
- anchors.fill: parent
- source: "qrc:///particleresources/star.png"
- color:"#10FF10"
- greenVariation: 0.8
- }
-
- Emitter {
- group: "B"
- emitRate: 100
- lifeSpan: 2800
- size: 32
- sizeVariation: 8
- velocity: PointDirection{ x: 240; xVariation: 60 }
- y: 260
- width: 10
- height: 10
- }
-
- //! [B]
- Affector {
- groups: ["B"]
- x: 120
- y: 240
- width: 80
- height: 80
- once: true
- velocity: AngleDirection { angleVariation:360; magnitude: 72 }
- }
- //! [B]
-
- ImageParticle {
- groups: ["C"]
- anchors.fill: parent
- source: "qrc:///particleresources/star.png"
- color:"#1010FF"
- blueVariation: 0.8
- }
-
- Emitter {
- group: "C"
- y: 400
- emitRate: 100
- lifeSpan: 2800
- size: 32
- sizeVariation: 8
- velocity: PointDirection{ x: 80; xVariation: 10 }
- acceleration: PointDirection { y: 10; x: 20; }
- width: 80
- height: 80
- }
-
- //! [C]
- Affector {
- groups: ["C"]
- x: 120
- y: 400
- width: 80
- height: 120
- once: true
- relative: false
- acceleration: PointDirection { y: -80; }
- }
- //! [C]
-
- }
-}
diff --git a/examples/quick/particles/affectors/content/turbulence.qml b/examples/quick/particles/affectors/content/turbulence.qml
deleted file mode 100644
index e58b3ede7f..0000000000
--- a/examples/quick/particles/affectors/content/turbulence.qml
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Particles 2.0
-
-Rectangle {
- width: 320
- height: 480
- color: "#222222"
- id: root
- Image {
- source: "../../images/candle.png"
- anchors.bottom: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottomMargin: -60
- anchors.horizontalCenterOffset: 2
- }
- ParticleSystem {
- anchors.fill: parent
- MouseArea {
- anchors.fill: parent
- onClicked: turb.enabled = !turb.enabled
- }
-
- //! [0]
- Turbulence {
- id: turb
- enabled: true
- height: (parent.height / 2) - 4
- width: parent.width
- x: parent. width / 4
- anchors.fill: parent
- strength: 32
- NumberAnimation on strength{from: 16; to: 64; easing.type: Easing.InOutBounce; duration: 1800; loops: -1}
- }
- //! [0]
-
- ImageParticle {
- groups: ["smoke"]
- source: "qrc:///particleresources/glowdot.png"
- color: "#11111111"
- colorVariation: 0
- }
- ImageParticle {
- groups: ["flame"]
- source: "qrc:///particleresources/glowdot.png"
- color: "#11ff400f"
- colorVariation: 0.1
- }
- Emitter {
- anchors.centerIn: parent
- group: "flame"
-
- emitRate: 120
- lifeSpan: 1200
- size: 20
- endSize: 10
- sizeVariation: 10
- acceleration: PointDirection { y: -40 }
- velocity: AngleDirection { angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 }
- }
- TrailEmitter {
- id: smoke1
- width: root.width
- height: root.height/2
- group: "smoke"
- follow: "flame"
-
- emitRatePerParticle: 1
- lifeSpan: 2400
- lifeSpanVariation: 400
- size: 16
- endSize: 8
- sizeVariation: 8
- acceleration: PointDirection { y: -40 }
- velocity: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
- }
- TrailEmitter {
- id: smoke2
- width: root.width
- height: root.height/2 - 20
- group: "smoke"
- follow: "flame"
-
- emitRatePerParticle: 4
- lifeSpan: 2400
- size: 36
- endSize: 24
- sizeVariation: 12
- acceleration: PointDirection { y: -40 }
- velocity: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
- }
- }
-}
diff --git a/examples/quick/particles/affectors/content/wander.qml b/examples/quick/particles/affectors/content/wander.qml
deleted file mode 100644
index 736fc1af76..0000000000
--- a/examples/quick/particles/affectors/content/wander.qml
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Particles 2.0
-
-Rectangle {
- width: 360
- height: 540
- ParticleSystem { id: particles }
- ImageParticle {
- system: particles
- sprites: Sprite {
- name: "snow"
- source: "../../images/snowflake.png"
- frameCount: 51
- frameDuration: 40
- frameDurationVariation: 8
- }
- }
-
- //! [0]
- Wander {
- id: wanderer
- system: particles
- anchors.fill: parent
- xVariance: 360/(wanderer.affectedParameter+1);
- pace: 100*(wanderer.affectedParameter+1);
- }
- //! [0]
-
- Emitter {
- system: particles
- emitRate: 20
- lifeSpan: 7000
- velocity: PointDirection { y:80; yVariation: 40; }
- acceleration: PointDirection { y: 4 }
- size: 20
- sizeVariation: 10
- width: parent.width
- height: 100
- }
- Row {
- anchors.bottom: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- spacing: 4
- GreyButton {
- text:"dx/dt"
- onClicked: wanderer.affectedParameter = Wander.Position;
- }
- GreyButton {
- text:"dv/dt"
- onClicked: wanderer.affectedParameter = Wander.Velocity;
- }
- GreyButton {
- text:"da/dt"
- onClicked: wanderer.affectedParameter = Wander.Acceleration;
- }
- }
-}
diff --git a/examples/quick/particles/affectors/customaffector.qml b/examples/quick/particles/affectors/customaffector.qml
new file mode 100644
index 0000000000..e85ea96ef6
--- /dev/null
+++ b/examples/quick/particles/affectors/customaffector.qml
@@ -0,0 +1,109 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Item {
+ width: 360
+ height: 600
+
+ Image {
+ source: "images/backgroundLeaves.jpg"
+ anchors.fill: parent
+ }
+ ParticleSystem {
+ anchors.fill: parent
+ Emitter {
+ width: parent.width
+ emitRate: 4
+ lifeSpan: 14000
+ size: 80
+ velocity: PointDirection { y: 60 }
+ }
+ Wander {
+ anchors.fill: parent
+ anchors.bottomMargin: 100
+ xVariance: 60
+ pace: 60
+ }
+
+ //! [0]
+ Affector {
+ width: parent.width
+ height: parent.height - 100
+ onAffectParticles: (particles, dt) => {
+ //Wobbly movement
+ for (var i=0; i<particles.length; i++) {
+ var particle = particles[i];
+ particle.rotation += particle.vx * 0.15 * dt;
+ particle.update = true;
+ }
+ }
+ }
+ //! [0]
+
+ //! [1]
+ Affector {//Custom Friction, adds some 'randomness'
+ x: -60
+ width: parent.width + 120
+ height: 100
+ anchors.bottom: parent.bottom
+ onAffectParticles: (particles, dt) => {
+ for (var i=0; i<particles.length; i++) {
+ var particle = particles[i];
+ var pseudoRand = (Math.floor(particle.t*1327) % 10) + 1;
+ var yslow = dt * pseudoRand * 0.5 + 1;
+ var xslow = dt * pseudoRand * 0.05 + 1;
+ if (particle.vy < 1)
+ particle.vy = 0;
+ else
+ particle.vy = (particle.vy / yslow);
+ if (particle.vx < 1)
+ particle.vx = 0;
+ else
+ particle.vx = (particle.vx / xslow);
+ particle.update = true;
+ }
+ }
+ }
+ //! [1]
+
+ ImageParticle {
+ anchors.fill: parent
+ id: particles
+ sprites: [Sprite {
+ source: "images/realLeaf1.png"
+ frameCount: 1
+ frameDuration: 1
+ to: {"a":1, "b":1, "c":1, "d":1}
+ }, Sprite {
+ name: "a"
+ source: "images/realLeaf1.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "b"
+ source: "images/realLeaf2.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "c"
+ source: "images/realLeaf3.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "d"
+ source: "images/realLeaf4.png"
+ frameCount: 1
+ frameDuration: 10000
+ }
+ ]
+
+ z:4
+ }
+ }
+}
diff --git a/examples/quick/particles/affectors/doc/src/affectors.qdoc b/examples/quick/particles/affectors/doc/src/affectors.qdoc
index 9857a86241..73f99aabed 100644
--- a/examples/quick/particles/affectors/doc/src/affectors.qdoc
+++ b/examples/quick/particles/affectors/doc/src/affectors.qdoc
@@ -1,33 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\title Qt Quick Particles Examples - Affectors
\example particles/affectors
+ \examplecategory {Graphics}
\brief This is a collection of examples using Affectors in the QML particle system.
\image qml-affectors-example.png
@@ -35,7 +12,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 +21,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 +32,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/friction.qml b/examples/quick/particles/affectors/friction.qml
new file mode 100644
index 0000000000..ec2a421387
--- /dev/null
+++ b/examples/quick/particles/affectors/friction.qml
@@ -0,0 +1,74 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Item {
+ width: 360
+ height: 600
+
+ Image {
+ source: "images/backgroundLeaves.jpg"
+ anchors.fill: parent
+ }
+ ParticleSystem {
+ anchors.fill: parent
+ Emitter {
+ width: parent.width
+ emitRate: 4
+ lifeSpan: 14000
+ size: 80
+ velocity: PointDirection { y: 160; yVariation: 80; xVariation: 20 }
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ id: particles
+ sprites: [Sprite {
+ source: "images/realLeaf1.png"
+ frameCount: 1
+ frameDuration: 1
+ to: {"a":1, "b":1, "c":1, "d":1}
+ }, Sprite {
+ name: "a"
+ source: "images/realLeaf1.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "b"
+ source: "images/realLeaf2.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "c"
+ source: "images/realLeaf3.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "d"
+ source: "images/realLeaf4.png"
+ frameCount: 1
+ frameDuration: 10000
+ }
+ ]
+
+ width: 100
+ height: 100
+ x: 20
+ y: 20
+ z:4
+ }
+
+ //! [0]
+ Friction {
+ anchors.fill: parent
+ anchors.margins: -40
+ factor: 0.4
+ }
+ //! [0]
+ }
+}
diff --git a/examples/quick/particles/affectors/gravity.qml b/examples/quick/particles/affectors/gravity.qml
new file mode 100644
index 0000000000..cf64d48689
--- /dev/null
+++ b/examples/quick/particles/affectors/gravity.qml
@@ -0,0 +1,68 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Item {
+ id: window
+ width: 320; height: 480
+ Rectangle {
+ id: sky
+ anchors.fill: parent
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: "DeepSkyBlue"
+ }
+ GradientStop {
+ position: 1.0
+ color: "SkyBlue"
+ }
+ }
+ }
+
+ Rectangle {
+ id: ground
+ width: parent.height * 2
+ height: parent.height
+ y: parent.height/2
+ x: parent.width/2 - parent.height
+ transformOrigin: Item.Top
+ rotation: 0
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "ForestGreen"; }
+ GradientStop { position: 1.0; color: "DarkGreen"; }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onPositionChanged: {
+ var rot = Math.atan2(mouseY - window.height/2,mouseX - window.width/2) * 180/Math.PI;
+ ground.rotation = rot;
+ }
+ }
+
+ ParticleSystem { id: sys }
+ //! [0]
+ Gravity {
+ system: sys
+ magnitude: 32
+ angle: ground.rotation + 90
+ }
+ //! [0]
+ Emitter {
+ system: sys
+ anchors.centerIn: parent
+ emitRate: 1
+ lifeSpan: 10000
+ size: 64
+ }
+ ImageParticle {
+ anchors.fill: parent
+ system: sys
+ source: "images/realLeaf1.png"
+ }
+
+}
diff --git a/examples/quick/particles/affectors/content/groupgoal.qml b/examples/quick/particles/affectors/groupgoal.qml
index 9910531a98..a1a784e2ec 100644
--- a/examples/quick/particles/affectors/content/groupgoal.qml
+++ b/examples/quick/particles/affectors/groupgoal.qml
@@ -1,55 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
@@ -74,7 +27,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 +104,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 +141,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..46fbff5674 100644
--- a/examples/quick/particles/affectors/main.cpp
+++ b/examples/quick/particles/affectors/main.cpp
@@ -1,51 +1,4 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "../../shared/shared.h"
-DECLARATIVE_EXAMPLE_MAIN(particles/affectors/affectors)
+DECLARATIVE_EXAMPLE_MAIN(affectors/affectors)
diff --git a/examples/quick/particles/affectors/move.qml b/examples/quick/particles/affectors/move.qml
new file mode 100644
index 0000000000..447f5b0d32
--- /dev/null
+++ b/examples/quick/particles/affectors/move.qml
@@ -0,0 +1,110 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ width: 360
+ height: 540
+ color: "black"
+ ParticleSystem {
+ anchors.fill: parent
+ ImageParticle {
+ groups: ["A"]
+ anchors.fill: parent
+ source: "qrc:///particleresources/star.png"
+ color:"#FF1010"
+ redVariation: 0.8
+ }
+
+ Emitter {
+ group: "A"
+ emitRate: 100
+ lifeSpan: 2800
+ size: 32
+ sizeVariation: 8
+ velocity: PointDirection{ x: 66; xVariation: 20 }
+ width: 80
+ height: 80
+ }
+
+ //! [A]
+ Affector {
+ groups: ["A"]
+ x: 120
+ width: 80
+ height: 80
+ once: true
+ position: PointDirection { x: 120; }
+ }
+ //! [A]
+
+ ImageParticle {
+ groups: ["B"]
+ anchors.fill: parent
+ source: "qrc:///particleresources/star.png"
+ color:"#10FF10"
+ greenVariation: 0.8
+ }
+
+ Emitter {
+ group: "B"
+ emitRate: 100
+ lifeSpan: 2800
+ size: 32
+ sizeVariation: 8
+ velocity: PointDirection{ x: 240; xVariation: 60 }
+ y: 260
+ width: 10
+ height: 10
+ }
+
+ //! [B]
+ Affector {
+ groups: ["B"]
+ x: 120
+ y: 240
+ width: 80
+ height: 80
+ once: true
+ velocity: AngleDirection { angleVariation:360; magnitude: 72 }
+ }
+ //! [B]
+
+ ImageParticle {
+ groups: ["C"]
+ anchors.fill: parent
+ source: "qrc:///particleresources/star.png"
+ color:"#1010FF"
+ blueVariation: 0.8
+ }
+
+ Emitter {
+ group: "C"
+ y: 400
+ emitRate: 100
+ lifeSpan: 2800
+ size: 32
+ sizeVariation: 8
+ velocity: PointDirection{ x: 80; xVariation: 10 }
+ acceleration: PointDirection { y: 10; x: 20; }
+ width: 80
+ height: 80
+ }
+
+ //! [C]
+ Affector {
+ groups: ["C"]
+ x: 120
+ y: 400
+ width: 80
+ height: 120
+ once: true
+ relative: false
+ acceleration: PointDirection { y: -80; }
+ }
+ //! [C]
+
+ }
+}
diff --git a/examples/quick/particles/affectors/content/spritegoal.qml b/examples/quick/particles/affectors/spritegoal.qml
index 294f693221..98d793d304 100644
--- a/examples/quick/particles/affectors/content/spritegoal.qml
+++ b/examples/quick/particles/affectors/spritegoal.qml
@@ -1,55 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
Item {
id: root
@@ -62,7 +15,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 +66,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 +98,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
@@ -161,7 +114,7 @@ Item {
id: circle
x: root.width / 1.2
y: root.height / 1.7
- property real percent: 0
+ property real percent
SequentialAnimation on percent {
id: circleAnim1
@@ -182,7 +135,6 @@ Item {
groups: ["exhaust"]
source: "qrc:///particleresources/fuzzydot.png"
- color: "orange"
SequentialAnimation on color {
loops: Animation.Infinite
ColorAnimation {
diff --git a/examples/quick/particles/affectors/turbulence.qml b/examples/quick/particles/affectors/turbulence.qml
new file mode 100644
index 0000000000..049e1a584d
--- /dev/null
+++ b/examples/quick/particles/affectors/turbulence.qml
@@ -0,0 +1,94 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ width: 320
+ height: 480
+ color: "#222222"
+ id: root
+ Image {
+ source: "images/candle.png"
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottomMargin: -60
+ anchors.horizontalCenterOffset: 2
+ }
+ ParticleSystem {
+ anchors.fill: parent
+ MouseArea {
+ anchors.fill: parent
+ onClicked: turb.enabled = !turb.enabled
+ }
+
+ //! [0]
+ Turbulence {
+ id: turb
+ enabled: true
+ height: (parent.height / 2) - 4
+ width: parent.width
+ x: parent. width / 4
+ anchors.fill: parent
+ NumberAnimation on strength{from: 16; to: 64; easing.type: Easing.InOutBounce; duration: 1800; loops: -1}
+ }
+ //! [0]
+
+ ImageParticle {
+ groups: ["smoke"]
+ source: "qrc:///particleresources/glowdot.png"
+ color: "#11111111"
+ colorVariation: 0
+ }
+ ImageParticle {
+ groups: ["flame"]
+ source: "qrc:///particleresources/glowdot.png"
+ color: "#11ff400f"
+ colorVariation: 0.1
+ }
+ Emitter {
+ anchors.centerIn: parent
+ group: "flame"
+
+ emitRate: 120
+ lifeSpan: 1200
+ size: 20
+ endSize: 10
+ sizeVariation: 10
+ acceleration: PointDirection { y: -40 }
+ velocity: AngleDirection { angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 }
+ }
+ TrailEmitter {
+ id: smoke1
+ width: root.width
+ height: root.height/2
+ group: "smoke"
+ follow: "flame"
+
+ emitRatePerParticle: 1
+ lifeSpan: 2400
+ lifeSpanVariation: 400
+ size: 16
+ endSize: 8
+ sizeVariation: 8
+ acceleration: PointDirection { y: -40 }
+ velocity: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
+ }
+ TrailEmitter {
+ id: smoke2
+ width: root.width
+ height: root.height/2 - 20
+ group: "smoke"
+ follow: "flame"
+
+ emitRatePerParticle: 4
+ lifeSpan: 2400
+ size: 36
+ endSize: 24
+ sizeVariation: 12
+ acceleration: PointDirection { y: -40 }
+ velocity: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
+ }
+ }
+}
diff --git a/examples/quick/particles/affectors/wander.qml b/examples/quick/particles/affectors/wander.qml
new file mode 100644
index 0000000000..c4c2914d49
--- /dev/null
+++ b/examples/quick/particles/affectors/wander.qml
@@ -0,0 +1,60 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ width: 360
+ height: 540
+ ParticleSystem { id: particles }
+ ImageParticle {
+ system: particles
+ sprites: Sprite {
+ name: "snow"
+ source: "images/snowflake.png"
+ frameCount: 51
+ frameDuration: 40
+ frameDurationVariation: 8
+ }
+ }
+
+ //! [0]
+ Wander {
+ id: wanderer
+ system: particles
+ anchors.fill: parent
+ xVariance: 360/(wanderer.affectedParameter+1);
+ pace: 100*(wanderer.affectedParameter+1);
+ }
+ //! [0]
+
+ Emitter {
+ system: particles
+ emitRate: 20
+ lifeSpan: 7000
+ velocity: PointDirection { y:80; yVariation: 40; }
+ acceleration: PointDirection { y: 4 }
+ size: 20
+ sizeVariation: 10
+ width: parent.width
+ height: 100
+ }
+ Row {
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ spacing: 4
+ GreyButton {
+ text: qsTr("dx/dt")
+ onClicked: wanderer.affectedParameter = Wander.Position;
+ }
+ GreyButton {
+ text: qsTr("dv/dt")
+ onClicked: wanderer.affectedParameter = Wander.Velocity;
+ }
+ GreyButton {
+ text: qsTr("da/dt")
+ onClicked: wanderer.affectedParameter = Wander.Acceleration;
+ }
+ }
+}