summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp
blob: e0be0c3d9a738bf8a04584fc9f90b1986c40ec39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

//! [typedef]
qreal myEasingFunction(qreal progress);
//! [typedef]

//! [0]
    QEasingCurve easing(QEasingCurve::InOutQuad);

    for (qreal t = 0.0; t < 1.0; t += 0.1)
        qWarning() << "Effective progress" << t << "is"
                   << easing.valueForProgress(t);
//! [0]

//! [1]
    QPropertyAnimation animation;
    animation.setStartValue(0);
    animation.setEndValue(1000);
    animation.setDuration(1000);
    animation.setEasingCurve(QEasingCurve::InOutQuad);
//! [1]