From e1082a3a3f4a849c64917edd66f088078f1f9d62 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Wed, 18 Jul 2018 14:06:04 +0200 Subject: [PATCH] fixed the but that made a negative time appear at the start added or slowed down animations --- FadeAnimation.qml | 32 +++ android-sources/AndroidManifest.xml | 2 +- main.qml | 26 +- qml.qrc | 1 + speedclimbing_stopwatch.pro.user | 399 +++++++++++++++++++++++++--- 5 files changed, 420 insertions(+), 40 deletions(-) create mode 100644 FadeAnimation.qml diff --git a/FadeAnimation.qml b/FadeAnimation.qml new file mode 100644 index 0000000..46af6f7 --- /dev/null +++ b/FadeAnimation.qml @@ -0,0 +1,32 @@ +import QtQuick 2.0 + +SequentialAnimation { + id: root + property QtObject target + property string fadeProperty: "scale" + property int fadeDuration: 150 + property int fadeDuration_in: fadeDuration + property int fadeDuration_out: fadeDuration + property alias outValue: outAnimation.to + property alias inValue: inAnimation.to + property alias outEasingType: outAnimation.easing.type + property alias inEasingType: inAnimation.easing.type + property string easingType: "Quad" + NumberAnimation { // in the default case, fade scale to 0 + id: outAnimation + target: root.target + property: root.fadeProperty + duration: root.fadeDuration_in + to: 0 + easing.type: Easing["In"+root.easingType] + } + PropertyAction { } // actually change the property targeted by the Behavior between the 2 other animations + NumberAnimation { // in the default case, fade scale back to 1 + id: inAnimation + target: root.target + property: root.fadeProperty + duration: root.fadeDuration_out + to: 1 + easing.type: Easing["Out"+root.easingType] + } +} diff --git a/android-sources/AndroidManifest.xml b/android-sources/AndroidManifest.xml index dec7ea3..f4a90c4 100644 --- a/android-sources/AndroidManifest.xml +++ b/android-sources/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/main.qml b/main.qml index 9bf687c..b2d078c 100644 --- a/main.qml +++ b/main.qml @@ -7,7 +7,7 @@ Window { visible: true width: 540 height: 960 - title: qsTr("speedclimbing stw") + title: qsTr("Speedclimbing stw") property date currentTime: new Date() property int millis: 0 @@ -108,6 +108,7 @@ Window { break case "RUNNING": root.stoppedTime = new Date().getTime() - root.startTime + time.text = ( root.stoppedTime / 1000 ).toFixed(3) + " sec" root.state = "STOPPED" break case "STOPPED": @@ -124,7 +125,7 @@ Window { //state for the start page PropertyChanges { target: time; text: "Click start to start"; font.pixelSize: parent.height * 0.3 } PropertyChanges { target: time_container; height: parent.height * 0.15 } - PropertyChanges { target: startButt; enabled: true; text: "start"; height: parent.height - (parent.height * 0.5); anchors.bottomMargin: parent.height * 0.5 - startButt.height * 0.5 } + PropertyChanges { target: startButt; enabled: true; text: "start"; height: parent.height - (parent.height * 0.5); anchors.bottomMargin: parent.height * 0.5 - height * 0.5 } }, State { name: "STARTING" @@ -144,19 +145,28 @@ Window { name: "STOPPED" //state when the meassuring is over PropertyChanges { target: time; text: ( root.stoppedTime / 1000 ).toFixed(3) + " sec"; font.pixelSize: parent.height * 0.1 } - PropertyChanges { target: startButt; enabled: true; text: "reset"; height: parent.height - (parent.height * 0.8); anchors.bottomMargin: parent.height * 0.2 - startButt.height * 0.5 } + PropertyChanges { target: startButt; enabled: true; text: "reset"; height: parent.height - (parent.height * 0.8); anchors.bottomMargin: parent.height * 0.2 - height * 0.5 } PropertyChanges { target: time_container; height: parent.height * 0.8 } } ] transitions: [ Transition { - NumberAnimation { properties: "height"; easing.type: Easing.InOutQuad; duration: 200 } - NumberAnimation { properties: "bottomMargin"; easing.type: Easing.InOutQuad; duration: 200 } - NumberAnimation { properties: "font.pixelSize"; easing.type: Easing.InOutQuad; duration: 200 } + NumberAnimation { properties: "height,bottomMargin,font.pixelSize"; easing.type: Easing.InOutQuad; duration: 700 } + FadeAnimation { target: time; fadeDuration_in: 0; fadeDuration_out: 0 } }, Transition { - to: "moveIn" - NumberAnimation { properties: "height"; easing.type: Easing.InOutQuad; duration: 200 } + to: "STOPPED" + NumberAnimation { properties: "height,bottomMargin,font.pixelSize"; easing.type: Easing.InOutQuad; duration: 700 } + }, + Transition { + to: "IDLE" + NumberAnimation { properties: "height,bottomMargin,font.pixelSize"; easing.type: Easing.InOutQuad; duration: 700 } + FadeAnimation { target: time; fadeDuration_out: 1000; fadeDuration_in: 0} + }, + + Transition { + to: "RUNNING" + //disable transitions for the RUNNING state } ] } diff --git a/qml.qrc b/qml.qrc index 5f6483a..11e786b 100644 --- a/qml.qrc +++ b/qml.qrc @@ -1,5 +1,6 @@ main.qml + FadeAnimation.qml diff --git a/speedclimbing_stopwatch.pro.user b/speedclimbing_stopwatch.pro.user index 79bee9e..c6d36d5 100644 --- a/speedclimbing_stopwatch.pro.user +++ b/speedclimbing_stopwatch.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {a7af30b9-cb0f-45fd-9894-328c8b8b2887} + {21eb7c7e-fe37-4955-bdba-642d7341ba98} ProjectExplorer.Project.ActiveTarget @@ -59,14 +59,14 @@ ProjectExplorer.Project.Target.0 - Desktop Qt 5.10.1 MinGW 32bit - Desktop Qt 5.10.1 MinGW 32bit - qt.qt5.5101.win32_mingw53_kit - 0 + Android for armeabi-v7a (GCC 4.9, Qt 5.11.1 for Android armv7) + Android for armeabi-v7a (GCC 4.9, Qt 5.11.1 for Android armv7) + {90080436-d11a-44c6-8604-3a0027d99b29} + 1 0 0 - D:/Documents/Git/build-speedclimbing_stopwatch-Desktop_Qt_5_10_1_MinGW_32bit-Debug + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Debug true @@ -84,13 +84,32 @@ Make Qt4ProjectManager.MakeStep - + + -w + -r + false - 2 - Erstellen + + true + Copy application data + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-27 + + true + Build Android APK + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build ProjectExplorer.BuildSteps.Build @@ -100,13 +119,16 @@ Make Qt4ProjectManager.MakeStep - + + -w + -r + true clean 1 - Bereinigen + Clean ProjectExplorer.BuildSteps.Clean @@ -120,7 +142,7 @@ true - D:/Documents/Git/build-speedclimbing_stopwatch-Desktop_Qt_5_10_1_MinGW_32bit-Release + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Release true @@ -131,20 +153,39 @@ false false - false + true + true + Copy application data + + Qt4ProjectManager.AndroidPackageInstallationStep + + true Make Qt4ProjectManager.MakeStep - + + -w + -r + false - 2 - Erstellen + + android-27 + /home/dorian/Documents/climbing_normspeed_stopwatch/climbing_normspeed_stopwatch/android_release.keystore + true + Build Android APK + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build ProjectExplorer.BuildSteps.Build @@ -154,13 +195,16 @@ Make Qt4ProjectManager.MakeStep - + + -w + -r + true clean 1 - Bereinigen + Clean ProjectExplorer.BuildSteps.Clean @@ -174,7 +218,7 @@ true - D:/Documents/Git/build-speedclimbing_stopwatch-Desktop_Qt_5_10_1_MinGW_32bit-Profile + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Profile true @@ -185,20 +229,39 @@ false true - false + true true Make Qt4ProjectManager.MakeStep - + + -w + -r + false - 2 - Erstellen + + true + Copy application data + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-27 + + true + Build Android APK + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build ProjectExplorer.BuildSteps.Build @@ -208,13 +271,287 @@ Make Qt4ProjectManager.MakeStep - + + -w + -r + true clean 1 - Bereinigen + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + + true + Deploy to Android device + + Qt4ProjectManager.AndroidDeployQtStep + false + + 1 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy to Android device + + Qt4ProjectManager.AndroidDeployConfiguration2 + + 1 + + MWS0216A15001488 + 24 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + + + speedclimbing_stopwatch + speedclimbing_stopwatch + Qt4ProjectManager.AndroidRunConfiguration:/home/dorian/Documents/climbing_normspeed_stopwatch/climbing_normspeed_stopwatch/speedclimbing_stopwatch.pro + speedclimbing_stopwatch.pro + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop Qt 5.11.1 GCC 64bit + Desktop Qt 5.11.1 GCC 64bit + qt.qt5.5111.gcc_64_kit + 0 + 0 + 0 + + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Desktop_Qt_5_11_1_GCC_64bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Desktop_Qt_5_11_1_GCC_64bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Desktop_Qt_5_11_1_GCC_64bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean ProjectExplorer.BuildSteps.Clean @@ -231,12 +568,12 @@ 0 - Deployment + Deploy ProjectExplorer.BuildSteps.Deploy 1 - Deployment-Konfiguration + Deploy Configuration ProjectExplorer.DefaultDeployConfiguration @@ -286,13 +623,13 @@ speedclimbing_stopwatch - Qt4ProjectManager.Qt4RunConfiguration:D:/Documents/Git/speedclimbing_stopwatch/speedclimbing_stopwatch.pro + Qt4ProjectManager.Qt4RunConfiguration:/home/dorian/Documents/climbing_normspeed_stopwatch/climbing_normspeed_stopwatch/speedclimbing_stopwatch.pro true speedclimbing_stopwatch.pro false - D:/Documents/Git/build-speedclimbing_stopwatch-Desktop_Qt_5_10_1_MinGW_32bit-Debug + /home/dorian/Documents/climbing_normspeed_stopwatch/build-climbing_normspeed_stopwatch-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Release 3768 false true @@ -305,7 +642,7 @@ ProjectExplorer.Project.TargetCount - 1 + 2 ProjectExplorer.Project.Updater.FileVersion