aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/particles
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/particles')
-rw-r--r--examples/quick/particles/.prev_CMakeLists.txt7
-rw-r--r--examples/quick/particles/CMakeLists.txt12
-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.png (renamed from examples/quick/particles/images/_explo.png)bin81528 -> 81528 bytes
-rw-r--r--examples/quick/particles/affectors/images/backgroundLeaves.jpg (renamed from examples/quick/particles/images/backgroundLeaves.jpg)bin78665 -> 78665 bytes
-rw-r--r--examples/quick/particles/affectors/images/candle.png (renamed from examples/quick/particles/images/candle.png)bin1348 -> 1348 bytes
-rw-r--r--examples/quick/particles/affectors/images/finalfrontier.png (renamed from examples/quick/particles/images/finalfrontier.png)bin695061 -> 695061 bytes
-rw-r--r--examples/quick/particles/affectors/images/matchmask.png (renamed from examples/quick/particles/images/matchmask.png)bin2369 -> 2369 bytes
-rw-r--r--examples/quick/particles/affectors/images/meteor.png (renamed from examples/quick/particles/images/meteor.png)bin83169 -> 83169 bytes
-rw-r--r--examples/quick/particles/affectors/images/nullRock.png (renamed from examples/quick/particles/images/nullRock.png)bin140 -> 140 bytes
-rw-r--r--examples/quick/particles/affectors/images/particleA.png (renamed from examples/quick/particles/images/particleA.png)bin870 -> 870 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf1.png (renamed from examples/quick/particles/images/realLeaf1.png)bin15625 -> 15625 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf2.png (renamed from examples/quick/particles/images/realLeaf2.png)bin13660 -> 13660 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf3.png (renamed from examples/quick/particles/images/realLeaf3.png)bin23809 -> 23809 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf4.png (renamed from examples/quick/particles/images/realLeaf4.png)bin23655 -> 23655 bytes
-rw-r--r--examples/quick/particles/affectors/images/rocket.png (renamed from examples/quick/particles/images/rocket.png)bin7315 -> 7315 bytes
-rw-r--r--examples/quick/particles/affectors/images/rocket2.png (renamed from examples/quick/particles/images/rocket2.png)bin1918 -> 1918 bytes
-rw-r--r--examples/quick/particles/affectors/images/snowflake.png (renamed from examples/quick/particles/images/snowflake.png)bin189327 -> 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
-rw-r--r--examples/quick/particles/emitters/CMakeLists.txt299
-rw-r--r--examples/quick/particles/emitters/burstandpulse.qml75
-rw-r--r--examples/quick/particles/emitters/content/burstandpulse.qml122
-rw-r--r--examples/quick/particles/emitters/content/customemitter.qml106
-rw-r--r--examples/quick/particles/emitters/content/emitmask.qml84
-rw-r--r--examples/quick/particles/emitters/content/maximumemitted.qml92
-rw-r--r--examples/quick/particles/emitters/content/shapeanddirection.qml122
-rw-r--r--examples/quick/particles/emitters/customemitter.qml59
-rw-r--r--examples/quick/particles/emitters/doc/src/emitters.qdoc41
-rw-r--r--examples/quick/particles/emitters/emitmask.qml37
-rw-r--r--examples/quick/particles/emitters/emitters.pro1
-rw-r--r--examples/quick/particles/emitters/emitters.qml71
-rw-r--r--examples/quick/particles/emitters/emitters.qrc18
-rw-r--r--examples/quick/particles/emitters/images/portal_bg.png (renamed from examples/quick/particles/images/portal_bg.png)bin96858 -> 96858 bytes
-rw-r--r--examples/quick/particles/emitters/images/starfish_mask.png (renamed from examples/quick/particles/images/starfish_mask.png)bin7403 -> 7403 bytes
-rw-r--r--examples/quick/particles/emitters/main.cpp53
-rw-r--r--examples/quick/particles/emitters/maximumemitted.qml45
-rw-r--r--examples/quick/particles/emitters/shapeanddirection.qml75
-rw-r--r--examples/quick/particles/emitters/trailemitter.qml (renamed from examples/quick/particles/emitters/content/trailemitter.qml)57
-rw-r--r--examples/quick/particles/emitters/velocityfrommotion.qml (renamed from examples/quick/particles/emitters/content/velocityfrommotion.qml)69
-rw-r--r--examples/quick/particles/imageparticle/CMakeLists.txt305
-rw-r--r--examples/quick/particles/imageparticle/allatonce.qml63
-rw-r--r--examples/quick/particles/imageparticle/colored.qml51
-rw-r--r--examples/quick/particles/imageparticle/colortable.qml49
-rw-r--r--examples/quick/particles/imageparticle/content/allatonce.qml110
-rw-r--r--examples/quick/particles/imageparticle/content/colored.qml98
-rw-r--r--examples/quick/particles/imageparticle/content/colortable.qml96
-rw-r--r--examples/quick/particles/imageparticle/content/deformation.qml135
-rw-r--r--examples/quick/particles/imageparticle/content/rotation.qml83
-rw-r--r--examples/quick/particles/imageparticle/content/sprites.qml126
-rw-r--r--examples/quick/particles/imageparticle/deformation.qml88
-rw-r--r--examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc43
-rw-r--r--examples/quick/particles/imageparticle/imageparticle.pro1
-rw-r--r--examples/quick/particles/imageparticle/imageparticle.qml71
-rw-r--r--examples/quick/particles/imageparticle/imageparticle.qrc24
-rw-r--r--examples/quick/particles/imageparticle/images/bear_tiles.png (renamed from examples/quick/particles/images/bear_tiles.png)bin40349 -> 40349 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/colortable.png (renamed from examples/quick/particles/images/colortable.png)bin571 -> 571 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/flower.png (renamed from examples/quick/particles/images/flower.png)bin4683 -> 4683 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/starfish_0.png (renamed from examples/quick/particles/images/starfish_0.png)bin15972 -> 15972 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/starfish_1.png (renamed from examples/quick/particles/images/starfish_1.png)bin15746 -> 15746 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/starfish_2.png (renamed from examples/quick/particles/images/starfish_2.png)bin16067 -> 16067 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/starfish_3.png (renamed from examples/quick/particles/images/starfish_3.png)bin16201 -> 16201 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/starfish_4.png (renamed from examples/quick/particles/images/starfish_4.png)bin14698 -> 14698 bytes
-rw-r--r--examples/quick/particles/imageparticle/main.cpp53
-rw-r--r--examples/quick/particles/imageparticle/rotation.qml36
-rw-r--r--examples/quick/particles/imageparticle/sharing.qml (renamed from examples/quick/particles/imageparticle/content/sharing.qml)61
-rw-r--r--examples/quick/particles/imageparticle/sprites.qml79
-rw-r--r--examples/quick/particles/images.qrc35
-rw-r--r--examples/quick/particles/images/meteor_explo.pngbin219946 -> 0 bytes
-rw-r--r--examples/quick/particles/images/meteors.pngbin132137 -> 0 bytes
-rw-r--r--examples/quick/particles/images/sizeInOut.pngbin132 -> 0 bytes
-rw-r--r--examples/quick/particles/itemparticle/CMakeLists.txt271
-rw-r--r--examples/quick/particles/itemparticle/content/Delegate.qml98
-rw-r--r--examples/quick/particles/itemparticle/content/Delegate2.qml89
-rw-r--r--examples/quick/particles/itemparticle/content/ExpandingDelegate.qml215
-rw-r--r--examples/quick/particles/itemparticle/content/bubble.pngbin2347 -> 0 bytes
-rw-r--r--examples/quick/particles/itemparticle/content/script.js27
-rw-r--r--examples/quick/particles/itemparticle/delegates.qml105
-rw-r--r--examples/quick/particles/itemparticle/itemparticle.pro12
-rw-r--r--examples/quick/particles/itemparticle/main.cpp51
-rw-r--r--examples/quick/particles/itemparticle/particleview.qml309
-rw-r--r--examples/quick/particles/particles.pro4
-rw-r--r--examples/quick/particles/system/CMakeLists.txt296
-rw-r--r--examples/quick/particles/system/content/dynamiccomparison.qml149
-rw-r--r--examples/quick/particles/system/content/dynamicemitters.qml150
-rw-r--r--examples/quick/particles/system/content/multiplepainters.qml106
-rw-r--r--examples/quick/particles/system/content/startstop.qml96
-rw-r--r--examples/quick/particles/system/content/timedgroupchanges.qml137
-rw-r--r--examples/quick/particles/system/doc/src/system.qdoc39
-rw-r--r--examples/quick/particles/system/dynamiccomparison.qml103
-rw-r--r--examples/quick/particles/system/dynamicemitters.qml107
-rw-r--r--examples/quick/particles/system/images/particle2.png (renamed from examples/quick/particles/images/particle2.png)bin1073 -> 1073 bytes
-rw-r--r--examples/quick/particles/system/images/particle3.png (renamed from examples/quick/particles/images/particle3.png)bin574 -> 574 bytes
-rw-r--r--examples/quick/particles/system/images/sparkleSize.png (renamed from examples/quick/particles/images/sparkleSize.png)bin378 -> 378 bytes
-rw-r--r--examples/quick/particles/system/main.cpp53
-rw-r--r--examples/quick/particles/system/multiplepainters.qml58
-rw-r--r--examples/quick/particles/system/startstop.qml50
-rw-r--r--examples/quick/particles/system/system.pro1
-rw-r--r--examples/quick/particles/system/system.qml67
-rw-r--r--examples/quick/particles/system/system.qrc15
-rw-r--r--examples/quick/particles/system/timedgroupchanges.qml90
123 files changed, 2102 insertions, 6005 deletions
diff --git a/examples/quick/particles/.prev_CMakeLists.txt b/examples/quick/particles/.prev_CMakeLists.txt
deleted file mode 100644
index 1dbf49be21..0000000000
--- a/examples/quick/particles/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# Generated from particles.pro.
-
-add_subdirectory(affectors)
-add_subdirectory(emitters)
-add_subdirectory(imageparticle)
-add_subdirectory(itemparticle)
-add_subdirectory(system)
diff --git a/examples/quick/particles/CMakeLists.txt b/examples/quick/particles/CMakeLists.txt
index 1dbf49be21..ce9658b74a 100644
--- a/examples/quick/particles/CMakeLists.txt
+++ b/examples/quick/particles/CMakeLists.txt
@@ -1,7 +1,7 @@
-# Generated from particles.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-add_subdirectory(affectors)
-add_subdirectory(emitters)
-add_subdirectory(imageparticle)
-add_subdirectory(itemparticle)
-add_subdirectory(system)
+qt_internal_add_example(affectors)
+qt_internal_add_example(emitters)
+qt_internal_add_example(imageparticle)
+qt_internal_add_example(system)
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/images/_explo.png b/examples/quick/particles/affectors/images/_explo.png
index 4297245d49..4297245d49 100644
--- a/examples/quick/particles/images/_explo.png
+++ b/examples/quick/particles/affectors/images/_explo.png
Binary files differ
diff --git a/examples/quick/particles/images/backgroundLeaves.jpg b/examples/quick/particles/affectors/images/backgroundLeaves.jpg
index 08be16751d..08be16751d 100644
--- a/examples/quick/particles/images/backgroundLeaves.jpg
+++ b/examples/quick/particles/affectors/images/backgroundLeaves.jpg
Binary files differ
diff --git a/examples/quick/particles/images/candle.png b/examples/quick/particles/affectors/images/candle.png
index 8fa3193719..8fa3193719 100644
--- a/examples/quick/particles/images/candle.png
+++ b/examples/quick/particles/affectors/images/candle.png
Binary files differ
diff --git a/examples/quick/particles/images/finalfrontier.png b/examples/quick/particles/affectors/images/finalfrontier.png
index 2ba1815230..2ba1815230 100644
--- a/examples/quick/particles/images/finalfrontier.png
+++ b/examples/quick/particles/affectors/images/finalfrontier.png
Binary files differ
diff --git a/examples/quick/particles/images/matchmask.png b/examples/quick/particles/affectors/images/matchmask.png
index e575875c55..e575875c55 100644
--- a/examples/quick/particles/images/matchmask.png
+++ b/examples/quick/particles/affectors/images/matchmask.png
Binary files differ
diff --git a/examples/quick/particles/images/meteor.png b/examples/quick/particles/affectors/images/meteor.png
index e8c368aea7..e8c368aea7 100644
--- a/examples/quick/particles/images/meteor.png
+++ b/examples/quick/particles/affectors/images/meteor.png
Binary files differ
diff --git a/examples/quick/particles/images/nullRock.png b/examples/quick/particles/affectors/images/nullRock.png
index 4076327a1a..4076327a1a 100644
--- a/examples/quick/particles/images/nullRock.png
+++ b/examples/quick/particles/affectors/images/nullRock.png
Binary files differ
diff --git a/examples/quick/particles/images/particleA.png b/examples/quick/particles/affectors/images/particleA.png
index d86fc9696b..d86fc9696b 100644
--- a/examples/quick/particles/images/particleA.png
+++ b/examples/quick/particles/affectors/images/particleA.png
Binary files differ
diff --git a/examples/quick/particles/images/realLeaf1.png b/examples/quick/particles/affectors/images/realLeaf1.png
index 6cabf29efd..6cabf29efd 100644
--- a/examples/quick/particles/images/realLeaf1.png
+++ b/examples/quick/particles/affectors/images/realLeaf1.png
Binary files differ
diff --git a/examples/quick/particles/images/realLeaf2.png b/examples/quick/particles/affectors/images/realLeaf2.png
index bfeca861d5..bfeca861d5 100644
--- a/examples/quick/particles/images/realLeaf2.png
+++ b/examples/quick/particles/affectors/images/realLeaf2.png
Binary files differ
diff --git a/examples/quick/particles/images/realLeaf3.png b/examples/quick/particles/affectors/images/realLeaf3.png
index b1071e862b..b1071e862b 100644
--- a/examples/quick/particles/images/realLeaf3.png
+++ b/examples/quick/particles/affectors/images/realLeaf3.png
Binary files differ
diff --git a/examples/quick/particles/images/realLeaf4.png b/examples/quick/particles/affectors/images/realLeaf4.png
index d61d53d10e..d61d53d10e 100644
--- a/examples/quick/particles/images/realLeaf4.png
+++ b/examples/quick/particles/affectors/images/realLeaf4.png
Binary files differ
diff --git a/examples/quick/particles/images/rocket.png b/examples/quick/particles/affectors/images/rocket.png
index a171610b03..a171610b03 100644
--- a/examples/quick/particles/images/rocket.png
+++ b/examples/quick/particles/affectors/images/rocket.png
Binary files differ
diff --git a/examples/quick/particles/images/rocket2.png b/examples/quick/particles/affectors/images/rocket2.png
index 7110f8fdc6..7110f8fdc6 100644
--- a/examples/quick/particles/images/rocket2.png
+++ b/examples/quick/particles/affectors/images/rocket2.png
Binary files differ
diff --git a/examples/quick/particles/images/snowflake.png b/examples/quick/particles/affectors/images/snowflake.png
index 490887a82f..490887a82f 100644
--- a/examples/quick/particles/images/snowflake.png
+++ 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;
+ }
+ }
+}
diff --git a/examples/quick/particles/emitters/CMakeLists.txt b/examples/quick/particles/emitters/CMakeLists.txt
index a6ca0875ce..772f45fa0a 100644
--- a/examples/quick/particles/emitters/CMakeLists.txt
+++ b/examples/quick/particles/emitters/CMakeLists.txt
@@ -1,267 +1,56 @@
-# Generated from emitters.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(emitters 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/emitters")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
-
-qt_add_executable(emitters
+qt_add_executable(emittersexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(emitters PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(emitters PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
-)
-
-# Resources:
-set(emitters_resource_files
- "content/burstandpulse.qml"
- "content/customemitter.qml"
- "content/emitmask.qml"
- "content/maximumemitted.qml"
- "content/shapeanddirection.qml"
- "content/trailemitter.qml"
- "content/velocityfrommotion.qml"
- "emitters.qml"
+target_link_libraries(emittersexample PRIVATE
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Qml
+ Qt6::Quick
)
-qt6_add_resources(emitters "emitters"
- PREFIX
- "/particles/emitters"
- FILES
- ${emitters_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"
-)
-
-qt6_add_resources(emitters "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"
-)
+add_dependencies(emittersexample emitters_shared)
-qt6_add_resources(emitters "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS emitters
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
+# Resources:
+qt_add_qml_module(emittersexample
+ URI emitters
+ QML_FILES
+ "burstandpulse.qml"
+ "customemitter.qml"
+ "emitmask.qml"
+ "maximumemitted.qml"
+ "shapeanddirection.qml"
+ "trailemitter.qml"
+ "velocityfrommotion.qml"
+ "emitters.qml"
+ RESOURCES
+ "images/portal_bg.png"
+ "images/starfish_mask.png"
+)
+
+install(TARGETS emittersexample
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET emittersexample
+ 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/emitters/burstandpulse.qml b/examples/quick/particles/emitters/burstandpulse.qml
new file mode 100644
index 0000000000..ffc620e41b
--- /dev/null
+++ b/examples/quick/particles/emitters/burstandpulse.qml
@@ -0,0 +1,75 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ id: root
+
+ width: 320
+ height: 480
+ color: "black"
+ property bool lastWasPulse: false
+ Timer {
+ interval: 3500
+ triggeredOnStart: true
+ running: true
+ repeat: true
+ onTriggered: {
+ //! [0]
+ if (root.lastWasPulse) {
+ burstEmitter.burst(500);
+ root.lastWasPulse = false;
+ } else {
+ pulseEmitter.pulse(500);
+ root.lastWasPulse = true;
+ }
+ //! [0]
+ }
+ }
+ ParticleSystem {
+ id: particles
+ anchors.fill: parent
+ ImageParticle {
+ source: "qrc:///particleresources/star.png"
+ alpha: 0
+ colorVariation: 0.6
+ }
+
+ Emitter {
+ id: burstEmitter
+ x: parent.width/2
+ y: parent.height/3
+ emitRate: 1000
+ lifeSpan: 2000
+ enabled: false
+ velocity: AngleDirection{magnitude: 64; angleVariation: 360}
+ size: 24
+ sizeVariation: 8
+ Text {
+ anchors.centerIn: parent
+ color: "white"
+ font.pixelSize: 18
+ text: "Burst"
+ }
+ }
+ Emitter {
+ id: pulseEmitter
+ x: parent.width/2
+ y: 2*parent.height/3
+ emitRate: 1000
+ lifeSpan: 2000
+ enabled: false
+ velocity: AngleDirection{magnitude: 64; angleVariation: 360}
+ size: 24
+ sizeVariation: 8
+ Text {
+ anchors.centerIn: parent
+ color: "white"
+ font.pixelSize: 18
+ text: "Pulse"
+ }
+ }
+ }
+}
diff --git a/examples/quick/particles/emitters/content/burstandpulse.qml b/examples/quick/particles/emitters/content/burstandpulse.qml
deleted file mode 100644
index d3c38c2360..0000000000
--- a/examples/quick/particles/emitters/content/burstandpulse.qml
+++ /dev/null
@@ -1,122 +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: 320
- height: 480
- color: "black"
- property bool lastWasPulse: false
- Timer {
- interval: 3500
- triggeredOnStart: true
- running: true
- repeat: true
- onTriggered: {
- //! [0]
- if (root.lastWasPulse) {
- burstEmitter.burst(500);
- root.lastWasPulse = false;
- } else {
- pulseEmitter.pulse(500);
- root.lastWasPulse = true;
- }
- //! [0]
- }
- }
- ParticleSystem {
- id: particles
- anchors.fill: parent
- ImageParticle {
- source: "qrc:///particleresources/star.png"
- alpha: 0
- colorVariation: 0.6
- }
-
- Emitter {
- id: burstEmitter
- x: parent.width/2
- y: parent.height/3
- emitRate: 1000
- lifeSpan: 2000
- enabled: false
- velocity: AngleDirection{magnitude: 64; angleVariation: 360}
- size: 24
- sizeVariation: 8
- Text {
- anchors.centerIn: parent
- color: "white"
- font.pixelSize: 18
- text: "Burst"
- }
- }
- Emitter {
- id: pulseEmitter
- x: parent.width/2
- y: 2*parent.height/3
- emitRate: 1000
- lifeSpan: 2000
- enabled: false
- velocity: AngleDirection{magnitude: 64; angleVariation: 360}
- size: 24
- sizeVariation: 8
- Text {
- anchors.centerIn: parent
- color: "white"
- font.pixelSize: 18
- text: "Pulse"
- }
- }
- }
-}
diff --git a/examples/quick/particles/emitters/content/customemitter.qml b/examples/quick/particles/emitters/content/customemitter.qml
deleted file mode 100644
index f6aea13d08..0000000000
--- a/examples/quick/particles/emitters/content/customemitter.qml
+++ /dev/null
@@ -1,106 +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
-
-ParticleSystem {
- id: sys
- width: 360
- height: 600
- running: true
- Rectangle {
- z: -1
- anchors.fill: parent
- color: "black"
- }
-
- property real petalLength: 180
- property real petalRotation: 0
- NumberAnimation on petalRotation {
- from: 0;
- to: 360;
- loops: -1;
- running: true
- duration: 24000
- }
-
- function convert(a) {return a*(Math.PI/180);}
- Emitter {
- lifeSpan: 4000
- emitRate: 120
- size: 12
- anchors.centerIn: parent
- //! [0]
- onEmitParticles: (particles) => {
- for (var i=0; i<particles.length; i++) {
- var particle = particles[i];
- particle.startSize = Math.max(02,Math.min(492,Math.tan(particle.t/2)*24));
- var theta = Math.floor(Math.random() * 6.0);
- particle.red = theta == 0 || theta == 1 || theta == 2 ? 0.2 : 1;
- particle.green = theta == 2 || theta == 3 || theta == 4 ? 0.2 : 1;
- particle.blue = theta == 4 || theta == 5 || theta == 0 ? 0.2 : 1;
- theta /= 6.0;
- theta *= 2.0*Math.PI;
- theta += sys.convert(sys.petalRotation);//Convert from degrees to radians
- particle.initialVX = sys.petalLength * Math.cos(theta);
- particle.initialVY = sys.petalLength * Math.sin(theta);
- particle.initialAX = particle.initialVX * -0.5;
- particle.initialAY = particle.initialVY * -0.5;
- }
- }
- //! [0]
- }
-
- ImageParticle {
- source: "qrc:///particleresources/fuzzydot.png"
- alpha: 0.0
- }
-}
diff --git a/examples/quick/particles/emitters/content/emitmask.qml b/examples/quick/particles/emitters/content/emitmask.qml
deleted file mode 100644
index db13480e29..0000000000
--- a/examples/quick/particles/emitters/content/emitmask.qml
+++ /dev/null
@@ -1,84 +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 {
- color: "goldenrod"
- width: 400
- height: 400
- ParticleSystem {
- width: 300
- height: 300
- anchors.centerIn: parent
-
- ImageParticle {
- source: "qrc:///particleresources/glowdot.png"
- z: 2
- anchors.fill: parent
- color: "#336666CC"
- colorVariation: 0.0
- }
-
- Emitter {
- anchors.fill: parent
- emitRate: 6000
- lifeSpan: 720
- size: 10
- //! [0]
- shape: MaskShape {
- source: "../../images/starfish_mask.png"
- }
- //! [0]
- }
-
- }
-}
diff --git a/examples/quick/particles/emitters/content/maximumemitted.qml b/examples/quick/particles/emitters/content/maximumemitted.qml
deleted file mode 100644
index dd4dfdfbdd..0000000000
--- a/examples/quick/particles/emitters/content/maximumemitted.qml
+++ /dev/null
@@ -1,92 +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 {
- color: "black"
- width: 360
- height: 540
- ParticleSystem {
- id: sys
- anchors.fill: parent
- onEmptyChanged: if (empty) sys.pause();
-
- ImageParticle {
- system: sys
- id: cp
- source: "qrc:///particleresources/glowdot.png"
- colorVariation: 0.4
- color: "#000000FF"
- }
-
- Emitter {
- //burst on click
- id: bursty
- system: sys
- enabled: ma.pressed
- x: ma.mouseX
- y: ma.mouseY
- emitRate: 16000
- maximumEmitted: 4000
- acceleration: AngleDirection {angleVariation: 360; magnitude: 360; }
- size: 8
- endSize: 16
- sizeVariation: 4
- }
-
- MouseArea {
- anchors.fill: parent
- onPressed: sys.resume()
- id: ma
- }
- }
-}
diff --git a/examples/quick/particles/emitters/content/shapeanddirection.qml b/examples/quick/particles/emitters/content/shapeanddirection.qml
deleted file mode 100644
index 8d1659b099..0000000000
--- a/examples/quick/particles/emitters/content/shapeanddirection.qml
+++ /dev/null
@@ -1,122 +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: 540
- color: "black"
- Image {
- anchors.fill: parent
- source: "../../images/portal_bg.png"
- }
-
- ParticleSystem {
- id: particles
- anchors.fill: parent
-
- ImageParticle {
- groups: ["center","edge"]
- anchors.fill: parent
- source: "qrc:///particleresources/glowdot.png"
- colorVariation: 0.1
- color: "#009999FF"
- }
-
- Emitter {
- anchors.fill: parent
- group: "center"
- emitRate: 400
- lifeSpan: 2000
- size: 20
- sizeVariation: 2
- endSize: 0
- //! [0]
- shape: EllipseShape {fill: false}
- velocity: TargetDirection {
- targetX: root.width/2
- targetY: root.height/2
- proportionalMagnitude: true
- magnitude: 0.5
- }
- //! [0]
- }
-
- Emitter {
- anchors.fill: parent
- group: "edge"
- startTime: 2000
- emitRate: 2000
- lifeSpan: 2000
- size: 28
- sizeVariation: 2
- endSize: 16
- shape: EllipseShape {fill: false}
- velocity: TargetDirection {
- targetX: root.width/2
- targetY: root.height/2
- proportionalMagnitude: true
- magnitude: 0.1
- magnitudeVariation: 0.1
- }
- acceleration: TargetDirection {
- targetX: root.width/2
- targetY: root.height/2
- targetVariation: 200
- proportionalMagnitude: true
- magnitude: 0.1
- magnitudeVariation: 0.1
- }
- }
- }
-}
diff --git a/examples/quick/particles/emitters/customemitter.qml b/examples/quick/particles/emitters/customemitter.qml
new file mode 100644
index 0000000000..ed23d68720
--- /dev/null
+++ b/examples/quick/particles/emitters/customemitter.qml
@@ -0,0 +1,59 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+ParticleSystem {
+ id: sys
+ width: 360
+ height: 600
+ running: true
+ Rectangle {
+ z: -1
+ anchors.fill: parent
+ color: "black"
+ }
+
+ property real petalLength: 180
+ property real petalRotation
+ NumberAnimation on petalRotation {
+ from: 0;
+ to: 360;
+ loops: -1;
+ running: true
+ duration: 24000
+ }
+
+ function convert(a) {return a*(Math.PI/180);}
+ Emitter {
+ lifeSpan: 4000
+ emitRate: 120
+ size: 12
+ anchors.centerIn: parent
+ //! [0]
+ onEmitParticles: (particles) => {
+ for (var i=0; i<particles.length; i++) {
+ let particle = particles[i];
+ particle.startSize = Math.max(02,Math.min(492,Math.tan(particle.t/2)*24));
+ let theta = Math.floor(Math.random() * 6.0);
+ particle.red = theta == 0 || theta == 1 || theta == 2 ? 0.2 : 1;
+ particle.green = theta == 2 || theta == 3 || theta == 4 ? 0.2 : 1;
+ particle.blue = theta == 4 || theta == 5 || theta == 0 ? 0.2 : 1;
+ theta /= 6.0;
+ theta *= 2.0*Math.PI;
+ theta += sys.convert(sys.petalRotation);//Convert from degrees to radians
+ particle.initialVX = sys.petalLength * Math.cos(theta);
+ particle.initialVY = sys.petalLength * Math.sin(theta);
+ particle.initialAX = particle.initialVX * -0.5;
+ particle.initialAY = particle.initialVY * -0.5;
+ }
+ }
+ //! [0]
+ }
+
+ ImageParticle {
+ source: "qrc:///particleresources/fuzzydot.png"
+ alpha: 0.0
+ }
+}
diff --git a/examples/quick/particles/emitters/doc/src/emitters.qdoc b/examples/quick/particles/emitters/doc/src/emitters.qdoc
index 2ba7ceb0b9..51a1ac308a 100644
--- a/examples/quick/particles/emitters/doc/src/emitters.qdoc
+++ b/examples/quick/particles/emitters/doc/src/emitters.qdoc
@@ -1,32 +1,9 @@
-/****************************************************************************
-**
-** 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 - Emitters
\example particles/emitters
+ \examplecategory {Graphics}
\brief This is a collection of examples using Emitters in the QML particle system.
\image qml-emitters-example.png
@@ -34,27 +11,27 @@
Each example is a small QML file emphasizing a particular type or feature.
Velocity from motion gives the effect of strong particle motion through primarily moving the emitters:
- \snippet particles/emitters/content/velocityfrommotion.qml 0
+ \snippet particles/emitters/velocityfrommotion.qml 0
Burst and pulse calls the burst and pulse methods on two idential emitters.
- \snippet particles/emitters/content/burstandpulse.qml 0
+ \snippet particles/emitters/burstandpulse.qml 0
Note how burst takes an argument of number of particles to emit, and pulse takes an argument of number of milliseconds to emit for.
This gives a slightly different behaviour, which is easy to see in this example.
Custom Emitter connects to the emitParticles signal to set arbitrary values on particle data as they're emitted;
- \snippet particles/emitters/content/customemitter.qml 0
+ \snippet particles/emitters/customemitter.qml 0
This is used to emit curving particles in six rotating spokes.
Emit mask sets an image mask on the Emitter, to emit out of an arbitrary shape.
- \snippet particles/emitters/content/emitmask.qml 0
+ \snippet particles/emitters/emitmask.qml 0
Maximum emitted emits no more than a certain number of particles at a time. This example makes it easy to see what happens when the limit is reached.
Shape and Direction emits particles out of an unfilled Ellipse shape, using a TargetDirection
- \snippet particles/emitters/content/shapeanddirection.qml 0
+ \snippet particles/emitters/shapeanddirection.qml 0
This sends the particles towards the center of the ellipse with proportional speed, keeping the ellipse outline as they move to the center.
TrailEmitter uses that type to add smoke particles to trail the fire particles in the scene.
- \snippet particles/emitters/content/customemitter.qml 0
+ \snippet particles/emitters/customemitter.qml 0
*/
diff --git a/examples/quick/particles/emitters/emitmask.qml b/examples/quick/particles/emitters/emitmask.qml
new file mode 100644
index 0000000000..8a3e97f1d9
--- /dev/null
+++ b/examples/quick/particles/emitters/emitmask.qml
@@ -0,0 +1,37 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ color: "goldenrod"
+ width: 400
+ height: 400
+ ParticleSystem {
+ width: 300
+ height: 300
+ anchors.centerIn: parent
+
+ ImageParticle {
+ source: "qrc:///particleresources/glowdot.png"
+ z: 2
+ anchors.fill: parent
+ color: "#336666CC"
+ colorVariation: 0.0
+ }
+
+ Emitter {
+ anchors.fill: parent
+ emitRate: 6000
+ lifeSpan: 720
+ size: 10
+ //! [0]
+ shape: MaskShape {
+ source: "images/starfish_mask.png"
+ }
+ //! [0]
+ }
+
+ }
+}
diff --git a/examples/quick/particles/emitters/emitters.pro b/examples/quick/particles/emitters/emitters.pro
index c5d8b8b0c9..e493bc6a72 100644
--- a/examples/quick/particles/emitters/emitters.pro
+++ b/examples/quick/particles/emitters/emitters.pro
@@ -4,7 +4,6 @@ QT += quick qml
SOURCES += main.cpp
RESOURCES += \
emitters.qrc \
- ../images.qrc \
../../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/emitters
diff --git a/examples/quick/particles/emitters/emitters.qml b/examples/quick/particles/emitters/emitters.qml
index 83b9eacc7c..8c981f0662 100644
--- a/examples/quick/particles/emitters/emitters.qml
+++ b/examples/quick/particles/emitters/emitters.qml
@@ -1,70 +1,23 @@
-/****************************************************************************
-**
-** 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("Velocity from Motion", "Particle motion just by moving emitters", Qt.resolvedUrl("content/velocityfrommotion.qml"));
- addExample("Burst and Pulse", "Emit imperatively", Qt.resolvedUrl("content/burstandpulse.qml"));
- addExample("Custom Emitter", "Custom starting state", Qt.resolvedUrl("content/customemitter.qml"));
- addExample("Emit Mask", "Emit arbitrary shapes", Qt.resolvedUrl("content/emitmask.qml"));
- addExample("Maximum Emitted", "Put a limit on emissions", Qt.resolvedUrl("content/maximumemitted.qml"));
- addExample("Shape and Direction", "Creates a portal effect", Qt.resolvedUrl("content/shapeanddirection.qml"));
- addExample("TrailEmitter", "Emit from other particles", Qt.resolvedUrl("content/trailemitter.qml"));
+ addExample("Velocity from Motion", "Particle motion just by moving emitters", Qt.resolvedUrl("velocityfrommotion.qml"));
+ addExample("Burst and Pulse", "Emit imperatively", Qt.resolvedUrl("burstandpulse.qml"));
+ addExample("Custom Emitter", "Custom starting state", Qt.resolvedUrl("customemitter.qml"));
+ addExample("Emit Mask", "Emit arbitrary shapes", Qt.resolvedUrl("emitmask.qml"));
+ addExample("Maximum Emitted", "Put a limit on emissions", Qt.resolvedUrl("maximumemitted.qml"));
+ addExample("Shape and Direction", "Creates a portal effect", Qt.resolvedUrl("shapeanddirection.qml"));
+ addExample("TrailEmitter", "Emit from other particles", Qt.resolvedUrl("trailemitter.qml"));
}
}
}
diff --git a/examples/quick/particles/emitters/emitters.qrc b/examples/quick/particles/emitters/emitters.qrc
index 708c8683f0..5f3217d8a5 100644
--- a/examples/quick/particles/emitters/emitters.qrc
+++ b/examples/quick/particles/emitters/emitters.qrc
@@ -1,12 +1,14 @@
<RCC>
- <qresource prefix="/particles/emitters">
+ <qresource prefix="/qt/qml/emitters">
<file>emitters.qml</file>
- <file>content/burstandpulse.qml</file>
- <file>content/customemitter.qml</file>
- <file>content/emitmask.qml</file>
- <file>content/maximumemitted.qml</file>
- <file>content/shapeanddirection.qml</file>
- <file>content/trailemitter.qml</file>
- <file>content/velocityfrommotion.qml</file>
+ <file>burstandpulse.qml</file>
+ <file>customemitter.qml</file>
+ <file>emitmask.qml</file>
+ <file>maximumemitted.qml</file>
+ <file>shapeanddirection.qml</file>
+ <file>trailemitter.qml</file>
+ <file>velocityfrommotion.qml</file>
+ <file>images/starfish_mask.png</file>
+ <file>images/portal_bg.png</file>
</qresource>
</RCC>
diff --git a/examples/quick/particles/images/portal_bg.png b/examples/quick/particles/emitters/images/portal_bg.png
index 3c59eeabb9..3c59eeabb9 100644
--- a/examples/quick/particles/images/portal_bg.png
+++ b/examples/quick/particles/emitters/images/portal_bg.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_mask.png b/examples/quick/particles/emitters/images/starfish_mask.png
index 7ae39b34c5..7ae39b34c5 100644
--- a/examples/quick/particles/images/starfish_mask.png
+++ b/examples/quick/particles/emitters/images/starfish_mask.png
Binary files differ
diff --git a/examples/quick/particles/emitters/main.cpp b/examples/quick/particles/emitters/main.cpp
index e2b3cf2026..eccb3c8459 100644
--- a/examples/quick/particles/emitters/main.cpp
+++ b/examples/quick/particles/emitters/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/emitters/emitters)
+DECLARATIVE_EXAMPLE_MAIN(emitters/emitters)
diff --git a/examples/quick/particles/emitters/maximumemitted.qml b/examples/quick/particles/emitters/maximumemitted.qml
new file mode 100644
index 0000000000..c5d33a9541
--- /dev/null
+++ b/examples/quick/particles/emitters/maximumemitted.qml
@@ -0,0 +1,45 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ color: "black"
+ width: 360
+ height: 540
+ ParticleSystem {
+ id: sys
+ anchors.fill: parent
+ onEmptyChanged: if (empty) sys.pause();
+
+ ImageParticle {
+ system: sys
+ id: cp
+ source: "qrc:///particleresources/glowdot.png"
+ colorVariation: 0.4
+ color: "#000000FF"
+ }
+
+ Emitter {
+ //burst on click
+ id: bursty
+ system: sys
+ enabled: ma.pressed
+ x: ma.mouseX
+ y: ma.mouseY
+ emitRate: 16000
+ maximumEmitted: 4000
+ acceleration: AngleDirection {angleVariation: 360; magnitude: 360; }
+ size: 8
+ endSize: 16
+ sizeVariation: 4
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: sys.resume()
+ id: ma
+ }
+ }
+}
diff --git a/examples/quick/particles/emitters/shapeanddirection.qml b/examples/quick/particles/emitters/shapeanddirection.qml
new file mode 100644
index 0000000000..190eb9cb60
--- /dev/null
+++ b/examples/quick/particles/emitters/shapeanddirection.qml
@@ -0,0 +1,75 @@
+// Copyright (C) 2017 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: 540
+ color: "black"
+ Image {
+ anchors.fill: parent
+ source: "images/portal_bg.png"
+ }
+
+ ParticleSystem {
+ id: particles
+ anchors.fill: parent
+
+ ImageParticle {
+ groups: ["center","edge"]
+ anchors.fill: parent
+ source: "qrc:///particleresources/glowdot.png"
+ colorVariation: 0.1
+ color: "#009999FF"
+ }
+
+ Emitter {
+ anchors.fill: parent
+ group: "center"
+ emitRate: 400
+ lifeSpan: 2000
+ size: 20
+ sizeVariation: 2
+ endSize: 0
+ //! [0]
+ shape: EllipseShape {fill: false}
+ velocity: TargetDirection {
+ targetX: root.width/2
+ targetY: root.height/2
+ proportionalMagnitude: true
+ magnitude: 0.5
+ }
+ //! [0]
+ }
+
+ Emitter {
+ anchors.fill: parent
+ group: "edge"
+ startTime: 2000
+ emitRate: 2000
+ lifeSpan: 2000
+ size: 28
+ sizeVariation: 2
+ endSize: 16
+ shape: EllipseShape {fill: false}
+ velocity: TargetDirection {
+ targetX: root.width/2
+ targetY: root.height/2
+ proportionalMagnitude: true
+ magnitude: 0.1
+ magnitudeVariation: 0.1
+ }
+ acceleration: TargetDirection {
+ targetX: root.width/2
+ targetY: root.height/2
+ targetVariation: 200
+ proportionalMagnitude: true
+ magnitude: 0.1
+ magnitudeVariation: 0.1
+ }
+ }
+ }
+}
diff --git a/examples/quick/particles/emitters/content/trailemitter.qml b/examples/quick/particles/emitters/trailemitter.qml
index fdb6180eb6..eb8f03ab3c 100644
--- a/examples/quick/particles/emitters/content/trailemitter.qml
+++ b/examples/quick/particles/emitters/trailemitter.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
Rectangle {
id: root
diff --git a/examples/quick/particles/emitters/content/velocityfrommotion.qml b/examples/quick/particles/emitters/velocityfrommotion.qml
index eee533a2fe..aa65ac7d9e 100644
--- a/examples/quick/particles/emitters/content/velocityfrommotion.qml
+++ b/examples/quick/particles/emitters/velocityfrommotion.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
Rectangle {
@@ -72,7 +25,6 @@ Rectangle {
ImageParticle {
system: sys1
source: "qrc:///particleresources/glowdot.png"
- color: "cyan"
alpha: 0
SequentialAnimation on color {
loops: Animation.Infinite
@@ -120,7 +72,6 @@ Rectangle {
//! [0]
ParticleSystem { id: sys2 }
ImageParticle {
- color: "cyan"
system: sys2
alpha: 0
SequentialAnimation on color {
@@ -161,7 +112,6 @@ Rectangle {
ImageParticle {
source: "qrc:///particleresources/glowdot.png"
system: sys3
- color: "orange"
alpha: 0
SequentialAnimation on color {
loops: Animation.Infinite
@@ -202,7 +152,6 @@ Rectangle {
ImageParticle {
system: sys4
source: "qrc:///particleresources/star.png"
- color: "green"
alpha: 0
SequentialAnimation on color {
loops: Animation.Infinite
@@ -246,12 +195,12 @@ Rectangle {
Item {
id: circle
//anchors.fill: parent
- property real radius: 0
+ property real radius
property real dx: root.width / 2
property real dy: root.height / 2
property real cx: radius * Math.sin(percent*6.283185307179) + dx
property real cy: radius * Math.cos(percent*6.283185307179) + dy
- property real percent: 0
+ property real percent
SequentialAnimation on percent {
loops: Animation.Infinite
@@ -294,7 +243,7 @@ Rectangle {
property real dy: root.height / 2
property real cx: radius * Math.sin(percent*6.283185307179) + dx
property real cy: radius * Math.cos(percent*6.283185307179) + dy
- property real percent: 0
+ property real percent
SequentialAnimation on percent {
loops: Animation.Infinite
@@ -310,7 +259,7 @@ Rectangle {
property real dy: circle3.cy
property real cx: radius * Math.sin(percent*6.283185307179) + dx
property real cy: radius * Math.cos(percent*6.283185307179) + dy
- property real percent: 0
+ property real percent
SequentialAnimation on percent {
loops: Animation.Infinite
diff --git a/examples/quick/particles/imageparticle/CMakeLists.txt b/examples/quick/particles/imageparticle/CMakeLists.txt
index 29bddbb0db..c587d9bcc3 100644
--- a/examples/quick/particles/imageparticle/CMakeLists.txt
+++ b/examples/quick/particles/imageparticle/CMakeLists.txt
@@ -1,267 +1,62 @@
-# Generated from imageparticle.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(imageparticle 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/imageparticle")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
-
-qt_add_executable(imageparticle
+qt_add_executable(imageparticleexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(imageparticle PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(imageparticle PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
-)
-
-# Resources:
-set(imageparticle_resource_files
- "content/allatonce.qml"
- "content/colored.qml"
- "content/colortable.qml"
- "content/deformation.qml"
- "content/rotation.qml"
- "content/sharing.qml"
- "content/sprites.qml"
- "imageparticle.qml"
+target_link_libraries(imageparticleexample PRIVATE
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Qml
+ Qt6::Quick
)
-qt6_add_resources(imageparticle "imageparticle"
- PREFIX
- "/particles/imageparticle"
- FILES
- ${imageparticle_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"
-)
-
-qt6_add_resources(imageparticle "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"
-)
+add_dependencies(imageparticleexample imageparticle_shared)
-qt6_add_resources(imageparticle "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS imageparticle
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
+# Resources:
+qt_add_qml_module(imageparticleexample
+ URI imageparticle
+ QML_FILES
+ "allatonce.qml"
+ "colored.qml"
+ "colortable.qml"
+ "deformation.qml"
+ "imageparticle.qml"
+ "rotation.qml"
+ "sharing.qml"
+ "sprites.qml"
+ RESOURCES
+ "images/bear_tiles.png"
+ "images/colortable.png"
+ "images/starfish_0.png"
+ "images/starfish_1.png"
+ "images/starfish_2.png"
+ "images/starfish_3.png"
+ "images/starfish_4.png"
+ "images/flower.png"
+)
+
+install(TARGETS imageparticleexample
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET imageparticleexample
+ 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/imageparticle/allatonce.qml b/examples/quick/particles/imageparticle/allatonce.qml
new file mode 100644
index 0000000000..62a8d6c448
--- /dev/null
+++ b/examples/quick/particles/imageparticle/allatonce.qml
@@ -0,0 +1,63 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ color: "white"
+ width: 640
+ height: 480
+ ParticleSystem {
+ id: sys
+ }
+
+ ImageParticle {
+ // ![0]
+ sprites: [
+ Sprite {
+ name: "bear"
+ source: "images/bear_tiles.png"
+ frameCount: 13
+ frameDuration: 120
+ }
+ ]
+ colorVariation: 0.5
+ rotationVelocityVariation: 360
+ colorTable: "images/colortable.png"
+ // ![0]
+ system: sys
+ }
+
+ Friction {
+ factor: 0.1
+ system: sys
+ }
+
+ Emitter {
+ system: sys
+ anchors.centerIn: parent
+ id: particles
+ emitRate: 200
+ lifeSpan: 6000
+ velocity: AngleDirection {angleVariation: 360; magnitude: 80; magnitudeVariation: 40}
+ size: 60
+ endSize: 120
+ }
+
+ Text {
+ x: 16
+ y: 16
+ text: "QML..."
+ style: Text.Outline; styleColor: "#AAAAAA"
+ font.pixelSize: 32
+ }
+ Text {
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.margins: 16
+ text: "... can you be trusted with the power?"
+ style: Text.Outline; styleColor: "#AAAAAA"
+ font.pixelSize: width > 400 ? 32 : 16
+ }
+}
diff --git a/examples/quick/particles/imageparticle/colored.qml b/examples/quick/particles/imageparticle/colored.qml
new file mode 100644
index 0000000000..8d4be46873
--- /dev/null
+++ b/examples/quick/particles/imageparticle/colored.qml
@@ -0,0 +1,51 @@
+// Copyright (C) 2021 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: ["stars"]
+ anchors.fill: parent
+ source: "qrc:///particleresources/star.png"
+ }
+ Emitter {
+ group: "stars"
+ emitRate: 800
+ lifeSpan: 2400
+ size: 24
+ sizeVariation: 8
+ anchors.fill: parent
+ }
+
+ // ![0]
+ ImageParticle {
+ anchors.fill: parent
+ source: "qrc:///particleresources/star.png"
+ alpha: 0
+ alphaVariation: 0.2
+ colorVariation: 1.0
+ }
+ // ![0]
+
+ Emitter {
+ anchors.centerIn: parent
+ emitRate: 400
+ lifeSpan: 2400
+ size: 48
+ sizeVariation: 8
+ velocity: AngleDirection {angleVariation: 180; magnitude: 60}
+ }
+
+ Turbulence {
+ anchors.fill: parent
+ strength: 2
+ }
+ }
+}
diff --git a/examples/quick/particles/imageparticle/colortable.qml b/examples/quick/particles/imageparticle/colortable.qml
new file mode 100644
index 0000000000..f571f98b56
--- /dev/null
+++ b/examples/quick/particles/imageparticle/colortable.qml
@@ -0,0 +1,49 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick.Particles
+import QtQuick
+
+Rectangle {
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+
+ ParticleSystem { id: particles }
+
+ ImageParticle {
+ system: particles
+ colorVariation: 0.5
+ alpha: 0
+
+ //! [0]
+ source: "qrc:///particleresources/glowdot.png"
+ colorTable: "images/colortable.png"
+ sizeTable: "images/colortable.png"
+ //! [0]
+ }
+
+ Emitter {
+ system: particles
+ emitRate: 500
+ lifeSpan: 2000
+
+ y: root.height / 2 + Math.sin(t * 2) * root.height * 0.3
+ x: root.width / 2 + Math.cos(t) * root.width * 0.3
+ property real t;
+
+ NumberAnimation on t {
+ from: 0; to: Math.PI * 2; duration: 10000; loops: Animation.Infinite
+ }
+
+ velocityFromMovement: 20
+
+ velocity: PointDirection { xVariation: 5; yVariation: 5;}
+ acceleration: PointDirection { xVariation: 5; yVariation: 5;}
+
+ size: 16
+ //endSize: 8
+ //sizeVariation: 8
+ }
+}
diff --git a/examples/quick/particles/imageparticle/content/allatonce.qml b/examples/quick/particles/imageparticle/content/allatonce.qml
deleted file mode 100644
index 4b6c9b35cc..0000000000
--- a/examples/quick/particles/imageparticle/content/allatonce.qml
+++ /dev/null
@@ -1,110 +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 {
- color: "white"
- width: 640
- height: 480
- ParticleSystem {
- id: sys
- }
-
- ImageParticle {
- // ![0]
- sprites: [
- Sprite {
- name: "bear"
- source: "../../images/bear_tiles.png"
- frameCount: 13
- frameDuration: 120
- }
- ]
- colorVariation: 0.5
- rotationVelocityVariation: 360
- colorTable: "../../images/colortable.png"
- // ![0]
- system: sys
- }
-
- Friction {
- factor: 0.1
- system: sys
- }
-
- Emitter {
- system: sys
- anchors.centerIn: parent
- id: particles
- emitRate: 200
- lifeSpan: 6000
- velocity: AngleDirection {angleVariation: 360; magnitude: 80; magnitudeVariation: 40}
- size: 60
- endSize: 120
- }
-
- Text {
- x: 16
- y: 16
- text: "QML..."
- style: Text.Outline; styleColor: "#AAAAAA"
- font.pixelSize: 32
- }
- Text {
- anchors.bottom: parent.bottom
- anchors.right: parent.right
- anchors.margins: 16
- text: "... can you be trusted with the power?"
- style: Text.Outline; styleColor: "#AAAAAA"
- font.pixelSize: width > 400 ? 32 : 16
- }
-}
diff --git a/examples/quick/particles/imageparticle/content/colored.qml b/examples/quick/particles/imageparticle/content/colored.qml
deleted file mode 100644
index 3452cad805..0000000000
--- a/examples/quick/particles/imageparticle/content/colored.qml
+++ /dev/null
@@ -1,98 +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: ["stars"]
- anchors.fill: parent
- source: "qrc:///particleresources/star.png"
- }
- Emitter {
- group: "stars"
- emitRate: 800
- lifeSpan: 2400
- size: 24
- sizeVariation: 8
- anchors.fill: parent
- }
-
- // ![0]
- ImageParticle {
- anchors.fill: parent
- source: "qrc:///particleresources/star.png"
- alpha: 0
- alphaVariation: 0.2
- colorVariation: 1.0
- }
- // ![0]
-
- Emitter {
- anchors.centerIn: parent
- emitRate: 400
- lifeSpan: 2400
- size: 48
- sizeVariation: 8
- velocity: AngleDirection {angleVariation: 180; magnitude: 60}
- }
-
- Turbulence {
- anchors.fill: parent
- strength: 2
- }
- }
-}
diff --git a/examples/quick/particles/imageparticle/content/colortable.qml b/examples/quick/particles/imageparticle/content/colortable.qml
deleted file mode 100644
index 5f88c1a8b3..0000000000
--- a/examples/quick/particles/imageparticle/content/colortable.qml
+++ /dev/null
@@ -1,96 +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.Particles 2.0
-import QtQuick 2.0
-
-Rectangle {
- id: root
- width: 360
- height: 540
- color: "black"
-
- ParticleSystem { id: particles }
-
- ImageParticle {
- system: particles
- colorVariation: 0.5
- alpha: 0
-
- //! [0]
- source: "qrc:///particleresources/glowdot.png"
- colorTable: "../../images/colortable.png"
- sizeTable: "../../images/colortable.png"
- //! [0]
- }
-
- Emitter {
- system: particles
- emitRate: 500
- lifeSpan: 2000
-
- y: root.height / 2 + Math.sin(t * 2) * root.height * 0.3
- x: root.width / 2 + Math.cos(t) * root.width * 0.3
- property real t;
-
- NumberAnimation on t {
- from: 0; to: Math.PI * 2; duration: 10000; loops: Animation.Infinite
- }
-
- velocityFromMovement: 20
-
- velocity: PointDirection { xVariation: 5; yVariation: 5;}
- acceleration: PointDirection { xVariation: 5; yVariation: 5;}
-
- size: 16
- //endSize: 8
- //sizeVariation: 8
- }
-}
diff --git a/examples/quick/particles/imageparticle/content/deformation.qml b/examples/quick/particles/imageparticle/content/deformation.qml
deleted file mode 100644
index ce672c8fa3..0000000000
--- a/examples/quick/particles/imageparticle/content/deformation.qml
+++ /dev/null
@@ -1,135 +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 {
- color: "goldenrod"
- width: 400
- height: 400
- ParticleSystem {id:sys}
-
- //! [spin]
- ImageParticle {
- system: sys
- groups: ["goingLeft", "goingRight"]
- source: "../../images/starfish_4.png"
- rotation: 90
- rotationVelocity: 90
- autoRotation: true
- }
- //! [spin]
- //! [deform]
- ImageParticle {
- system: sys
- groups: ["goingDown"]
- source: "../../images/starfish_0.png"
- rotation: 180
- yVector: PointDirection { y: 0.5; yVariation: 0.25; xVariation: 0.25; }
- }
- //! [deform]
-
- Timer {
- running: true
- repeat: false
- interval: 100
- onTriggered: emitA.enabled = true;
- }
- Timer {
- running: true
- repeat: false
- interval: 4200
- onTriggered: emitB.enabled = true;
- }
- Timer {
- running: true
- repeat: false
- interval: 8400
- onTriggered: emitC.enabled = true;
- }
-
- Emitter {
- id: emitA
- x: 0
- y: 120
- system: sys
- enabled: false
- group: "goingRight"
- velocity: PointDirection { x: 100 }
- lifeSpan: 4000
- emitRate: 1
- size: 128
- }
- Emitter {
- id: emitB
- x: 400
- y: 240
- system: sys
- enabled: false
- group: "goingLeft"
- velocity: PointDirection { x: -100 }
- lifeSpan: 4000
- emitRate: 1
- size: 128
- }
- Emitter {
- id: emitC
- x: 0
- y: 360
- system: sys
- enabled: false
- group: "goingDown"
- velocity: PointDirection { x: 100 }
- lifeSpan: 4000
- emitRate: 1
- size: 128
- }
-}
diff --git a/examples/quick/particles/imageparticle/content/rotation.qml b/examples/quick/particles/imageparticle/content/rotation.qml
deleted file mode 100644
index d118bb1d97..0000000000
--- a/examples/quick/particles/imageparticle/content/rotation.qml
+++ /dev/null
@@ -1,83 +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 {
- color: "goldenrod"
- width: 2000
- height: 2000
- ParticleSystem {id: sys}
- ImageParticle {
- id: up
- system: sys
- source: "../../images/starfish_2.png"
- autoRotation: true //leaving these two settings at default allows you to test going up performance levels
- rotation: -90
- }
-
- Emitter {
- anchors.centerIn: parent
- system: sys
- emitRate: 10
- size: 200
- lifeSpan: 10000
- velocity: AngleDirection {angleVariation: 360; magnitudeVariation: 100;}
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- up.autoRotation = !up.autoRotation
- up.rotation = up.autoRotation ? -90 : 0
- }
- }
-}
diff --git a/examples/quick/particles/imageparticle/content/sprites.qml b/examples/quick/particles/imageparticle/content/sprites.qml
deleted file mode 100644
index c8ffe6c0e5..0000000000
--- a/examples/quick/particles/imageparticle/content/sprites.qml
+++ /dev/null
@@ -1,126 +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 {
- color: "lightsteelblue"
- width: 800
- height: 800
- id: root
-
- SpriteSequence {
- sprites: Sprite {
- name: "bear"
- source: "../../images/bear_tiles.png"
- frameCount: 13
- frameDuration: 120
- }
- width: 250
- height: 250
- x: 20
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 20
- z:4
- }
-
- ParticleSystem { id: sys }
-
- ImageParticle {
- anchors.fill: parent
- id: particles
- system: sys
- sprites: [Sprite {
- name: "happy"
- source: "../../images/starfish_1.png"
- frameCount: 1
- frameDuration: 260
- to: {"happy": 1, "silly": 1, "angry": 1}
- }, Sprite {
- name: "angry"
- source: "../../images/starfish_0.png"
- frameCount: 1
- frameDuration: 260
- to: {"happy": 1, "silly": 1, "angry": 1}
- }, Sprite {
- name: "silly"
- source: "../../images/starfish_2.png"
- frameCount: 1
- frameDuration: 260
- to: {"happy": 1, "silly": 1, "noticedbear": 0}
- }, Sprite {
- name: "noticedbear"
- source: "../../images/starfish_3.png"
- frameCount: 1
- frameDuration: 2600
- }]
- }
-
- Emitter {
- system: sys
- emitRate: 2
- lifeSpan: 10000
- velocity: AngleDirection {angle: 90; magnitude: 60; angleVariation: 5}
- acceleration: PointDirection { y: 10 }
- size: 160
- sizeVariation: 40
- width: parent.width
- height: 100
- }
-
- SpriteGoal {
- system: sys
- width: root.width;
- height: root.height/2;
- y: root.height/2;
- goalState:"noticedbear"
- }
-}
diff --git a/examples/quick/particles/imageparticle/deformation.qml b/examples/quick/particles/imageparticle/deformation.qml
new file mode 100644
index 0000000000..f853798b05
--- /dev/null
+++ b/examples/quick/particles/imageparticle/deformation.qml
@@ -0,0 +1,88 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ color: "goldenrod"
+ width: 400
+ height: 400
+ ParticleSystem {id:sys}
+
+ //! [spin]
+ ImageParticle {
+ system: sys
+ groups: ["goingLeft", "goingRight"]
+ source: "images/starfish_4.png"
+ rotation: 90
+ rotationVelocity: 90
+ autoRotation: true
+ }
+ //! [spin]
+ //! [deform]
+ ImageParticle {
+ system: sys
+ groups: ["goingDown"]
+ source: "images/starfish_0.png"
+ rotation: 180
+ yVector: PointDirection { y: 0.5; yVariation: 0.25; xVariation: 0.25; }
+ }
+ //! [deform]
+
+ Timer {
+ running: true
+ repeat: false
+ interval: 100
+ onTriggered: emitA.enabled = true;
+ }
+ Timer {
+ running: true
+ repeat: false
+ interval: 4200
+ onTriggered: emitB.enabled = true;
+ }
+ Timer {
+ running: true
+ repeat: false
+ interval: 8400
+ onTriggered: emitC.enabled = true;
+ }
+
+ Emitter {
+ id: emitA
+ x: 0
+ y: 120
+ system: sys
+ enabled: false
+ group: "goingRight"
+ velocity: PointDirection { x: 100 }
+ lifeSpan: 4000
+ emitRate: 1
+ size: 128
+ }
+ Emitter {
+ id: emitB
+ x: 400
+ y: 240
+ system: sys
+ enabled: false
+ group: "goingLeft"
+ velocity: PointDirection { x: -100 }
+ lifeSpan: 4000
+ emitRate: 1
+ size: 128
+ }
+ Emitter {
+ id: emitC
+ x: 0
+ y: 360
+ system: sys
+ enabled: false
+ group: "goingDown"
+ velocity: PointDirection { x: 100 }
+ lifeSpan: 4000
+ emitRate: 1
+ size: 128
+ }
+}
diff --git a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc
index 6a71e1f5fd..4bbbc6a430 100644
--- a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc
+++ b/examples/quick/particles/imageparticle/doc/src/imageparticle.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 - Image Particles
\example particles/imageparticle
+ \examplecategory {Graphics}
\brief This is a collection of examples using Affectors in the QML particle system.
\image qml-imageparticle-example.png
@@ -35,25 +12,25 @@
Each example is a small QML file emphasizing a particular type or feature.
All at once shows off several of the features of ImageParticle at the same time.
- \snippet particles/imageparticle/content/allatonce.qml 0
+ \snippet particles/imageparticle/allatonce.qml 0
Colored shows a simple ImageParticle with some color variation.
- \snippet particles/imageparticle/content/colored.qml 0
+ \snippet particles/imageparticle/colored.qml 0
Color Table sets the color over life on the particles to provide a fixed rainbow effect.
- \snippet particles/imageparticle/content/colortable.qml 0
+ \snippet particles/imageparticle/colortable.qml 0
Deformation spins and squishes a starfish particle.
- \snippet particles/imageparticle/content/deformation.qml spin
- \snippet particles/imageparticle/content/deformation.qml deform
+ \snippet particles/imageparticle/deformation.qml spin
+ \snippet particles/imageparticle/deformation.qml deform
Rotation demonstrates the autoRotate property, so that particles rotate in the direction that they travel.
Sharing demonstrates what happens when multiple ImageParticles try to render the same particle.
The following ImageParticle renders the particles inside the ListView:
- \snippet particles/imageparticle/content/sharing.qml 0
+ \snippet particles/imageparticle/sharing.qml 0
The following ImageParticle is placed inside the list highlight, and renders the particles above the other ImageParticle.
- \snippet particles/imageparticle/content/sharing.qml 1
+ \snippet particles/imageparticle/sharing.qml 1
Note that because it sets the color and alpha in this ImageParticle, it renders the particles in a different color.
Since it doesn't specify anything about the rotation, it shares the rotation with the other ImageParticle so that the flowers are rotated the same way in both.
Note that you can undo rotation in another ImageParticle, you just need to explicitly set rotationVariation to 0.
diff --git a/examples/quick/particles/imageparticle/imageparticle.pro b/examples/quick/particles/imageparticle/imageparticle.pro
index e639c7423a..c9c5e59eb0 100644
--- a/examples/quick/particles/imageparticle/imageparticle.pro
+++ b/examples/quick/particles/imageparticle/imageparticle.pro
@@ -4,7 +4,6 @@ QT += quick qml
SOURCES += main.cpp
RESOURCES += \
imageparticle.qrc \
- ../images.qrc \
../../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/imageparticle
diff --git a/examples/quick/particles/imageparticle/imageparticle.qml b/examples/quick/particles/imageparticle/imageparticle.qml
index a8dfa6a0c9..2fb97cd568 100644
--- a/examples/quick/particles/imageparticle/imageparticle.qml
+++ b/examples/quick/particles/imageparticle/imageparticle.qml
@@ -1,70 +1,23 @@
-/****************************************************************************
-**
-** 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
-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("All at once", "Uses all ImageParticle features", Qt.resolvedUrl("content/allatonce.qml"));
- addExample("Colored", "Colorized image particles", Qt.resolvedUrl("content/colored.qml"));
- addExample("Color Table", "Color-over-life rainbow particles", Qt.resolvedUrl("content/colortable.qml"));
- addExample("Deformation", "Deformed particles", Qt.resolvedUrl("content/deformation.qml"));
- addExample("Rotation", "Rotated particles", Qt.resolvedUrl("content/rotation.qml"));
- addExample("Sharing", "Multiple ImageParticles on the same particles", Qt.resolvedUrl("content/sharing.qml"));
- addExample("Sprites", "Particles rendered with sprites", Qt.resolvedUrl("content/sprites.qml"));
+ addExample("All at once", "Uses all ImageParticle features", Qt.resolvedUrl("allatonce.qml"));
+ addExample("Colored", "Colorized image particles", Qt.resolvedUrl("colored.qml"));
+ addExample("Color Table", "Color-over-life rainbow particles", Qt.resolvedUrl("colortable.qml"));
+ addExample("Deformation", "Deformed particles", Qt.resolvedUrl("deformation.qml"));
+ addExample("Rotation", "Rotated particles", Qt.resolvedUrl("rotation.qml"));
+ addExample("Sharing", "Multiple ImageParticles on the same particles", Qt.resolvedUrl("sharing.qml"));
+ addExample("Sprites", "Particles rendered with sprites", Qt.resolvedUrl("sprites.qml"));
}
}
}
diff --git a/examples/quick/particles/imageparticle/imageparticle.qrc b/examples/quick/particles/imageparticle/imageparticle.qrc
index d9e4115e3e..f77a5ac411 100644
--- a/examples/quick/particles/imageparticle/imageparticle.qrc
+++ b/examples/quick/particles/imageparticle/imageparticle.qrc
@@ -1,12 +1,20 @@
<RCC>
- <qresource prefix="/particles/imageparticle">
+ <qresource prefix="/qt/qml/imageparticle">
<file>imageparticle.qml</file>
- <file>content/allatonce.qml</file>
- <file>content/colored.qml</file>
- <file>content/colortable.qml</file>
- <file>content/deformation.qml</file>
- <file>content/rotation.qml</file>
- <file>content/sharing.qml</file>
- <file>content/sprites.qml</file>
+ <file>allatonce.qml</file>
+ <file>colored.qml</file>
+ <file>colortable.qml</file>
+ <file>deformation.qml</file>
+ <file>rotation.qml</file>
+ <file>sharing.qml</file>
+ <file>sprites.qml</file>
+ <file>images/bear_tiles.png</file>
+ <file>images/colortable.png</file>
+ <file>images/starfish_0.png</file>
+ <file>images/starfish_1.png</file>
+ <file>images/starfish_2.png</file>
+ <file>images/starfish_3.png</file>
+ <file>images/starfish_4.png</file>
+ <file>images/flower.png</file>
</qresource>
</RCC>
diff --git a/examples/quick/particles/images/bear_tiles.png b/examples/quick/particles/imageparticle/images/bear_tiles.png
index 6bbb2a9b6d..6bbb2a9b6d 100644
--- a/examples/quick/particles/images/bear_tiles.png
+++ b/examples/quick/particles/imageparticle/images/bear_tiles.png
Binary files differ
diff --git a/examples/quick/particles/images/colortable.png b/examples/quick/particles/imageparticle/images/colortable.png
index 15509ab5b7..15509ab5b7 100644
--- a/examples/quick/particles/images/colortable.png
+++ b/examples/quick/particles/imageparticle/images/colortable.png
Binary files differ
diff --git a/examples/quick/particles/images/flower.png b/examples/quick/particles/imageparticle/images/flower.png
index b5c606210e..b5c606210e 100644
--- a/examples/quick/particles/images/flower.png
+++ b/examples/quick/particles/imageparticle/images/flower.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_0.png b/examples/quick/particles/imageparticle/images/starfish_0.png
index 8747f0236e..8747f0236e 100644
--- a/examples/quick/particles/images/starfish_0.png
+++ b/examples/quick/particles/imageparticle/images/starfish_0.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_1.png b/examples/quick/particles/imageparticle/images/starfish_1.png
index 1f3f159d5e..1f3f159d5e 100644
--- a/examples/quick/particles/images/starfish_1.png
+++ b/examples/quick/particles/imageparticle/images/starfish_1.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_2.png b/examples/quick/particles/imageparticle/images/starfish_2.png
index c6c7e5a676..c6c7e5a676 100644
--- a/examples/quick/particles/images/starfish_2.png
+++ b/examples/quick/particles/imageparticle/images/starfish_2.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_3.png b/examples/quick/particles/imageparticle/images/starfish_3.png
index 307a89f815..307a89f815 100644
--- a/examples/quick/particles/images/starfish_3.png
+++ b/examples/quick/particles/imageparticle/images/starfish_3.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_4.png b/examples/quick/particles/imageparticle/images/starfish_4.png
index d61c26545a..d61c26545a 100644
--- a/examples/quick/particles/images/starfish_4.png
+++ b/examples/quick/particles/imageparticle/images/starfish_4.png
Binary files differ
diff --git a/examples/quick/particles/imageparticle/main.cpp b/examples/quick/particles/imageparticle/main.cpp
index ff0764a730..43bd43a1b6 100644
--- a/examples/quick/particles/imageparticle/main.cpp
+++ b/examples/quick/particles/imageparticle/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/imageparticle/imageparticle)
+DECLARATIVE_EXAMPLE_MAIN(imageparticle/imageparticle)
diff --git a/examples/quick/particles/imageparticle/rotation.qml b/examples/quick/particles/imageparticle/rotation.qml
new file mode 100644
index 0000000000..df1a40d786
--- /dev/null
+++ b/examples/quick/particles/imageparticle/rotation.qml
@@ -0,0 +1,36 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ color: "goldenrod"
+ width: 2000
+ height: 2000
+ ParticleSystem {id: sys}
+ ImageParticle {
+ id: up
+ system: sys
+ source: "images/starfish_2.png"
+ autoRotation: true //leaving these two settings at default allows you to test going up performance levels
+ rotation: -90
+ }
+
+ Emitter {
+ anchors.centerIn: parent
+ system: sys
+ emitRate: 10
+ size: 200
+ lifeSpan: 10000
+ velocity: AngleDirection {angleVariation: 360; magnitudeVariation: 100;}
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ up.autoRotation = !up.autoRotation
+ up.rotation = up.autoRotation ? -90 : 0
+ }
+ }
+}
diff --git a/examples/quick/particles/imageparticle/content/sharing.qml b/examples/quick/particles/imageparticle/sharing.qml
index 13b0dadf85..3519072b70 100644
--- a/examples/quick/particles/imageparticle/content/sharing.qml
+++ b/examples/quick/particles/imageparticle/sharing.qml
@@ -1,59 +1,12 @@
-/****************************************************************************
-**
-** 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
// This example shows how to create your own highlight delegate for a ListView
// that uses a SpringAnimation to provide custom movement when the
// highlight bar is moved between items.
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
@@ -87,7 +40,7 @@ Rectangle {
states: State {
name: "Current"
when: pet.ListView.isCurrentItem
- PropertyChanges { target: pet; x: 20 }
+ PropertyChanges { pet.x: 20 }
}
transitions: Transition {
NumberAnimation { properties: "x"; duration: 200 }
@@ -108,7 +61,7 @@ Rectangle {
ImageParticle {
anchors.fill: parent
system: particles
- source: "../../images/flower.png"
+ source: "images/flower.png"
color: "red"
clip: true
alpha: 1.0
@@ -147,7 +100,7 @@ Rectangle {
ImageParticle {
anchors.fill: parent
system: particles
- source: "../../images/flower.png"
+ source: "images/flower.png"
alpha: 0.1
color: "white"
rotationVariation: 180
diff --git a/examples/quick/particles/imageparticle/sprites.qml b/examples/quick/particles/imageparticle/sprites.qml
new file mode 100644
index 0000000000..d4887feab6
--- /dev/null
+++ b/examples/quick/particles/imageparticle/sprites.qml
@@ -0,0 +1,79 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ color: "lightsteelblue"
+ width: 800
+ height: 800
+ id: root
+
+ SpriteSequence {
+ sprites: Sprite {
+ name: "bear"
+ source: "images/bear_tiles.png"
+ frameCount: 13
+ frameDuration: 120
+ }
+ width: 250
+ height: 250
+ x: 20
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 20
+ z:4
+ }
+
+ ParticleSystem { id: sys }
+
+ ImageParticle {
+ anchors.fill: parent
+ id: particles
+ system: sys
+ sprites: [Sprite {
+ name: "happy"
+ source: "images/starfish_1.png"
+ frameCount: 1
+ frameDuration: 260
+ to: {"happy": 1, "silly": 1, "angry": 1}
+ }, Sprite {
+ name: "angry"
+ source: "images/starfish_0.png"
+ frameCount: 1
+ frameDuration: 260
+ to: {"happy": 1, "silly": 1, "angry": 1}
+ }, Sprite {
+ name: "silly"
+ source: "images/starfish_2.png"
+ frameCount: 1
+ frameDuration: 260
+ to: {"happy": 1, "silly": 1, "noticedbear": 0}
+ }, Sprite {
+ name: "noticedbear"
+ source: "images/starfish_3.png"
+ frameCount: 1
+ frameDuration: 2600
+ }]
+ }
+
+ Emitter {
+ system: sys
+ emitRate: 2
+ lifeSpan: 10000
+ velocity: AngleDirection {angle: 90; magnitude: 60; angleVariation: 5}
+ acceleration: PointDirection { y: 10 }
+ size: 160
+ sizeVariation: 40
+ width: parent.width
+ height: 100
+ }
+
+ SpriteGoal {
+ system: sys
+ width: root.width;
+ height: root.height/2;
+ y: root.height/2;
+ goalState:"noticedbear"
+ }
+}
diff --git a/examples/quick/particles/images.qrc b/examples/quick/particles/images.qrc
deleted file mode 100644
index 1f754838a8..0000000000
--- a/examples/quick/particles/images.qrc
+++ /dev/null
@@ -1,35 +0,0 @@
-<RCC>
- <qresource prefix="/particles">
- <file>images/_explo.png</file>
- <file>images/backgroundLeaves.jpg</file>
- <file>images/bear_tiles.png</file>
- <file>images/candle.png</file>
- <file>images/colortable.png</file>
- <file>images/finalfrontier.png</file>
- <file>images/flower.png</file>
- <file>images/matchmask.png</file>
- <file>images/meteor_explo.png</file>
- <file>images/meteor.png</file>
- <file>images/meteors.png</file>
- <file>images/nullRock.png</file>
- <file>images/particle2.png</file>
- <file>images/particle3.png</file>
- <file>images/particleA.png</file>
- <file>images/portal_bg.png</file>
- <file>images/realLeaf1.png</file>
- <file>images/realLeaf2.png</file>
- <file>images/realLeaf3.png</file>
- <file>images/realLeaf4.png</file>
- <file>images/rocket.png</file>
- <file>images/rocket2.png</file>
- <file>images/sizeInOut.png</file>
- <file>images/snowflake.png</file>
- <file>images/sparkleSize.png</file>
- <file>images/starfish_0.png</file>
- <file>images/starfish_1.png</file>
- <file>images/starfish_2.png</file>
- <file>images/starfish_3.png</file>
- <file>images/starfish_4.png</file>
- <file>images/starfish_mask.png</file>
- </qresource>
-</RCC>
diff --git a/examples/quick/particles/images/meteor_explo.png b/examples/quick/particles/images/meteor_explo.png
deleted file mode 100644
index e659bfe2cf..0000000000
--- a/examples/quick/particles/images/meteor_explo.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/particles/images/meteors.png b/examples/quick/particles/images/meteors.png
deleted file mode 100644
index bada8a1407..0000000000
--- a/examples/quick/particles/images/meteors.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/particles/images/sizeInOut.png b/examples/quick/particles/images/sizeInOut.png
deleted file mode 100644
index 43d8862dbe..0000000000
--- a/examples/quick/particles/images/sizeInOut.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/particles/itemparticle/CMakeLists.txt b/examples/quick/particles/itemparticle/CMakeLists.txt
deleted file mode 100644
index bb88ffb633..0000000000
--- a/examples/quick/particles/itemparticle/CMakeLists.txt
+++ /dev/null
@@ -1,271 +0,0 @@
-# Generated from itemparticle.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(itemparticle LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/itemparticle")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
-
-qt_add_executable(itemparticle
- main.cpp
-)
-set_target_properties(itemparticle PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(itemparticle PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
-)
-
-
-file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "content/*")
-foreach(file IN LISTS resource_glob_0)
- set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
-endforeach()
-
-file(GLOB resource_glob_1 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*qml")
-foreach(file IN LISTS resource_glob_1)
- set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
-endforeach()
-
-# Resources:
-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"
-)
-
-qt6_add_resources(itemparticle "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"
-)
-
-qt6_add_resources(itemparticle "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-set(qmake_immediate_resource_files
- ${resource_glob_0}
- ${resource_glob_1}
-)
-
-qt6_add_resources(itemparticle "qmake_immediate"
- PREFIX
- "/"
- FILES
- ${qmake_immediate_resource_files}
-)
-
-install(TARGETS itemparticle
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/quick/particles/itemparticle/content/Delegate.qml b/examples/quick/particles/itemparticle/content/Delegate.qml
deleted file mode 100644
index 946b7b8748..0000000000
--- a/examples/quick/particles/itemparticle/content/Delegate.qml
+++ /dev/null
@@ -1,98 +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
-
-//![0]
-Package {
- Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' }
- Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' }
-
- Rectangle {
- id: wrapper
- width: 200; height: 25
- color: 'lightsteelblue'
-
- Text { text: display; anchors.centerIn: parent }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (wrapper.state == 'inList')
- wrapper.state = 'inGrid';
- else
- wrapper.state = 'inList';
- }
- }
-
- state: 'inList'
- states: [
- State {
- name: 'inList'
- ParentChange { target: wrapper; parent: listDelegate }
- },
- State {
- name: 'inGrid'
- ParentChange {
- target: wrapper; parent: gridDelegate
- x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height
- }
- }
- ]
-
- transitions: [
- Transition {
- ParentAnimation {
- NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
- }
- }
- ]
- }
-}
-//![0]
diff --git a/examples/quick/particles/itemparticle/content/Delegate2.qml b/examples/quick/particles/itemparticle/content/Delegate2.qml
deleted file mode 100644
index 03465609d9..0000000000
--- a/examples/quick/particles/itemparticle/content/Delegate2.qml
+++ /dev/null
@@ -1,89 +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
-
-//![0]
-Package {
- Item { id: gridDelegate; width: w; height: h; Package.name: 'grid' }
- Item { id: particleDelegate; width: w; height: h; Package.name: 'particles'
-
- Rectangle {
- id: wrapper
- width: w; height: h;
- color: col
- rotation: Math.random()*360
- Behavior on rotation {RotationAnimation {}}
-
- states: State {
- name: "gridded"
- when: root.inGrid
- PropertyChanges {
- target: wrapper
- rotation: 0
- }
- ParentChange {
- target: wrapper
- parent: gridDelegate
- x:0
- y:0
- }
- }
- transitions: [
- Transition {
- ParentAnimation {
- NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
- }
- }
- ]
- }
- }
-}
-//![0]
diff --git a/examples/quick/particles/itemparticle/content/ExpandingDelegate.qml b/examples/quick/particles/itemparticle/content/ExpandingDelegate.qml
deleted file mode 100644
index 9ffbc7f350..0000000000
--- a/examples/quick/particles/itemparticle/content/ExpandingDelegate.qml
+++ /dev/null
@@ -1,215 +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 "../../../modelviews/listview/content"
-
-// This example illustrates expanding a list item to show a more detailed view.
-
- // Delegate for the recipes. This delegate has two modes:
- // 1. List mode (default), which just shows the picture and title of the recipe.
- // 2. Details mode, which also shows the ingredients and method.
- Component {
- id: recipeDelegate
-
- Item {
- id: recipe
-
- // Create a property to contain the visibility of the details.
- // We can bind multiple element's opacity to this one property,
- // rather than having a "PropertyChanges" line for each element we
- // want to fade.
- property real detailsOpacity : 0
-
- //this bit changed for aesthetics
- width: 70
- height: 70
- // A simple rounded rectangle for the background
- Rectangle {
- id: background
- x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2
- color: "ivory"
- border.color: "orange"
- radius: 5
- antialiasing: true
- }
- Image {
- anchors.fill:parent
- anchors.margins: -32
- source: "bubble.png"
- }
-
-
- // This mouse region covers the entire delegate.
- // When clicked it changes mode to 'Details'. If we are already
- // in Details mode, then no change will happen.
- MouseArea {
- anchors.fill: parent
- onClicked: recipe.state = 'Details';
- }
-
- // Lay out the page: picture, title and ingredients at the top, and method at the
- // bottom. Note that elements that should not be visible in the list
- // mode have their opacity set to recipe.detailsOpacity.
- Row {
- id: topLayout
- x: 10; y: 10; height: recipeImage.height; width: parent.width
- spacing: 10
-
- Image {
- id: recipeImage
- width: 50; height: 50
- source: "../../modelviews/listview/" + picture
- }
-
- Column {
- width: background.width - recipeImage.width - 20; height: recipeImage.height
- spacing: 5
-
- Text {
- text: title
- font.bold: true; font.pointSize: 16
- }
-
- Text {
- text: "Ingredients"
- font.pointSize: 12; font.bold: true
- opacity: recipe.detailsOpacity
- }
-
- Text {
- text: ingredients
- wrapMode: Text.WordWrap
- width: parent.width
- opacity: recipe.detailsOpacity
- }
- }
- }
-
- Item {
- id: details
- x: 10; width: parent.width - 20
- anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 }
- opacity: recipe.detailsOpacity
-
- Text {
- id: methodTitle
- anchors.top: parent.top
- text: "Method"
- font.pointSize: 12; font.bold: true
- }
-
- Flickable {
- id: flick
- width: parent.width
- anchors { top: methodTitle.bottom; bottom: parent.bottom }
- contentHeight: methodText.height
- clip: true
-
- Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width }
- }
-
- Image {
- anchors { right: flick.right; top: flick.top }
- source: "../../modelviews/listview/" + "content/pics/moreUp.png"
- opacity: flick.atYBeginning ? 0 : 1
- }
-
- Image {
- anchors { right: flick.right; bottom: flick.bottom }
- source: "../../modelviews/listview/" + "content/pics/moreDown.png"
- opacity: flick.atYEnd ? 0 : 1
- }
- }
-
- // A button to close the detailed view, i.e. set the state back to default ('').
- TextButton {
- y: 10
- anchors { right: background.right; rightMargin: 10 }
- opacity: recipe.detailsOpacity
- text: "Close"
-
- onClicked: recipe.state = '';
- }
-
- states: State {
- name: "Details"
-
- PropertyChanges { target: background; color: "white" }
- PropertyChanges { target: recipeImage; width: 130; height: 130 } // Make picture bigger
- PropertyChanges { target: recipe; detailsOpacity: 1; x: 0; opacity: 1 } // Make details visible
- PropertyChanges { target: recipe; height: root.height; width: root.height; x:0; y:0; z:100} // Fill the entire list area with the detailed view
-
- // Move the list so that this item is at the top.
- //PropertyChanges { target: recipe.ListView.view; explicit: true; contentY: recipe.y }
-
- // Disallow flicking while we're in detailed view
- //PropertyChanges { target: recipe.ListView.view; interactive: false }
- }
-
- transitions: Transition {
- //The only strictly necessary particle specific lines
- to: "Details"
- reversible: true
- ScriptAction {script: {
- if(state == "Details")
- mp.freeze(index);
- else
- mp.unfreeze(index);
- }
- }
- // Make the state changes smooth
- ParallelAnimation {
- ColorAnimation { property: "color"; duration: 500 }
- NumberAnimation { duration: 300; properties: "detailsOpacity,opacity,x,y,height,width" }
- }
- }
- }
- }
diff --git a/examples/quick/particles/itemparticle/content/bubble.png b/examples/quick/particles/itemparticle/content/bubble.png
deleted file mode 100644
index f26ed1d3f2..0000000000
--- a/examples/quick/particles/itemparticle/content/bubble.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/particles/itemparticle/content/script.js b/examples/quick/particles/itemparticle/content/script.js
deleted file mode 100644
index e8ef93a847..0000000000
--- a/examples/quick/particles/itemparticle/content/script.js
+++ /dev/null
@@ -1,27 +0,0 @@
-.pragma library
-
-function getWidth(string) {
- return (string.match(/width=\"([0-9]+)\"/))[1]
-}
-
-function getHeight(string) {
- return (string.match(/height=\"([0-9]+)\"/))[1]
-}
-
-function getImagePath(string) {
- var pattern = /src=\"http:\/\/(\S+)\"/
- return (string.match(pattern))[1]
-}
-
-function calculateScale(width, height, cellSize) {
- var widthScale = (cellSize * 1.0) / width
- var heightScale = (cellSize * 1.0) / height
- var scale = 0
-
- if (widthScale <= heightScale) {
- scale = widthScale;
- } else if (heightScale < widthScale) {
- scale = heightScale;
- }
- return scale;
-}
diff --git a/examples/quick/particles/itemparticle/delegates.qml b/examples/quick/particles/itemparticle/delegates.qml
deleted file mode 100644
index 0e9267214f..0000000000
--- a/examples/quick/particles/itemparticle/delegates.qml
+++ /dev/null
@@ -1,105 +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: "black"
-
- function newPithySaying() {
- switch (Math.floor(Math.random()*16)) {
- case 0: return "Hello World";
- case 1: return "G'day Mate";
- case 2: return "Code Less";
- case 3: return "Create More";
- case 4: return "Deploy Everywhere";
- case 5: return "Qt Meta-object Language";
- case 6: return "Qt Magic Language";
- case 7: return "Fluid UIs";
- case 8: return "Touchable";
- case 9: return "How's it going?";
- case 10: return "Do you like text?";
- case 11: return "Enjoy!";
- case 12: return "ERROR: Out of pith";
- case 13: return "Punctuation Failure";
- case 14: return "I can go faster";
- case 15: return "I can go slower";
- default: return "OMGWTFBBQ";
- }
- }
-
- ParticleSystem {
- anchors.fill: parent
- id: syssy
- MouseArea {
- anchors.fill: parent
- onClicked: syssy.running = !syssy.running
- }
- Emitter {
- anchors.centerIn: parent
- emitRate: 1
- lifeSpan: 4800
- lifeSpanVariation: 1600
- velocity: AngleDirection {angleVariation: 360; magnitude: 40; magnitudeVariation: 20}
- }
- ItemParticle {
- delegate: Text {
- text: root.newPithySaying();
- color: "white"
- font.pixelSize: 18
- font.bold: true
- }
- }
- }
-}
diff --git a/examples/quick/particles/itemparticle/itemparticle.pro b/examples/quick/particles/itemparticle/itemparticle.pro
deleted file mode 100644
index f5c0576b4a..0000000000
--- a/examples/quick/particles/itemparticle/itemparticle.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = app
-
-QT += quick qml
-SOURCES += main.cpp
-RESOURCES += \
- ../images.qrc \
- ../../shared/shared.qrc \
- $$files("content/*") \
- $$files("*qml")
-
-target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/itemparticle
-INSTALLS += target
diff --git a/examples/quick/particles/itemparticle/main.cpp b/examples/quick/particles/itemparticle/main.cpp
deleted file mode 100644
index da21f15be3..0000000000
--- a/examples/quick/particles/itemparticle/main.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
-#include "../../shared/shared.h"
-DECLARATIVE_EXAMPLE_MAIN(particleview)
diff --git a/examples/quick/particles/itemparticle/particleview.qml b/examples/quick/particles/itemparticle/particleview.qml
deleted file mode 100644
index 8eb18dc283..0000000000
--- a/examples/quick/particles/itemparticle/particleview.qml
+++ /dev/null
@@ -1,309 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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.12
-import QtQuick.Particles 2.12
-import "shared" as Shared
-import "content/script.js" as Script
-import "content"
-
-Item {
- id: root
- width: 640
- height: 480
- Rectangle {
- anchors.fill: parent
- color: "black"
- z: -1
- }
- Item {
- id: loading
- Behavior on opacity {NumberAnimation {}}
- anchors.fill: parent
- Text {
- anchors.centerIn: parent
- text: "Loading"
- color: "white"
- }
- }
- ParticleSystem {
- id: sys;
- running: true
- }
- Emitter {
- id: emitter
- system: sys
- height: parent.height - 132/2
- x: -132/2
- y: 132/2
- velocity: PointDirection { x: 32; xVariation: 8 }
- emitRate: 0.5
- lifeSpan: Emitter.InfiniteLife
- group: "photos"
- }
- Age {
- system: sys
- x: parent.width + 132/2
- height: parent.height
- width: 1000
- }
- ImageParticle {
- system: sys
- groups: ["fireworks"]
- source: "qrc:///particleresources/star.png"
- color: "lightsteelblue"
- alpha: 0
- colorVariation: 0
- z: 1000
- }
- ItemParticle {
- id: mp
- z: 0
- system: sys
- fade: false
- groups: ["photos"]
- }
- Component {
- id: alertDelegate
- Rectangle {
- color: "DarkSlateGray"
- border.width: 1
- border.color: "LightSteelBlue"
- width: 144
- height: 132
- antialiasing: true
- radius: 3
- NumberAnimation on scale {
- running: true
- loops: 1
- from: 0.2
- to: 1
- }
- Image {
- source: "qrc:///particles/images/rocket.png"
- anchors.centerIn: parent
- }
- Text {
- anchors.bottom: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- text: "A new ship has arrived!"
- color: "LightSteelBlue"
- }
- }
- }
- property Item alertItem;
- function alert() {
- force.enabled = true;
- alertItem = alertDelegate.createObject(root);
- alertItem.x = root.width/2 - alertItem.width/2
- alertItem.y = root.height/2 - alertItem.height/2
- spawnFireworks.pulse(200);
- stopAlert.start();
- }
- focus: true
- Keys.onSpacePressed: alert();
- Timer {
- id: stopAlert
- running: false
- repeat: false
- interval: 800
- onTriggered: {
- force.enabled = false;
- mp.take(root.alertItem, true);
- centerEmitter.burst(1);
- }
- }
- Attractor {
- id: force
- system: sys
- pointX: root.width/2
- pointY: root.height/2
- strength: -10000
- enabled: false
- anchors.centerIn: parent
- width: parent.width/2
- height: parent.height/2
- groups:["photos"]
- affectedParameter: Attractor.Position
- }
- Emitter {
- id: centerEmitter
- velocity: PointDirection { x: 32; xVariation: 8;}
- emitRate: 0.5
- lifeSpan: 12000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first)
- maximumEmitted: 20
- group: "photos"
- system: sys
- anchors.centerIn: parent
- enabled: false
-
- //TODO: Zoom in effect
- }
- Emitter {
- id: spawnFireworks
- group: "fireworks"
- system: sys
- maximumEmitted: 400
- emitRate: 400
- lifeSpan: 2800
- x: parent.width/2
- y: parent.height/2 - 64
- width: 8
- height: 8
- enabled: false
- size: 32
- endSize: 8
- velocity: AngleDirection { magnitude: 160; magnitudeVariation: 120; angleVariation: 90; angle: 270 }
- acceleration: PointDirection { y: 160 }
- }
- Item { x: -1000; y: -1000 //offscreen
- Repeater {//Load them here, add to system on completed
- model: flickrModel
- delegate: theDelegate
- }
- }
- Shared.FlickrRssModel {
- id: flickrModel
- tags: "particle,particles"
- }
- Component {
- id: theDelegate
- Image {
- required property int index
- required property string title
- required property string media
- required property string thumbnail
-
- id: image
- antialiasing: true;
- source: thumbnail
- cache: true
- property real depth: Math.random()
- property real darken: 0.75
- z: Math.floor(depth * 100)
- scale: (depth + 1) / 2
- sourceSize {
- width: root.width
- height: root.height
- }
- width: 132
- height: 132
- fillMode: Image.PreserveAspectFit
- Rectangle {
- // Darken based on depth
- anchors.centerIn: parent
- width: parent.paintedWidth + 1
- height: parent.paintedHeight + 1
- color: "black"
- opacity: image.darken * (1 - image.depth)
- antialiasing: true;
- }
- Text {
- anchors.bottom: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottomMargin: Math.max(parent.paintedWidth, parent.paintedHeight) - Math.min(parent.width, parent.height)
- width: parent.paintedWidth - 4
- horizontalAlignment: Text.AlignHCenter
- elide: Text.ElideRight
- text: image.title
- color: "black"
- }
- ItemParticle.onDetached: mp.take(image); // respawns
- onStatusChanged: if (image.status == Image.Ready) {
- loading.opacity = 0;
- mp.take(image);
- }
- function manage()
- {
- if (state == "selected") {
- console.log("Taking " + index);
- mp.freeze(image);
- } else {
- console.log("Returning " +index);
- mp.unfreeze(image);
- }
- }
- TapHandler {
- gesturePolicy: TapHandler.ReleaseWithinBounds
- onTapped: image.state = (image.state == "" ? "selected" : "")
- }
- states: State {
- name: "selected"
- ParentChange {
- target: image
- parent: root
- }
- PropertyChanges {
- target: image
- source: image.media
- x: 0
- y: 0
- width: root.width
- height: root.height
- z: 101
- opacity: 1
- rotation: 0
- darken: 0
- }
- }
- transitions: Transition {
- to: "selected"
- reversible: true
- SequentialAnimation {
- ScriptAction { script: image.manage() }
- ParallelAnimation {
- ParentAnimation {NumberAnimation { properties: "x,y" }}
- PropertyAnimation { properties: "width, height, z, rotation, darken"; easing.type: Easing.InOutQuad }
- }
- }
- }
- }
- }
-}
diff --git a/examples/quick/particles/particles.pro b/examples/quick/particles/particles.pro
index 5343fa00f1..62f7f35807 100644
--- a/examples/quick/particles/particles.pro
+++ b/examples/quick/particles/particles.pro
@@ -2,12 +2,8 @@ TEMPLATE = subdirs
SUBDIRS += affectors \
emitters \
imageparticle \
- itemparticle \
system
-EXAMPLE_FILES = \
- images.qrc
-
#Install shared images too
qml.files = images
qml.path = $$[QT_INSTALL_EXAMPLES]/quick/particles
diff --git a/examples/quick/particles/system/CMakeLists.txt b/examples/quick/particles/system/CMakeLists.txt
index 737dc5f90b..0c8f8852f9 100644
--- a/examples/quick/particles/system/CMakeLists.txt
+++ b/examples/quick/particles/system/CMakeLists.txt
@@ -1,265 +1,55 @@
-# Generated from system.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(system 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/system")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
-
-qt_add_executable(system
+qt_add_executable(systemexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(system PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(system PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
-)
-
-# Resources:
-set(system_resource_files
- "content/dynamiccomparison.qml"
- "content/dynamicemitters.qml"
- "content/multiplepainters.qml"
- "content/startstop.qml"
- "content/timedgroupchanges.qml"
- "system.qml"
+target_link_libraries(systemexample PRIVATE
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Qml
+ Qt6::Quick
)
-qt6_add_resources(system "system"
- PREFIX
- "/particles/system"
- FILES
- ${system_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"
-)
-
-qt6_add_resources(system "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"
-)
+add_dependencies(systemexample system_shared)
-qt6_add_resources(system "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS system
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
+# Resources:
+qt_add_qml_module(systemexample
+ URI system
+ QML_FILES
+ "dynamiccomparison.qml"
+ "dynamicemitters.qml"
+ "multiplepainters.qml"
+ "timedgroupchanges.qml"
+ "startstop.qml"
+ "system.qml"
+ RESOURCES
+ "images/sparkleSize.png"
+ "images/particle2.png"
+ "images/particle3.png"
+)
+
+install(TARGETS systemexample
+ BUNDLE DESTINATION .
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+qt_generate_deploy_qml_app_script(
+ TARGET systemexample
+ 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/system/content/dynamiccomparison.qml b/examples/quick/particles/system/content/dynamiccomparison.qml
deleted file mode 100644
index c1d42863ee..0000000000
--- a/examples/quick/particles/system/content/dynamiccomparison.qml
+++ /dev/null
@@ -1,149 +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
- color: "black"
- width: 640
- height: 480
- ParticleSystem {
- id: sys
- }
-
- ImageParticle {
- system: sys
- source: "qrc:///particleresources/glowdot.png"
- color: "white"
- colorVariation: 1.0
- alpha: 0.1
- entryEffect: ImageParticle.None
- }
-
- Emitter {
- id: emitter
- system: sys
- width: parent.width/2
- velocity: PointDirection {y: 72; yVariation: 24}
- lifeSpan: 10000
- emitRate: 1000
- enabled: false
- size: 32
- }
-
- //! [fake]
- Item {
- id: fakeEmitter
- function burst(number) {
- while (number > 0) {
- var item = fakeParticle.createObject(root);
- item.lifeSpan = Math.random() * 5000 + 5000;
- item.x = Math.random() * (root.width/2) + (root.width/2);
- item.y = 0;
- number--;
- }
- }
-
- Component {
- id: fakeParticle
- Image {
- id: container
- property int lifeSpan: 10000
- width: 32
- height: 32
- source: "qrc:///particleresources/glowdot.png"
- y: 0
- PropertyAnimation on y {from: -16; to: root.height-16; duration: container.lifeSpan; running: true}
- SequentialAnimation on opacity {
- running: true
- NumberAnimation { from:0; to: 1; duration: 500}
- PauseAnimation { duration: container.lifeSpan - 1000}
- NumberAnimation { from:1; to: 0; duration: 500}
- ScriptAction { script: container.destroy(); }
- }
- }
- }
- }
- //! [fake]
-
- //Hooked to a timer, but click for extra bursts that really stress performance
- Timer {
- interval: 10000
- triggeredOnStart: true
- repeat: true
- running: true
- onTriggered: {
- emitter.burst(1000);
- fakeEmitter.burst(1000);
- }
- }
- Text {
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- text: "1000 particles"
- color: "white"
- MouseArea {
- anchors.fill: parent
- onClicked: emitter.burst(1000);
- }
- }
- Text {
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- text: "1000 items"
- color: "white"
- MouseArea {
- anchors.fill: parent
- onClicked: fakeEmitter.burst(1000);
- }
- }
-}
diff --git a/examples/quick/particles/system/content/dynamicemitters.qml b/examples/quick/particles/system/content/dynamicemitters.qml
deleted file mode 100644
index 8eb87d2baa..0000000000
--- a/examples/quick/particles/system/content/dynamicemitters.qml
+++ /dev/null
@@ -1,150 +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
- color: "black"
- width: 640
- height: 480
- ParticleSystem {
- id: sys
- }
- ImageParticle {
- system: sys
- source: "qrc:///particleresources/glowdot.png"
- color: "white"
- colorVariation: 1.0
- alpha: 0.1
- }
-
- Component {
- id: emitterComp
- Emitter {
- id: container
- Emitter {
- id: emitMore
- system: sys
- emitRate: 128
- lifeSpan: 600
- size: 16
- endSize: 8
- velocity: AngleDirection {angleVariation:360; magnitude: 60}
- }
-
- property int life: 2600
- property real targetX: 0
- property real targetY: 0
- function go() {
- xAnim.start();
- yAnim.start();
- container.enabled = true
- }
- system: sys
- emitRate: 32
- lifeSpan: 600
- size: 24
- endSize: 8
- NumberAnimation on x {
- id: xAnim;
- to: targetX
- duration: life
- running: false
- }
- NumberAnimation on y {
- id: yAnim;
- to: targetY
- duration: life
- running: false
- }
- Timer {
- interval: life
- running: true
- onTriggered: container.destroy();
- }
- }
- }
-
- function customEmit(x,y) {
- //! [0]
- for (var i=0; i<8; i++) {
- var obj = emitterComp.createObject(root);
- obj.x = x
- obj.y = y
- obj.targetX = Math.random() * 240 - 120 + obj.x
- obj.targetY = Math.random() * 240 - 120 + obj.y
- obj.life = Math.round(Math.random() * 2400) + 200
- obj.emitRate = Math.round(Math.random() * 32) + 32
- obj.go();
- }
- //! [0]
- }
-
- Timer {
- interval: 10000
- triggeredOnStart: true
- running: true
- repeat: true
- onTriggered: customEmit(Math.random() * 320, Math.random() * 480)
- }
- MouseArea {
- anchors.fill: parent
- onClicked: (mouse)=> customEmit(mouse.x, mouse.y);
- }
-
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- text: "Click Somewhere"
- color: "white"
- font.pixelSize: 24
- }
-}
diff --git a/examples/quick/particles/system/content/multiplepainters.qml b/examples/quick/particles/system/content/multiplepainters.qml
deleted file mode 100644
index 1f2dcb6214..0000000000
--- a/examples/quick/particles/system/content/multiplepainters.qml
+++ /dev/null
@@ -1,106 +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: "darkblue"
- property bool cloneMode: false
- ParticleSystem {
- id: sys
- }
- MouseArea {
- anchors.fill: parent
- onClicked: cloneMode = !cloneMode;
- }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- text: "Click to Toggle"
- color: "white"
- font.pixelSize: 24
- }
- Emitter {
- system: sys
- y:root.height + 20
- width: root.width
- emitRate: 200
- lifeSpan: 4000
- startTime: 4000
- velocity: PointDirection { y: -120; }
- }
-
- ImageParticle {
- system: sys
- visible: !cloneMode
- source: "../../images/particle2.png"
- }
-
- ImageParticle {
- system: sys
- visible: cloneMode
- z: 0
- source: "../../images/particle3.png"
- }
-
- ImageParticle {
- system: sys
- clip: true
- visible: cloneMode
- y: 120
- height: 240
- width: root.width
- z: 1
- source: "qrc:///particleresources/glowdot.png"
- }
-}
diff --git a/examples/quick/particles/system/content/startstop.qml b/examples/quick/particles/system/content/startstop.qml
deleted file mode 100644
index a9ef7285aa..0000000000
--- a/examples/quick/particles/system/content/startstop.qml
+++ /dev/null
@@ -1,96 +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"
- Text {
- text: "Left click to start/stop\nRight click to pause/unpause"
- color: "white"
- font.pixelSize: 24
- }
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.LeftButton | Qt.RightButton
- onClicked: (mouse) => {
- if (mouse.button == Qt.LeftButton)
- particles.running = !particles.running
- else
- particles.paused = !particles.paused;
- }
- }
-
- ParticleSystem {
- id: particles
- running: false
- }
-
- ImageParticle {
- anchors.fill: parent
- system: particles
- source: "qrc:///particleresources/star.png"
- sizeTable: "../../images/sparkleSize.png"
- alpha: 0
- colorVariation: 0.6
- }
-
- Emitter {
- anchors.fill: parent
- system: particles
- emitRate: 2000
- lifeSpan: 2000
- size: 30
- sizeVariation: 10
- }
-}
diff --git a/examples/quick/particles/system/content/timedgroupchanges.qml b/examples/quick/particles/system/content/timedgroupchanges.qml
deleted file mode 100644
index cab992f898..0000000000
--- a/examples/quick/particles/system/content/timedgroupchanges.qml
+++ /dev/null
@@ -1,137 +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: 600
- color: "black"
- ParticleSystem {
- anchors.fill: parent
- id: syssy
- //! [0]
- ParticleGroup {
- name: "fire"
- duration: 2000
- durationVariation: 2000
- to: {"splode":1}
- }
- //! [0]
- //! [1]
- ParticleGroup {
- name: "splode"
- duration: 400
- to: {"dead":1}
- TrailEmitter {
- group: "works"
- emitRatePerParticle: 100
- lifeSpan: 1000
- maximumEmitted: 1200
- size: 8
- velocity: AngleDirection {angle: 270; angleVariation: 45; magnitude: 20; magnitudeVariation: 20;}
- acceleration: PointDirection {y:100; yVariation: 20}
- }
- }
- //! [1]
- //! [2]
- ParticleGroup {
- name: "dead"
- duration: 1000
- Affector {
- once: true
- onAffected: (x, y)=> worksEmitter.burst(400,x,y)
- }
- }
- //! [2]
-
- Timer {
- interval: 6000
- running: true
- triggeredOnStart: true
- repeat: true
- onTriggered:startingEmitter.pulse(100);
- }
- Emitter {
- id: startingEmitter
- group: "fire"
- width: parent.width
- y: parent.height
- enabled: false
- emitRate: 80
- lifeSpan: 6000
- velocity: PointDirection {y:-100;}
- size: 32
- }
-
- Emitter {
- id: worksEmitter
- group: "works"
- enabled: false
- emitRate: 100
- lifeSpan: 1600
- maximumEmitted: 6400
- size: 8
- velocity: CumulativeDirection {
- PointDirection {y:-100}
- AngleDirection {angleVariation: 360; magnitudeVariation: 80;}
- }
- acceleration: PointDirection {y:100; yVariation: 20}
- }
-
- ImageParticle {
- groups: ["works", "fire", "splode"]
- source: "qrc:///particleresources/glowdot.png"
- entryEffect: ImageParticle.Scale
- }
- }
-}
-
diff --git a/examples/quick/particles/system/doc/src/system.qdoc b/examples/quick/particles/system/doc/src/system.qdoc
index 22382190d3..b936bd8976 100644
--- a/examples/quick/particles/system/doc/src/system.qdoc
+++ b/examples/quick/particles/system/doc/src/system.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 - System
\example particles/system
+ \examplecategory {Graphics}
\brief This is a collection of examples using Affectors in the QML particle system.
\image qml-system-example.png
@@ -35,7 +12,7 @@
Each example is a small QML file emphasizing a particular type or feature.
Dynamic comparison compares using the particle system to getting a similar effect with the following code that dynamically instantiates Image types.
- \snippet particles/system/content/dynamiccomparison.qml fake
+ \snippet particles/system/dynamiccomparison.qml fake
Note how the Image objects are not able to be randomly colorized.
Start and Stop simply sets the running and paused states of a ParticleSystem. While the system does not perform any simulation when stopped or paused, a restart restarts the simulation from the beginning, while unpausing resumes the simulation from where it was.
@@ -43,14 +20,14 @@
Timed group changes is an example that highlights the ParticleGroup type. While normally referring to groups with a string name is sufficient, additional effects can be
done by setting properties on groups.
The first group has a variable duration on it, but always transitions to the second group.
- \snippet particles/system/content/timedgroupchanges.qml 0
+ \snippet particles/system/timedgroupchanges.qml 0
The second group has a TrailEmitter on it, and a fixed duration for emitting into the third group. By placing the TrailEmitter as a direct child of the ParticleGroup, it automatically selects that group to follow.
- \snippet particles/system/content/timedgroupchanges.qml 1
+ \snippet particles/system/timedgroupchanges.qml 1
The third group has an Affector as a direct child, which makes the affector automatically target this group. The affector means that as soon as particles enter this group, a burst function can be called on another emitter, using the x,y positions of this particle.
- \snippet particles/system/content/timedgroupchanges.qml 2
+ \snippet particles/system/timedgroupchanges.qml 2
If TrailEmitter does not suit your needs for multiple emitters, you can also dynamically create Emitters while still using the same ParticleSystem and image particle
- \snippet particles/system/content/dynamicemitters.qml 0
+ \snippet particles/system/dynamicemitters.qml 0
Note that this effect, a flurry of flying rainbow spears, would be better served with TrailEmitter. It is only done with dynamic emitters in this example to show the concept more simply.
Multiple Painters shows how to control paint ordering of individual particles. While the paint ordering of particles within one ImagePainter is not strictly defined, ImageParticle objects follow the normal Z-ordering rules for \l {Qt Quick} items. This example allow you to paint the inside of the particles above the black borders using a pair of ImageParticles each painting different parts of the same logical particle.
diff --git a/examples/quick/particles/system/dynamiccomparison.qml b/examples/quick/particles/system/dynamiccomparison.qml
new file mode 100644
index 0000000000..d29b72f998
--- /dev/null
+++ b/examples/quick/particles/system/dynamiccomparison.qml
@@ -0,0 +1,103 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+pragma ComponentBehavior: Bound
+
+Rectangle {
+ id: root
+ color: "black"
+ width: 640
+ height: 480
+ ParticleSystem {
+ id: sys
+ }
+
+ ImageParticle {
+ system: sys
+ source: "qrc:///particleresources/glowdot.png"
+ color: "white"
+ colorVariation: 1.0
+ alpha: 0.1
+ entryEffect: ImageParticle.None
+ }
+
+ Emitter {
+ id: emitter
+ system: sys
+ width: parent.width/2
+ velocity: PointDirection {y: 72; yVariation: 24}
+ lifeSpan: 10000
+ emitRate: 1000
+ enabled: false
+ size: 32
+ }
+
+ //! [fake]
+ Item {
+ id: fakeEmitter
+ function burst(number) {
+ while (number > 0) {
+ let item = fakeParticle.createObject(root)
+ item.lifeSpan = Math.random() * 5000 + 5000
+ item.x = Math.random() * (root.width / 2) + (root.width / 2)
+ item.y = 0
+ number--
+ }
+ }
+
+ Component {
+ id: fakeParticle
+ Image {
+ id: container
+ property int lifeSpan: 10000
+ width: 32
+ height: 32
+ source: "qrc:///particleresources/glowdot.png"
+ PropertyAnimation on y { from: -16; to: root.height - 16; duration: container.lifeSpan; running: true }
+ SequentialAnimation on opacity {
+ running: true
+ NumberAnimation { from: 0; to: 1; duration: 500 }
+ PauseAnimation { duration: container.lifeSpan - 1000 }
+ NumberAnimation { from: 1; to: 0; duration: 500 }
+ ScriptAction { script: container.destroy(); }
+ }
+ }
+ }
+ }
+ //! [fake]
+
+ //Hooked to a timer, but click for extra bursts that really stress performance
+ Timer {
+ interval: 10000
+ triggeredOnStart: true
+ repeat: true
+ running: true
+ onTriggered: {
+ emitter.burst(1000);
+ fakeEmitter.burst(1000);
+ }
+ }
+ Text {
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ text: qsTr("1000 particles")
+ color: "white"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: emitter.burst(1000);
+ }
+ }
+ Text {
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ text: qsTr("1000 items")
+ color: "white"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: fakeEmitter.burst(1000);
+ }
+ }
+}
diff --git a/examples/quick/particles/system/dynamicemitters.qml b/examples/quick/particles/system/dynamicemitters.qml
new file mode 100644
index 0000000000..31c70b2a6c
--- /dev/null
+++ b/examples/quick/particles/system/dynamicemitters.qml
@@ -0,0 +1,107 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+pragma ComponentBehavior: Bound
+
+Rectangle {
+ id: root
+ color: "black"
+ width: 640
+ height: 480
+ ParticleSystem {
+ id: sys
+ }
+ ImageParticle {
+ system: sys
+ source: "qrc:///particleresources/glowdot.png"
+ color: "white"
+ colorVariation: 1.0
+ alpha: 0.1
+ }
+
+ Component {
+ id: emitterComp
+ Emitter {
+ id: container
+ Emitter {
+ id: emitMore
+ system: sys
+ emitRate: 128
+ lifeSpan: 600
+ size: 16
+ endSize: 8
+ velocity: AngleDirection {
+ angleVariation: 360
+ magnitude: 60
+ }
+ }
+
+ property int life: 2600
+ property real targetX: 0
+ property real targetY: 0
+ function go() {
+ xAnim.start()
+ yAnim.start()
+ container.enabled = true
+ }
+ system: sys
+ emitRate: 32
+ lifeSpan: 600
+ size: 24
+ endSize: 8
+ NumberAnimation on x {
+ id: xAnim;
+ to: container.targetX
+ duration: container.life
+ running: false
+ }
+ NumberAnimation on y {
+ id: yAnim;
+ to: container.targetY
+ duration: container.life
+ running: false
+ }
+ Timer {
+ interval: container.life
+ running: true
+ onTriggered: container.destroy()
+ }
+ }
+ }
+
+ function customEmit(x, y) {
+ //! [0]
+ for (var i = 0; i < 8; i++) {
+ let obj = emitterComp.createObject(root)
+ obj.x = x
+ obj.y = y
+ obj.targetX = Math.random() * 240 - 120 + obj.x
+ obj.targetY = Math.random() * 240 - 120 + obj.y
+ obj.life = Math.round(Math.random() * 2400) + 200
+ obj.emitRate = Math.round(Math.random() * 32) + 32
+ obj.go()
+ }
+ //! [0]
+ }
+
+ Timer {
+ interval: 10000
+ triggeredOnStart: true
+ running: true
+ repeat: true
+ onTriggered: root.customEmit(Math.random() * 320, Math.random() * 480)
+ }
+ TapHandler {
+ onTapped: function(event) { root.customEmit(event.pressPosition.x, event.pressPosition.y) }
+ }
+
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Click Somewhere")
+ color: "white"
+ font.pixelSize: 24
+ }
+}
diff --git a/examples/quick/particles/images/particle2.png b/examples/quick/particles/system/images/particle2.png
index 4f3372cd07..4f3372cd07 100644
--- a/examples/quick/particles/images/particle2.png
+++ b/examples/quick/particles/system/images/particle2.png
Binary files differ
diff --git a/examples/quick/particles/images/particle3.png b/examples/quick/particles/system/images/particle3.png
index 2b04601403..2b04601403 100644
--- a/examples/quick/particles/images/particle3.png
+++ b/examples/quick/particles/system/images/particle3.png
Binary files differ
diff --git a/examples/quick/particles/images/sparkleSize.png b/examples/quick/particles/system/images/sparkleSize.png
index 752056541b..752056541b 100644
--- a/examples/quick/particles/images/sparkleSize.png
+++ b/examples/quick/particles/system/images/sparkleSize.png
Binary files differ
diff --git a/examples/quick/particles/system/main.cpp b/examples/quick/particles/system/main.cpp
index 63a88412f5..b18019f663 100644
--- a/examples/quick/particles/system/main.cpp
+++ b/examples/quick/particles/system/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/system/system)
+DECLARATIVE_EXAMPLE_MAIN(system/system)
diff --git a/examples/quick/particles/system/multiplepainters.qml b/examples/quick/particles/system/multiplepainters.qml
new file mode 100644
index 0000000000..5356f5fe8a
--- /dev/null
+++ b/examples/quick/particles/system/multiplepainters.qml
@@ -0,0 +1,58 @@
+// 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: "darkblue"
+ property bool cloneMode: false
+ ParticleSystem {
+ id: sys
+ }
+ TapHandler {
+ onTapped: root.cloneMode = !root.cloneMode
+ }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Click to Toggle")
+ color: "white"
+ font.pixelSize: 24
+ }
+ Emitter {
+ system: sys
+ y:root.height + 20
+ width: root.width
+ emitRate: 200
+ lifeSpan: 4000
+ startTime: 4000
+ velocity: PointDirection { y: -120 }
+ }
+
+ ImageParticle {
+ system: sys
+ visible: !root.cloneMode
+ source: "images/particle2.png"
+ }
+
+ ImageParticle {
+ system: sys
+ visible: root.cloneMode
+ z: 0
+ source: "images/particle3.png"
+ }
+
+ ImageParticle {
+ system: sys
+ clip: true
+ visible: root.cloneMode
+ y: 120
+ height: 240
+ width: root.width
+ z: 1
+ source: "qrc:///particleresources/glowdot.png"
+ }
+}
diff --git a/examples/quick/particles/system/startstop.qml b/examples/quick/particles/system/startstop.qml
new file mode 100644
index 0000000000..e89c1f40f0
--- /dev/null
+++ b/examples/quick/particles/system/startstop.qml
@@ -0,0 +1,50 @@
+// Copyright (C) 2021 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"
+ Text {
+ text: qsTr("Left click to start/stop\nRight click to pause/unpause")
+ color: "white"
+ font.pixelSize: 24
+ }
+
+ TapHandler {
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onTapped: function (event, mouseButton)
+ {
+ if (mouseButton === Qt.LeftButton)
+ particles.running = !particles.running
+ else
+ particles.paused = !particles.paused;
+ }
+ }
+
+ ParticleSystem {
+ id: particles
+ running: false
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ system: particles
+ source: "qrc:///particleresources/star.png"
+ sizeTable: "images/sparkleSize.png"
+ alpha: 0
+ colorVariation: 0.6
+ }
+
+ Emitter {
+ anchors.fill: parent
+ system: particles
+ emitRate: 2000
+ lifeSpan: 2000
+ size: 30
+ sizeVariation: 10
+ }
+}
diff --git a/examples/quick/particles/system/system.pro b/examples/quick/particles/system/system.pro
index df143f10a3..ea620f687a 100644
--- a/examples/quick/particles/system/system.pro
+++ b/examples/quick/particles/system/system.pro
@@ -4,7 +4,6 @@ QT += quick qml
SOURCES += main.cpp
RESOURCES += \
system.qrc \
- ../images.qrc \
../../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/system
diff --git a/examples/quick/particles/system/system.qml b/examples/quick/particles/system/system.qml
index 569676d424..021438944a 100644
--- a/examples/quick/particles/system/system.qml
+++ b/examples/quick/particles/system/system.qml
@@ -1,68 +1,21 @@
-/****************************************************************************
-**
-** 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("Dynamic Comparison", "Compares with dynamically created elements", Qt.resolvedUrl("content/dynamiccomparison.qml"));
- addExample("StartStop", "Start and stop the simulation", Qt.resolvedUrl("content/startstop.qml"));
- addExample("Timed group changes", "Emit into managed groups", Qt.resolvedUrl("content/timedgroupchanges.qml"));
- addExample("Dynamic Emitters", "Dynamically instantiated emitters with a single system", Qt.resolvedUrl("content/dynamicemitters.qml"));
- addExample("Multiple Painters", "Several ParticlePainters on the same logical particles", Qt.resolvedUrl("content/multiplepainters.qml"));
+ addExample("Dynamic Comparison", "Compares with dynamically created elements", Qt.resolvedUrl("dynamiccomparison.qml"));
+ addExample("StartStop", "Start and stop the simulation", Qt.resolvedUrl("startstop.qml"));
+ addExample("Timed group changes", "Emit into managed groups", Qt.resolvedUrl("timedgroupchanges.qml"));
+ addExample("Dynamic Emitters", "Dynamically instantiated emitters with a single system", Qt.resolvedUrl("dynamicemitters.qml"));
+ addExample("Multiple Painters", "Several ParticlePainters on the same logical particles", Qt.resolvedUrl("multiplepainters.qml"));
}
}
}
diff --git a/examples/quick/particles/system/system.qrc b/examples/quick/particles/system/system.qrc
index 3fb8221fb1..806f11e818 100644
--- a/examples/quick/particles/system/system.qrc
+++ b/examples/quick/particles/system/system.qrc
@@ -1,10 +1,13 @@
<RCC>
- <qresource prefix="/particles/system">
+ <qresource prefix="/qt/qml/system">
<file>system.qml</file>
- <file>content/dynamiccomparison.qml</file>
- <file>content/dynamicemitters.qml</file>
- <file>content/multiplepainters.qml</file>
- <file>content/startstop.qml</file>
- <file>content/timedgroupchanges.qml</file>
+ <file>dynamiccomparison.qml</file>
+ <file>dynamicemitters.qml</file>
+ <file>multiplepainters.qml</file>
+ <file>startstop.qml</file>
+ <file>timedgroupchanges.qml</file>
+ <file>images/sparkleSize.png</file>
+ <file>images/particle2.png</file>
+ <file>images/particle3.png</file>
</qresource>
</RCC>
diff --git a/examples/quick/particles/system/timedgroupchanges.qml b/examples/quick/particles/system/timedgroupchanges.qml
new file mode 100644
index 0000000000..b60269ba13
--- /dev/null
+++ b/examples/quick/particles/system/timedgroupchanges.qml
@@ -0,0 +1,90 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+import QtQuick.Particles
+
+Rectangle {
+ width: 360
+ height: 600
+ color: "black"
+ ParticleSystem {
+ anchors.fill: parent
+ id: syssy
+ //! [0]
+ ParticleGroup {
+ name: "fire"
+ duration: 2000
+ durationVariation: 2000
+ to: {"splode":1}
+ }
+ //! [0]
+ //! [1]
+ ParticleGroup {
+ name: "splode"
+ duration: 400
+ to: {"dead":1}
+ TrailEmitter {
+ group: "works"
+ emitRatePerParticle: 100
+ lifeSpan: 1000
+ maximumEmitted: 1200
+ size: 8
+ velocity: AngleDirection {angle: 270; angleVariation: 45; magnitude: 20; magnitudeVariation: 20;}
+ acceleration: PointDirection {y:100; yVariation: 20}
+ }
+ }
+ //! [1]
+ //! [2]
+ ParticleGroup {
+ name: "dead"
+ duration: 1000
+ Affector {
+ once: true
+ onAffected: (x, y)=> worksEmitter.burst(400,x,y)
+ }
+ }
+ //! [2]
+
+ Timer {
+ interval: 6000
+ running: true
+ triggeredOnStart: true
+ repeat: true
+ onTriggered:startingEmitter.pulse(100);
+ }
+ Emitter {
+ id: startingEmitter
+ group: "fire"
+ width: parent.width
+ y: parent.height
+ enabled: false
+ emitRate: 80
+ lifeSpan: 6000
+ velocity: PointDirection {y:-100;}
+ size: 32
+ }
+
+ Emitter {
+ id: worksEmitter
+ group: "works"
+ enabled: false
+ emitRate: 100
+ lifeSpan: 1600
+ maximumEmitted: 6400
+ size: 8
+ velocity: CumulativeDirection {
+ PointDirection {y:-100}
+ AngleDirection {angleVariation: 360; magnitudeVariation: 80;}
+ }
+ acceleration: PointDirection {y:100; yVariation: 20}
+ }
+
+ ImageParticle {
+ groups: ["works", "fire", "splode"]
+ source: "qrc:///particleresources/glowdot.png"
+ entryEffect: ImageParticle.Scale
+ }
+ }
+}
+