Warning, /education/gcompris/src/activities/frieze/TokenFrieze.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - TokenFrieze.qml 0002 * 0003 * SPDX-FileCopyrightText: 2023 Bruno ANSELME <be.root@free.fr> 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 * 0006 * References : https://del-en-maternelle.fr/les-domaines/maths/les-algorithmes/ 0007 * https://irem.univ-nantes.fr/wp-content/uploads/2019/12/Algorithmes.pdf 0008 */ 0009 import QtQuick 2.12 0010 import GCompris 1.0 0011 0012 import "../../core" 0013 import "qrc:/gcompris/src/core/core.js" as Core 0014 import "frieze.js" as Activity 0015 0016 Item { 0017 id: token 0018 property string content: content_ 0019 property bool clickable: clickable_ 0020 property bool shown: shown_ 0021 property bool animated: animated_ 0022 property alias image: image 0023 property alias colorChar: colorChar 0024 width: 1 0025 height: width 0026 0027 Rectangle { 0028 visible: !token.shown || token.content === Activity.emptyToken 0029 color: "#40373737" 0030 anchors.centerIn: parent 0031 width: image.width 0032 height: width 0033 radius: parent.height * 0.1 0034 } 0035 0036 Image { 0037 id: image 0038 visible: shown 0039 anchors.centerIn: parent 0040 width: parent.width * 0.9 0041 height: width 0042 sourceSize.width: width 0043 sourceSize.height: height 0044 Image { 0045 id: colorChar 0046 visible: shown 0047 anchors.centerIn: parent 0048 width: parent.width * 0.5 0049 height: width 0050 sourceSize.width: width 0051 sourceSize.height: height 0052 } 0053 } 0054 states: [ 0055 State { 0056 name: "fade" 0057 PropertyChanges { 0058 target: image 0059 opacity: 0.0 0060 } 0061 } 0062 ] 0063 transitions: [ 0064 Transition { 0065 to: "fade" 0066 SequentialAnimation { 0067 alwaysRunToEnd: true 0068 NumberAnimation { target: image; property: "opacity"; to: 0.0; duration: 200 } 0069 ScriptAction { // End of cancelDrop 0070 script: { 0071 token.state = "" 0072 answerModel.setProperty(items.currentAnswer, "content_", Activity.emptyToken) 0073 Activity.initShape(answer.children[items.currentAnswer]) 0074 items.buttonsBlocked = false 0075 } 0076 } 0077 } 0078 } 0079 ] 0080 MouseArea { 0081 anchors.fill: parent 0082 enabled: clickable 0083 onClicked: Activity.tokenClicked(index, content) 0084 } 0085 onContentChanged: if (Activity.started) Activity.initShape(token) 0086 }