@@ -8,7 +8,7 @@ Item {
88 Label {
99 anchors {left: parent.left; top: parent.top }
1010 text: "prog:" + transitionCurve.progress.toFixed(2)
11− color: isInLeftFoldingArea ? "red" : "black"
11+ color: leftFoldingAreaProgress > 0 || rightFoldingAreaProgress > 0 ? "red" : "black"
1212 }
1313
1414 id: root
@@ -20,7 +20,7 @@ Item {
2020 property int margins: units.gu(5)
2121 property int foldingAreaWidth: units.gu(10)
2222
23− property int maxVisibleItems: 5
23+ property int maxVisibleItems: 10
2424
2525 readonly property int flickableWidth: flickable ? flickable.width : 0
2626 readonly property int flickableContentWidth: flickable ? flickable.contentWidth: 0
@@ -32,8 +32,8 @@ Item {
3232
3333 // Internal
3434 readonly property real progressSlice: 1 / totalItems;
35− readonly property real startProgress: (index - 2) * progressSlice
36− readonly property real endProgress: (index + 3) * progressSlice
35+ readonly property real startProgress: (index - maxVisibleItems/2) * progressSlice
36+ readonly property real endProgress: (index + maxVisibleItems/2) * progressSlice
3737
3838// readonly property real startX: index < maxVisibleItems ?
3939// margins + index * unfoldedDistance
@@ -53,17 +53,24 @@ Item {
5353 return sceneHeight - itemHeight - (sceneHeight * 0.2);
5454 }
5555
56− property int leftEndFoldedAngle: 80
57− property int rightEndFoldedAngle: 60
56+ property int leftEndFoldedAngle: 70
57+ property int rightEndFoldedAngle: 65
5858 property int unfoldedAngle: 30
5959
60− property bool isInLeftFoldingArea: animatedX < foldingAreaWidth + margins
60+ // faw : 1 = x : p
61+ property real leftFoldingAreaProgress: (foldingAreaWidth + margins - animatedX) / foldingAreaWidth
62+ property real rightFoldingAreaProgress: (animatedX + margins*2 - contentWidth) / foldingAreaWidth
6163
62− // x : foldingAreaWidth = leftEndFoldedAngle: unfoldedAngle:
6364
64− readonly property int animatedAngle: isInLeftFoldingArea ?
65− ((foldingAreaWidth + margins) - x) * unfoldedAngle / leftEndFoldedAngle
66− : unfoldedAngle
65+ // x : foldingAreaWidth = leftEndFoldedAngle: unfoldedAngle
66+
67+ readonly property int animatedAngle: leftFoldingAreaProgress > 0 ?
68+ linearAnimation(0, 1, unfoldedAngle, leftEndFoldedAngle, leftFoldingAreaProgress)
69+ : rightFoldingAreaProgress > 0 ?
70+ linearAnimation(0, 1, unfoldedAngle, rightEndFoldedAngle, rightFoldingAreaProgress)
71+ : unfoldedAngle
72+
73+ onAnimatedAngleChanged: if (index == 10) print("**** animated angle", animatedAngle, rightFoldingAreaProgress)
6774
6875
6976 function desktopScale(sceneHeight, itemHeight) {
@@ -78,6 +85,11 @@ Item {
7885 return true;
7986 }
8087
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;
91+ }
92+
8193 EasingCurve {
8294 id: transitionCurve
8395 type: EasingCurve.InOutSine