easingCurve QML Value Type
Valor que representa uma curva de atenuação. Mais...
| Import Statement: | import QtQml |
| Since: | Qt 6.11 |
Descrição detalhada
O tipo ` easingCurve ` é um valor com atributos que definem uma curva de aceleração/deceleração ( easing curve):
enumeration typereal amplitudereal overshootreal periodlist<real> bezierCurve
É útil ao criar animações personalizadas com ` FrameAnimation`, por exemplo, ou em qualquer caso de uso que exija a aceleração ou desaceleração de um valor ao longo de uma determinada curva.
Para criar um valor easingCurve, atribua um tipo de suavização:
readonly property easingCurve inQuartCurve: Easing.InQuartO exemplo a seguir é semelhante ao descrito na documentação de ` Easing`:
Rectangle {
id: rect
width: 100
height: 100
anchors.centerIn: parent
color: "red"
opacity: 0
}
FrameAnimation {
id: frameAnimation
running: true
property real elapsed // In seconds.
readonly property real duration: 2 // Two seconds.
readonly property easingCurve inQuartCurve: Easing.InQuart
onTriggered: {
elapsed += frameTime
// Loop once we reach the duration.
if (elapsed > duration)
elapsed = 0
// Increase the opacity from 0 slowly at first, then quickly.
rect.opacity = inQuartCurve.valueForProgress(elapsed / duration)
}
}Como ` easingCurve ` é um tipo ` structured value `, ele pode ser construído com um objeto JavaScript:
readonly property easingCurve inElasticCurve: ({
type: Easing.InElastic,
amplitude: 4,
period: 3
})Ao integrar com C++, observe que qualquer valor ` QEasingCurve ` passado para o QML a partir do C++ é automaticamente convertido em um valor ` easingCurve `. Quando um valor ` easingCurve ` é passado para o C++, ele é automaticamente convertido em um valor ` QEasingCurve `.
Um ` easingCurve ` construído por padrão é igual a ` new QtQml.easingCurve(QtQml.Easing.Linear)`.
Veja também Tipos de valor QML.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.