PDA

View Full Version : image source changes in animation



vinayaka
27th September 2011, 09:31
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";

}


}
}


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 .