1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtQml module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
46 width: 775; height: 550
50 var str = n.toPrecision(3);
51 while (str.length > 1 && (str[str.length - 1] == "0" || str[str.length - 1] == "."))
52 str = str.substr(0, str.length - 1);
56 function updateEasing() {
57 var ini = Math.min(100, Math.max(0, Number(in_inf.text)));
58 var outi = Math.min(100, Math.max(0, Number(out_inf.text)));
60 var ins = Number(in_slope.text);
61 var outs = Number(out_slope.text);
63 var p1 = [ (ini / 100), (ini / 100) * ins ];
64 var p2 = [ 1 - (outi / 100), 1 - (outi / 100) * outs ];
66 text.text = "[ " + precision(p1[0]) + ", " + precision(p1[1]) + ", " + precision(p2[0]) + ", " + precision(p2[1]) + ", 1, 1 ]";
71 width: 500; height: 500
73 border.color: "lightsteelblue"
81 anchors.centerIn: parent
82 width: parent.width - 10
83 height: parent.height - 10
86 easing.bezierCurve: eval(text.text)
92 text: "<u>After Effects curve</u>"
93 anchors.horizontalCenter: text.horizontalCenter
94 anchors.bottom: column.top
95 anchors.bottomMargin: 14
102 anchors.right: parent.right
103 anchors.rightMargin: 25
108 name: "Input influence:"
110 anchors.right: parent.right
111 KeyNavigation.tab: in_slope
112 KeyNavigation.backtab: text
113 onTextChanged: updateEasing();
119 anchors.right: parent.right
120 KeyNavigation.tab: out_inf
121 KeyNavigation.backtab: in_inf
122 onTextChanged: updateEasing();
126 name: "Output influence:"
128 anchors.right: parent.right
129 KeyNavigation.tab: out_slope
130 KeyNavigation.backtab: in_slope
131 onTextChanged: updateEasing();
135 name: "Output slope:"
137 anchors.right: parent.right
138 KeyNavigation.tab: text
139 KeyNavigation.backtab: out_info
140 onTextChanged: updateEasing();
145 text: "<u>QML Bezier curve</u>"
146 anchors.horizontalCenter: text.horizontalCenter
147 anchors.bottom: text.top
148 anchors.bottomMargin: 10
159 width: parent.width + 4
160 height: parent.height + 4
162 border.color: text.activeFocus?"green":"lightgreen"
170 anchors.top: column.bottom
171 anchors.topMargin: 50
172 anchors.right: column.right
173 KeyNavigation.tab: in_inf
174 KeyNavigation.backtab: out_slope
179 anchors.left: text.left
180 anchors.top: text.bottom
181 anchors.topMargin: 35
187 width: 50; height: 50
190 NumberAnimation on x {
204 animation.to = text.width - rect.width;
213 anchors.centerIn: parent
218 Component.onCompleted: updateEasing();