• Skip to content
  • Skip to link menu
KDE API Documentation - Balloon.qml Source File (GCompris-qt)
  • KDE Home
  • Contact Us
 

GCompris-qt

  • src
  • core
Balloon.qml
1 /* GCompris - Balloon.qml
2  *
3  * Copyright (C) 2014 Aruna Sankaranarayanan <arunasank@src.gnome.org>
4  *
5  * Authors:
6  * Aruna Sankaranarayanan <arunasank@src.gnome.org>
7  * Bruno Coudoin <bruno.coudoin@gcompris.net> Improved Animation
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 import QtQuick 2.1
24 import GCompris 1.0
25 
26 Image {
27  id: balloon
28  source: "qrc:/gcompris/src/core/resource/tuxballoon.svg";
29  sourceSize.width: parent.width * 0.4
30  scale: 0.8
31  x: parent.width / 2
32  y: - balloon.height
33  property int parentHeight: parent.height
34  signal timeout
35  signal ready
36 
37  property int duration
38  property bool disabled
39 
40  onParentHeightChanged: startMoving(duration)
41 
42  function startMoving(durationIncoming)
43  {
44  stopMoving()
45  disabled = false
46  duration = durationIncoming
47  down.restart()
48  }
49 
50  function stopMoving()
51  {
52  disabled = true
53  reinit.start()
54  down.stop()
55  }
56 
57  ParallelAnimation {
58  id: reinit
59  running: false
60  NumberAnimation {
61  target: balloon
62  property: "scale"
63  to: 0.8
64  duration: 1000
65  }
66  NumberAnimation {
67  target: balloon
68  property: "y"
69  to: - balloon.height
70  duration: 1000
71  easing.type: Easing.InOutQuad
72  }
73  NumberAnimation {
74  target: balloon
75  property: "rotation"
76  to: 0
77  duration: 1000
78  easing.type: Easing.InOutQuad
79  }
80  }
81 
82  SequentialAnimation {
83  id: down
84 
85  onRunningChanged: {
86  if (!down.running && !balloon.disabled) {
87  timeout()
88  }
89  }
90 
91  ParallelAnimation {
92 
93  NumberAnimation {
94  target: balloon
95  property: "scale"
96  to: 0.8
97  duration: 1000
98  }
99  NumberAnimation {
100  target: balloon
101  property: "y"
102  to: - balloon.height
103  duration: 1000
104  easing.type: Easing.InOutQuad
105  }
106  NumberAnimation {
107  target: balloon
108  property: "rotation"
109  to: 0
110  duration: 1000
111  easing.type: Easing.InOutQuad
112  }
113  }
114 
115  ParallelAnimation {
116  running: false
117  NumberAnimation {
118  target: balloon
119  property: "scale"
120  to: 1
121  duration: balloon.duration
122  }
123  NumberAnimation {
124  target: balloon
125  property: "y"
126  to: parent.height - balloon.height
127  duration: balloon.duration
128  easing.type: Easing.InOutQuad
129  }
130  SequentialAnimation {
131  NumberAnimation {
132  target: balloon
133  property: "rotation"
134  to: -5
135  duration: 3000
136  easing.type: Easing.InOutQuad
137  }
138  SequentialAnimation {
139  loops: 1
140  NumberAnimation {
141  target: balloon
142  property: "rotation"
143  from: -5; to: 5
144  duration: 3000
145  easing.type: Easing.InOutQuad
146  }
147  NumberAnimation {
148  target: balloon
149  property: "rotation"
150  from: 5; to: -5
151  duration: 3000
152  easing.type: Easing.InOutQuad }
153  }
154  NumberAnimation {
155  target: balloon
156  property: "rotation"
157  to: 0
158  duration: 3000
159  easing.type: Easing.InOutQuad
160  }
161  }
162  }
163  }
164 }
QtQuick
GCompris
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Tue Jun 2 2015 21:47:47 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

GCompris-qt

Skip menu "GCompris-qt"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Modules

Class Picker

Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal