Warning, /education/gcompris/src/activities/path_encoding/Tux.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - Tux.qml 0002 * 0003 * SPDX-FileCopyrightText: 2021 Harsh Kumar <hadron43@yahoo.com> 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 import QtQuick 2.12 0008 import "path.js" as Activity 0009 import GCompris 1.0 0010 0011 Image { 0012 id: tux 0013 0014 source: "qrc:/gcompris/src/activities/maze/resource/tux_top_south.svg" 0015 fillMode: Image.PreserveAspectFit 0016 sourceSize.width: width 0017 0018 z: 10 0019 0020 property int duration: 1000 0021 property bool animationEnabled: true 0022 property bool isAnimationRunning: xAnimation.running || yAnimation.running || rAnimation.running 0023 0024 // values: UP, DOWN, LEFT, RIGHT 0025 property string direction 0026 rotation: [Activity.Directions.DOWN, Activity.Directions.LEFT, Activity.Directions.UP, Activity.Directions.RIGHT].indexOf(direction) * 90 0027 0028 signal init(string initialDirection) 0029 0030 onInit: { 0031 animationEnabled = false 0032 direction = initialDirection 0033 Activity.moveTuxToBlock() 0034 animationEnabled = true 0035 } 0036 0037 Behavior on x { 0038 enabled: animationEnabled 0039 SmoothedAnimation { 0040 id: xAnimation 0041 reversingMode: SmoothedAnimation.Immediate 0042 duration: tux.duration 0043 } 0044 } 0045 Behavior on y { 0046 enabled: animationEnabled 0047 SmoothedAnimation { 0048 id: yAnimation 0049 reversingMode: SmoothedAnimation.Immediate 0050 duration: tux.duration 0051 } 0052 } 0053 Behavior on rotation { 0054 enabled: animationEnabled 0055 RotationAnimation { 0056 id: rAnimation 0057 duration: tux.duration / 4 0058 direction: RotationAnimation.Shortest 0059 } 0060 } 0061 0062 }