1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 18:52:30 +01:00
ScreenPlay/ScreenPlayUtil/qml/Shake.qml
Elias Steurer bb700780ef Move workshop qml files into ScreenPlayWorkshop
Move common qml stuff into ScreenPlayUtil
2022-04-23 14:32:36 +02:00

88 lines
1.9 KiB
QML

import QtQuick
Translate {
id: root
property int offset: 0
property int loops: 3
property int loopOffset: 1000
property SequentialAnimation shake
function start(offset = 0, loopOffset = 1000, loops = 1) {
root.offset = offset;
root.loopOffset = loopOffset;
root.loops = loops;
shake.restart();
}
shake: SequentialAnimation {
loops: root.loops
alwaysRunToEnd: true
PauseAnimation {
duration: root.offset
}
SequentialAnimation {
PropertyAnimation {
target: root
property: "x"
from: 0
to: 10
duration: 50
easing.type: Easing.InOutBounce
}
PropertyAnimation {
target: root
property: "x"
from: 10
to: -10
duration: 100
easing.type: Easing.InOutBounce
}
PropertyAnimation {
target: root
property: "x"
from: -10
to: 0
duration: 50
}
PropertyAnimation {
target: root
property: "x"
from: 0
to: 10
duration: 50
easing.type: Easing.InOutBounce
}
PropertyAnimation {
target: root
property: "x"
from: 10
to: -10
duration: 100
easing.type: Easing.InOutBounce
}
PropertyAnimation {
target: root
property: "x"
from: -10
to: 0
duration: 50
}
}
PauseAnimation {
duration: root.loopOffset
}
}
}