Warning, /education/gcompris/src/activities/family/Node.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - Node.qml
0002 *
0003 * SPDX-FileCopyrightText: 2016 Rajdeep Kaur <rajdeep.kaur@kde.org>
0004 *
0005 * Authors:
0006 *
0007 * Rajdeep Kaur <rajdeep.kaur@kde.org>
0008 * Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
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 "family.js" as Activity
0017
0018 Item {
0019 id: node
0020 property int nodeWidth
0021 property int nodeHeight
0022 property string nodeImageSource
0023 property string borderColor
0024 property real borderWidth
0025 property string color
0026 property real radius
0027 property int weight
0028
0029 function changeState(state_) {
0030 currentPointer.state = state_
0031 }
0032
0033 Rectangle {
0034 id: content
0035 color: node.color
0036 width: 0.8 * nodeWidth
0037 height: 0.8 * nodeHeight
0038 border.color: borderColor
0039 border.width: borderWidth
0040 radius: node.radius
0041
0042 Image {
0043 id: nodeImage
0044 source: nodeImageSource
0045 anchors.horizontalCenter: parent.horizontalCenter
0046 anchors.verticalCenter: parent.verticalCenter
0047 width: parent.width * 0.8
0048 height: parent.height * 0.8
0049 sourceSize.width: width
0050 sourceSize.height: height
0051
0052 SequentialAnimation {
0053 id: activeAnimation
0054 running: currentPointer.state === "active" || currentPointer.state === "activeTo"
0055 loops: Animation.Infinite
0056 alwaysRunToEnd: true
0057 NumberAnimation {
0058 target: nodeImage
0059 property: "rotation"
0060 from: 0; to: 10
0061 duration: 200
0062 easing.type: Easing.OutQuad
0063 }
0064 NumberAnimation {
0065 target: nodeImage
0066 property: "rotation"
0067 from: 10; to: -10
0068 duration: 400
0069 easing.type: Easing.InOutQuad
0070 }
0071 NumberAnimation {
0072 target: nodeImage
0073 property: "rotation"
0074 from: -10; to: 0
0075 duration: 200
0076 easing.type: Easing.InQuad
0077 }
0078 }
0079 }
0080
0081 MouseArea {
0082 visible: activity.mode == "find_relative" ? true : false
0083 anchors.fill: parent
0084 onClicked: selectedPairs.selectNode(currentPointer)
0085 }
0086 }
0087 }