Warning, /education/gcompris/src/core/ParticleSystemStarLoader.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - ParticleSystemStarLoader.qml
0002  *
0003  * SPDX-FileCopyrightText: 2014 Bruno Coudoin <bruno.coudoin@gcompris.net>
0004  *
0005  * Authors:
0006  *   Bruno Coudoin <bruno.coudoin@gcompris.net>
0007  *
0008  *   SPDX-License-Identifier: GPL-3.0-or-later
0009  */
0010 import QtQuick 2.12
0011 import GCompris 1.0
0012 
0013 /**
0014  * A QML loader that wraps ParticleSystemStar.
0015  * @ingroup components
0016  *
0017  * Wrapper loading/activating a @ref ParticleSystemStarLoader only if
0018  * the Android systems supports fragment shaders according to
0019  * ApplicationInfo.hasShader.
0020  *
0021  * @inherit QtQuick.Loader
0022  * @sa ParticleSystemStar ApplicationInfo.hasShader
0023  */
0024 Loader {
0025     anchors.fill: parent
0026     active: ApplicationInfo.hasShader
0027 
0028     /**
0029      * Emits count particles from the particle emitter immediately.
0030      *
0031      * Cf. Emitter.burst
0032      */
0033     function burst(val) {
0034         if(active) {
0035             item.opacity = 1
0036             item.start()
0037             item.emitter.burst(val)
0038             stopParticleSystem.restart()
0039         }
0040     }
0041 
0042     Timer {
0043         id: stopParticleSystem
0044         interval: (item && item.emitter) ? item.emitter.lifeSpan + item.emitter.lifeSpanVariation : 0
0045         repeat: false
0046         onTriggered: {
0047             item.stop()
0048             item.opacity = 0
0049         }
0050     }
0051     onLoaded: item.clip = clip
0052     source: "ParticleSystemStar.qml"
0053 }