Last active
March 23, 2018 22:52
-
-
Save kovrov/ddbfd0c06bd20e1068b1 to your computer and use it in GitHub Desktop.
Parallax in a ListView Item
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.4 | |
ListView { | |
id: list | |
width: 800 | |
height: 600 | |
orientation: Qt.Horizontal | |
model: 5 | |
snapMode: ListView.SnapOneItem | |
delegate: Rectangle { | |
id: delegate | |
width: list.width | |
height: list.height | |
color: index % 2 ? "#abc" : "#def" | |
Rectangle { | |
transform: Translate { x: (list.contentX - delegate.x) * .1 } | |
x: 250; y: 180 | |
width: 300; height: 150 | |
color: "#a98" | |
} | |
Rectangle { | |
width: 100; height: 100 | |
anchors.centerIn: parent | |
color: "#546" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment