Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 188
Registered: ‎09-03-2012
My Device: Blackberry 10
Accepted Solution

RotateTransition - How to reset and re-play everytime on touch?

I have a simple container with on touch event that should trigger rotate transition. However, it works only once upon touch. The second time I clicked on the container, it doesn't do anything.

 

If you could help, I would really appreciate it. Thanks!

 

Container {
                id: testContainer
                leftPadding: 10.0
                background: Color.DarkGray
                minHeight: 500
                minWidth: display2.pixelSize.width
                layout: DockLayout {

                }
                animations: [
                    RotateTransition {
                        id: rotateAnimation
                        toAngleZ: 360
                        duration: 1000
                    }
                ]

                onTouch: {
                    if (event.touchType != TouchType.Up) {
                        return;
                    }
                    rotateAnimation.play();
                }
                
            } // end container

Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: RotateTransition - How to reset and re-play everytime on touch?

[ Edited ]

Just also set the fromAngleZ property to 0 . So if you call play() it will start again from 0 to 360

RotateTransition {
    id: rotateAnimation
    fromAngleZ: 0
    toAngleZ: 360
    duration: 1000
}

 Hope it helps Smiley Wink



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Developer
Posts: 188
Registered: ‎09-03-2012
My Device: Blackberry 10

Re: RotateTransition - How to reset and re-play everytime on touch?

Thanks!

 

It works very well Smiley Very Happy