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

0001 /* gcompris - Plane.qml
0002 
0003  SPDX-FileCopyrightText: 2014 Johnny Jazeix <jazeix@gmail.com>
0004 
0005  2003, 2014: Bruno Coudoin: initial version
0006  2014: Johnny Jazeix: Qt port
0007 
0008  SPDX-License-Identifier: GPL-3.0-or-later
0009 */
0010 import QtQuick 2.12
0011 import "planegame.js" as Activity
0012 import GCompris 1.0
0013 
0014 Image {
0015     id: plane
0016 
0017     property Item background
0018     property real velocityX
0019     property real velocityY
0020 
0021     source: Activity.url + "resource/tuxhelico.svg"
0022     fillMode: Image.PreserveAspectFit
0023 
0024     sourceSize.height: 80 * ApplicationInfo.ratio
0025 
0026     z: 10
0027 
0028     states: [
0029         State {
0030             name: "init"
0031             PropertyChanges {
0032                 target: plane
0033                 x: 20
0034                 y: parent.height / 2 - plane.height / 2
0035                 velocityX: 700
0036                 velocityY: 700
0037                 height: sourceSize.height * (1.0 - 0.5 * Activity.items.currentLevel / 10)
0038             }
0039         },
0040         State {
0041             name: "play"
0042             PropertyChanges {
0043                 target: plane
0044                 x: 20
0045                 y: parent.height / 2 - plane.height / 2
0046                 velocityX: 200
0047                 velocityY: 200
0048                 height: sourceSize.height * (1.0 - 0.5 * Activity.items.currentLevel / 10)
0049             }
0050         }
0051     ]
0052 
0053     Behavior on x {
0054         SmoothedAnimation {
0055             velocity: velocityX * ApplicationInfo.ratio
0056             reversingMode: SmoothedAnimation.Immediate
0057         }
0058     }
0059     Behavior on y {
0060         SmoothedAnimation {
0061             velocity: velocityY * ApplicationInfo.ratio
0062             reversingMode: SmoothedAnimation.Immediate
0063         }
0064     }
0065     Behavior on height { PropertyAnimation { duration: 100 } }
0066     Behavior on rotation { PropertyAnimation { duration: 100 } }
0067 }