Warning, /education/gcompris/src/activities/gravity/Planet.qml is written in an unsupported language. File is not indexed.

0001 /* GCompris - Planet.qml
0002 *
0003 * SPDX-FileCopyrightText: 2020 Timothée Giet <animtim@gmail.com>
0004 *
0005 * Authors:
0006 *   Bruno Coudoin <bruno.coudoin@gcompris.net> and Matilda Bernard (GTK+ version)
0007 *   Siddhesh suthar <siddhesh.it@gmail.com> (Qt Quick port)
0008 *   Timothée Giet <animtim@gmail.com> (complete activity rewrite)
0009 *
0010 *   SPDX-License-Identifier: GPL-3.0-or-later
0011 */
0012 import QtQuick 2.12
0013 import GCompris 1.0
0014 
0015 import "../../core"
0016 import "gravity.js" as Activity
0017 
0018 Image {
0019     id: planet
0020     asynchronous: true
0021     sourceSize.width: undefined
0022     sourceSize.height: undefined
0023     z: 5
0024     y: height * -2
0025     x: leftSide ? width * -0.5 : parent.width - width * 0.5 
0026     visible: false
0027     
0028     property bool leftSide: true
0029     property alias fallDuration: down.duration
0030 
0031     function startMoving() {
0032         down.restart();
0033     }
0034 
0035     NumberAnimation {
0036         id: down
0037         target: planet
0038         property: "y"
0039         to: parent.height + height * 2
0040     }
0041 
0042     Image {
0043         id: gravityImage
0044         asynchronous: true
0045         sourceSize.width: undefined
0046         sourceSize.height: undefined
0047         source: Activity.url + "gravity.svg"
0048         anchors.horizontalCenter: parent.horizontalCenter
0049         anchors.verticalCenter: parent.verticalCenter
0050         width: planet.width * 3
0051         height: width
0052         z: -1
0053     }
0054 }