Item{
property int type: 0
Image {
id: img
source: if(type==0) {
"pics/U_basketball.png"
} else if(type!=0)
{
"pics/U_soccerball.png"
}
anchors.fill: parent
}
Behavior on y {
SequentialAnimation {
SmoothedAnimation{ velocity: 800 }
PropertyAction { target: img; property: "source"; value:if(type == 0)
{
"pics/U_basketball_blurEffect.png";
}else if(type!=0)
{
"pics/U_soccerBall_blurEffect.png";
}
}
}
Item{
property int type: 0
Image {
id: img
source: if(type==0) {
"pics/U_basketball.png"
} else if(type!=0)
{
"pics/U_soccerball.png"
}
anchors.fill: parent
}
Behavior on y {
SequentialAnimation {
SmoothedAnimation{ velocity: 800 }
PropertyAction { target: img; property: "source"; value:if(type == 0)
{
"pics/U_basketball_blurEffect.png";
}else if(type!=0)
{
"pics/U_soccerBall_blurEffect.png";
}
}
}
To copy to clipboard, switch view to plain text mode
This is code when a ball falls on a mouseclick.At the end the balls source must change .I used PropertyAction for it. The image source changes at the end but the problem is that "else if " part is not working. The two types of ball(type 0 and 1 use the same picture )
. Is this is the right way. Please help me in this .
Bookmarks