@@ -8,7 +8,7 @@ Item {
9 anchors {left: parent.left; top: parent.top }
9 anchors {left: parent.left; top: parent.top }
10 text: "prog:" + transitionCurve.progress.toFixed(2)
10 text: "prog:" + transitionCurve.progress.toFixed(2)
11− color: isInLeftFoldingArea ? "red" : "black"
11+ color: leftFoldingAreaProgress > 0 || rightFoldingAreaProgress > 0 ? "red" : "black"
@@ -20,7 +20,7 @@ Item {
20 property int margins: units.gu(5)
20 property int margins: units.gu(5)
21 property int foldingAreaWidth: units.gu(10)
21 property int foldingAreaWidth: units.gu(10)
23− property int maxVisibleItems: 5
23+ property int maxVisibleItems: 10
25 readonly property int flickableWidth: flickable ? flickable.width : 0
25 readonly property int flickableWidth: flickable ? flickable.width : 0
26 readonly property int flickableContentWidth: flickable ? flickable.contentWidth: 0
26 readonly property int flickableContentWidth: flickable ? flickable.contentWidth: 0
@@ -32,8 +32,8 @@ Item {
33 // Internal
33 // Internal
34 readonly property real progressSlice: 1 / totalItems;
34 readonly property real progressSlice: 1 / totalItems;
35− readonly property real startProgress: (index - 2) * progressSlice
35+ readonly property real startProgress: (index - maxVisibleItems/2) * progressSlice
36− readonly property real endProgress: (index + 3) * progressSlice
36+ readonly property real endProgress: (index + maxVisibleItems/2) * progressSlice
38// readonly property real startX: index < maxVisibleItems ?
38// readonly property real startX: index < maxVisibleItems ?
39// margins + index * unfoldedDistance
39// margins + index * unfoldedDistance
@@ -53,17 +53,24 @@ Item {
53 return sceneHeight - itemHeight - (sceneHeight * 0.2);
53 return sceneHeight - itemHeight - (sceneHeight * 0.2);
56− property int leftEndFoldedAngle: 80
56+ property int leftEndFoldedAngle: 70
57− property int rightEndFoldedAngle: 60
57+ property int rightEndFoldedAngle: 65
58 property int unfoldedAngle: 30
58 property int unfoldedAngle: 30
60− property bool isInLeftFoldingArea: animatedX < foldingAreaWidth + margins
61+ property real leftFoldingAreaProgress: (foldingAreaWidth + margins - animatedX) / foldingAreaWidth
62+ property real rightFoldingAreaProgress: (animatedX + margins*2 - contentWidth) / foldingAreaWidth
62− // x : foldingAreaWidth = leftEndFoldedAngle: unfoldedAngle:
65+ // x : foldingAreaWidth = leftEndFoldedAngle: unfoldedAngle
64− readonly property int animatedAngle: isInLeftFoldingArea ?
67+ readonly property int animatedAngle: leftFoldingAreaProgress > 0 ?
65− ((foldingAreaWidth + margins) - x) * unfoldedAngle / leftEndFoldedAngle
68+ linearAnimation(0, 1, unfoldedAngle, leftEndFoldedAngle, leftFoldingAreaProgress)
66− : unfoldedAngle
69+ : rightFoldingAreaProgress > 0 ?
70+ linearAnimation(0, 1, unfoldedAngle, rightEndFoldedAngle, rightFoldingAreaProgress)
73+ onAnimatedAngleChanged: if (index == 10) print("**** animated angle", animatedAngle, rightFoldingAreaProgress)
69 function desktopScale(sceneHeight, itemHeight) {
76 function desktopScale(sceneHeight, itemHeight) {
@@ -78,6 +85,11 @@ Item {
78 return true;
85 return true;
88+ function linearAnimation(startProgress, endProgress, startValue, endValue, progress) {
89+ // progress : progressDiff = value : valueDiff => value = progress * valueDiff / progressDiff
90+ return (progress - startProgress) * (endValue - startValue) / (endProgress - startProgress) + startValue;
81 EasingCurve {
93 EasingCurve {
82 id: transitionCurve
94 id: transitionCurve
83 type: EasingCurve.InOutSine
95 type: EasingCurve.InOutSine