Warning, /education/gcompris/src/activities/positions/BoxBoyPosition.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - BoxBoyPosition.qml 0002 * 0003 * SPDX-FileCopyrightText: 2021 Mariam Fahmy <mariamfahmy66@gmail.com> 0004 * 0005 * Authors: 0006 * Mariam Fahmy <mariamfahmy66@gmail.com> 0007 * 0008 * SPDX-License-Identifier: GPL-3.0-or-later 0009 */ 0010 0011 import QtQuick 2.12 0012 import GCompris 1.0 0013 import "positions.js" as Activity 0014 0015 Item { 0016 id: backgroundPosition 0017 property int checkState 0018 property real boxSize: Math.min(backgroundPosition.width * 0.4, backgroundPosition.height * 0.4) 0019 0020 Image { 0021 id: boy 0022 z: 0 0023 source: "qrc:/gcompris/src/activities/positions/resource/boy.svg" 0024 height: backgroundPosition.boxSize * 0.75 0025 width: height 0026 sourceSize.height: height 0027 sourceSize.width: height 0028 fillMode: Image.PreserveAspectFit 0029 anchors.verticalCenter: backSide.verticalCenter 0030 anchors.horizontalCenter: backSide.horizontalCenter 0031 anchors.horizontalCenterOffset: 0 0032 anchors.verticalCenterOffset: 0 0033 } 0034 0035 Image { 0036 id: backSide 0037 z: 1 0038 source: "qrc:/gcompris/src/activities/positions/resource/back_side.svg" 0039 anchors.horizontalCenter: parent.horizontalCenter 0040 anchors.verticalCenter: parent.verticalCenter 0041 sourceSize.width: backgroundPosition.boxSize 0042 sourceSize.height: backgroundPosition.boxSize 0043 fillMode: Image.PreserveAspectFit 0044 } 0045 0046 Image { 0047 id: rightSide 0048 z: 1 0049 source: "qrc:/gcompris/src/activities/positions/resource/right_side.svg" 0050 anchors.centerIn: backSide 0051 sourceSize.width: backgroundPosition.boxSize 0052 sourceSize.height: backgroundPosition.boxSize 0053 fillMode: Image.PreserveAspectFit 0054 } 0055 0056 Image { 0057 id: leftSide 0058 z: 10 0059 source: "qrc:/gcompris/src/activities/positions/resource/left_side.svg" 0060 anchors.centerIn: backSide 0061 sourceSize.width: backgroundPosition.boxSize 0062 sourceSize.height: backgroundPosition.boxSize 0063 fillMode: Image.PreserveAspectFit 0064 } 0065 0066 Image { 0067 id: frontSide 0068 z: 10 0069 source: "qrc:/gcompris/src/activities/positions/resource/front_side.svg" 0070 anchors.centerIn: backSide 0071 sourceSize.width: backgroundPosition.boxSize 0072 sourceSize.height: backgroundPosition.boxSize 0073 fillMode: Image.PreserveAspectFit 0074 } 0075 0076 Image { 0077 id: topSide 0078 z: 10 0079 source: "qrc:/gcompris/src/activities/positions/resource/top_side.svg" 0080 anchors.centerIn: backSide 0081 sourceSize.width: backgroundPosition.boxSize 0082 sourceSize.height: backgroundPosition.boxSize 0083 fillMode: Image.PreserveAspectFit 0084 visible: true 0085 } 0086 0087 states: [ 0088 State { 0089 name: "underPosition" 0090 when: checkState === Activity.underPosition 0091 PropertyChanges { 0092 target: boy 0093 z: 0 0094 anchors.horizontalCenterOffset: 0 0095 anchors.verticalCenterOffset: backgroundPosition.boxSize * 0.75 0096 } 0097 PropertyChanges { 0098 target: topSide 0099 visible: true 0100 } 0101 }, 0102 State { 0103 name: "rightPosition" 0104 when: checkState === Activity.rightPosition 0105 PropertyChanges { 0106 target: boy 0107 z: 0 0108 anchors.horizontalCenterOffset: backgroundPosition.boxSize * 0.75 0109 anchors.verticalCenterOffset: backgroundPosition.boxSize * 0.05 0110 } 0111 PropertyChanges { 0112 target: topSide 0113 visible: true 0114 } 0115 }, 0116 State { 0117 name: "leftPosition" 0118 when: checkState === Activity.leftPosition 0119 PropertyChanges { 0120 target: boy 0121 z: 15 0122 anchors.horizontalCenterOffset: backgroundPosition.boxSize * -0.7 0123 anchors.verticalCenterOffset: backgroundPosition.boxSize * 0.05 0124 } 0125 PropertyChanges { 0126 target: topSide 0127 visible: true 0128 } 0129 }, 0130 State { 0131 name: "abovePosition" 0132 when: checkState === Activity.abovePosition 0133 PropertyChanges { 0134 target: boy 0135 z: 15 0136 anchors.horizontalCenterOffset: backgroundPosition.boxSize * -0.05 0137 anchors.verticalCenterOffset: backgroundPosition.boxSize * -0.7 0138 } 0139 PropertyChanges { 0140 target: topSide 0141 visible: true 0142 } 0143 }, 0144 State { 0145 name: "insidePosition" 0146 when: checkState === Activity.insidePosition 0147 PropertyChanges { 0148 target: boy 0149 z: 5 0150 anchors.horizontalCenterOffset: backgroundPosition.boxSize * -0.05 0151 anchors.verticalCenterOffset: backgroundPosition.boxSize * -0.25 0152 } 0153 PropertyChanges { 0154 target: topSide 0155 visible: false 0156 } 0157 }, 0158 State { 0159 name: "behindPosition" 0160 when: checkState === Activity.behindPosition 0161 PropertyChanges { 0162 target: boy 0163 z: 0 0164 anchors.horizontalCenterOffset: backgroundPosition.boxSize * -0.15 0165 anchors.verticalCenterOffset: backgroundPosition.boxSize * -0.5 0166 } 0167 PropertyChanges { 0168 target: topSide 0169 visible: true 0170 } 0171 }, 0172 State { 0173 name: "inFrontOfPosition" 0174 when: checkState === Activity.inFrontOfPosition 0175 PropertyChanges { 0176 target: boy 0177 z: 15 0178 anchors.horizontalCenterOffset: backgroundPosition.boxSize * 0.15 0179 anchors.verticalCenterOffset: backgroundPosition.boxSize * 0.25 0180 } 0181 PropertyChanges { 0182 target: topSide 0183 visible: true 0184 } 0185 } 0186 ] 0187 }