Commit 6597e7a2 authored by Teemu Tamminen's avatar Teemu Tamminen

Added Smoother needle trails

parent 90897ccb
...@@ -29,6 +29,7 @@ Item { ...@@ -29,6 +29,7 @@ Item {
target: main target: main
from: 5 from: 5
to: 15 to: 15
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "rpm" property: "rpm"
...@@ -36,6 +37,7 @@ Item { ...@@ -36,6 +37,7 @@ Item {
target: main target: main
from: 1500 from: 1500
to: 3800 to: 3800
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -52,6 +54,7 @@ Item { ...@@ -52,6 +54,7 @@ Item {
target: main target: main
from: 3800 from: 3800
to: 2000 to: 2000
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "speed" property: "speed"
...@@ -59,6 +62,7 @@ Item { ...@@ -59,6 +62,7 @@ Item {
target: main target: main
from: 15 from: 15
to: 10 to: 10
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -69,6 +73,7 @@ Item { ...@@ -69,6 +73,7 @@ Item {
target: main target: main
from: 10 from: 10
to: 35 to: 35
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "rpm" property: "rpm"
...@@ -76,6 +81,7 @@ Item { ...@@ -76,6 +81,7 @@ Item {
target: main target: main
from: 2000 from: 2000
to: 4200 to: 4200
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -92,6 +98,7 @@ Item { ...@@ -92,6 +98,7 @@ Item {
target: main target: main
from: 4200 from: 4200
to: 2400 to: 2400
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "speed" property: "speed"
...@@ -99,6 +106,7 @@ Item { ...@@ -99,6 +106,7 @@ Item {
target: main target: main
from: 35 from: 35
to: 30 to: 30
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -109,6 +117,7 @@ Item { ...@@ -109,6 +117,7 @@ Item {
target: main target: main
from: 30 from: 30
to: 65 to: 65
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "rpm" property: "rpm"
...@@ -116,6 +125,7 @@ Item { ...@@ -116,6 +125,7 @@ Item {
target: main target: main
from: 2400 from: 2400
to: 4600 to: 4600
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -132,6 +142,7 @@ Item { ...@@ -132,6 +142,7 @@ Item {
target: main target: main
from: 4600 from: 4600
to: 2400 to: 2400
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "speed" property: "speed"
...@@ -139,6 +150,7 @@ Item { ...@@ -139,6 +150,7 @@ Item {
target: main target: main
from: 65 from: 65
to: 60 to: 60
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -149,6 +161,7 @@ Item { ...@@ -149,6 +161,7 @@ Item {
target: main target: main
from: 60 from: 60
to: 95 to: 95
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "rpm" property: "rpm"
...@@ -156,6 +169,7 @@ Item { ...@@ -156,6 +169,7 @@ Item {
target: main target: main
from: 2400 from: 2400
to: 4800 to: 4800
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -172,6 +186,7 @@ Item { ...@@ -172,6 +186,7 @@ Item {
target: main target: main
from: 4800 from: 4800
to: 2400 to: 2400
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "speed" property: "speed"
...@@ -179,6 +194,7 @@ Item { ...@@ -179,6 +194,7 @@ Item {
target: main target: main
from: 95 from: 95
to: 90 to: 90
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -189,6 +205,7 @@ Item { ...@@ -189,6 +205,7 @@ Item {
target: main target: main
from: 90 from: 90
to: 130 to: 130
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "rpm" property: "rpm"
...@@ -196,6 +213,7 @@ Item { ...@@ -196,6 +213,7 @@ Item {
target: main target: main
from: 2400 from: 2400
to: 5200 to: 5200
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -212,6 +230,7 @@ Item { ...@@ -212,6 +230,7 @@ Item {
target: main target: main
from: 5200 from: 5200
to: 6200 to: 6200
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "speed" property: "speed"
...@@ -219,6 +238,7 @@ Item { ...@@ -219,6 +238,7 @@ Item {
target: main target: main
from: 130 from: 130
to: 120 to: 120
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -229,6 +249,7 @@ Item { ...@@ -229,6 +249,7 @@ Item {
target: main target: main
from: 120 from: 120
to: 60 to: 60
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "rpm" property: "rpm"
...@@ -236,6 +257,7 @@ Item { ...@@ -236,6 +257,7 @@ Item {
target: main target: main
from: 6200 from: 6200
to: 2300 to: 2300
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -252,6 +274,7 @@ Item { ...@@ -252,6 +274,7 @@ Item {
target: main target: main
from: 2300 from: 2300
to: 4000 to: 4000
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "speed" property: "speed"
...@@ -259,6 +282,7 @@ Item { ...@@ -259,6 +282,7 @@ Item {
target: main target: main
from: 60 from: 60
to: 50 to: 50
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -269,6 +293,7 @@ Item { ...@@ -269,6 +293,7 @@ Item {
target: main target: main
from: 50 from: 50
to: 20 to: 20
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "rpm" property: "rpm"
...@@ -276,6 +301,7 @@ Item { ...@@ -276,6 +301,7 @@ Item {
target: main target: main
from: 4000 from: 4000
to: 2300 to: 2300
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -292,6 +318,7 @@ Item { ...@@ -292,6 +318,7 @@ Item {
target: main target: main
from: 2300 from: 2300
to: 4000 to: 4000
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "speed" property: "speed"
...@@ -299,6 +326,7 @@ Item { ...@@ -299,6 +326,7 @@ Item {
target: main target: main
from: 20 from: 20
to: 15 to: 15
easing.type: Easing.InOutQuad;
} }
} }
ParallelAnimation { ParallelAnimation {
...@@ -309,6 +337,7 @@ Item { ...@@ -309,6 +337,7 @@ Item {
target: main target: main
from: 15 from: 15
to: 5 to: 5
easing.type: Easing.InOutQuad;
} }
PropertyAnimation { PropertyAnimation {
property: "rpm" property: "rpm"
...@@ -316,6 +345,7 @@ Item { ...@@ -316,6 +345,7 @@ Item {
target: main target: main
from: 4000 from: 4000
to: 1500 to: 1500
easing.type: Easing.InOutQuad;
} }
} }
} }
......
...@@ -26,8 +26,8 @@ Window { ...@@ -26,8 +26,8 @@ Window {
property real toptextoffset: 0.0 property real toptextoffset: 0.0
property bool rpmForward: true property bool rpmForward: true
property bool speedForward: true property bool speedForward: true
property int rpmTrailOpacity: 100 property real rpmTrailOpacity: 0
property int speedTrailOpacity: 100 property real speedTrailOpacity: 0
property real roadSpeed: sim.roadSpeed * (sim.gear * 2) property real roadSpeed: sim.roadSpeed * (sim.gear * 2)
// telltales // telltales
property bool leftblinker: false property bool leftblinker: false
...@@ -44,17 +44,26 @@ Window { ...@@ -44,17 +44,26 @@ Window {
readonly property int secondsBetweenUpdates: 60 // Use a 1 minute average for the average FPS counter readonly property int secondsBetweenUpdates: 60 // Use a 1 minute average for the average FPS counter
onRpmrotationChanged: { onRpmrotationChanged: {
if (rpmrotation < previousrpmrotation)
if (rpmrotation < previousrpmrotation) {
rpmForward = false; rpmForward = false;
else rpmTrailOpacity = 2 * (previousrpmrotation - rpmrotation);
}
else {
rpmForward = true; rpmForward = true;
rpmTrailOpacity = -2 * (previousrpmrotation - rpmrotation);
}
previousrpmrotation = rpmrotation; previousrpmrotation = rpmrotation;
} }
onSpeedrotationChanged: { onSpeedrotationChanged: {
if (speedrotation < previousspeedrotation) if (speedrotation < previousspeedrotation) {
speedForward = false; speedForward = false;
else speedTrailOpacity = 2 * (previousspeedrotation - speedrotation);
}
else {
speedForward = true; speedForward = true;
speedTrailOpacity = -2 * (previousspeedrotation - speedrotation);
}
previousspeedrotation = speedrotation; previousspeedrotation = speedrotation;
} }
onFrameSwapped: { onFrameSwapped: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment