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
New Contributor
Posts: 3
Registered: ‎01-27-2013
My Device: BB10
My Carrier: Vodacom

Animation broken after orientation change

I have a banner which moves accross the screen periodically.

 

It works perfectly in portrait untill I tilt the phone and then it doesnt work in Landscape and if I tilt back to portrait it still doesnt work.

 

If the app is started in Landscape then the advert works perfectly in landscape untill I tilt the phone and then in portrait it no longer works.

 

So a change in orientation breaks the animation.

 

Here is my animation:

 onCreationCompleted: {
                    adAnimation.play();
                }
                animations: [
                    SequentialAnimation {
                        id: adAnimation
                        repeatCount: AnimationRepeatCount.Forever
                        animations: [
                            //Hide to load off screen
                            TranslateTransition {
                                fromX: -1000
                                toX: -1000
                            },
                            //Away Duration
                            TranslateTransition {
                                duration: 2000
                                fromX: -1000
                                toX: -1000
                            },
                            //Apear
                            TranslateTransition {
                                duration: 5000
                                fromX: -1000
                                toX: 0
                                easingCurve: StockCurve.BackInOut
                            },
                            //Display
                            TranslateTransition {
                                duration: 10000
                                fromX: 0
                                toX: 0
                            },
                            //Disapear
                            TranslateTransition {
                                duration: 2000
                                fromX: 0
                                toX: 1000
                                easingCurve: StockCurve.InCirc
                            }
                        ]
                    }
                ]

 

and here is the orientation hander I've been experimenting with:

OrientationHandler {
                        onOrientationAboutToChange: {
                            adAnimation.stop();
                            //delay(500);
                            //adAnimation.resetTarget();
                            adAnimation.play();
                        }
                    }

 

All this happens inside a container within a docklayout outer container.

 

Some advise on getting animations to restart/reset/resume after an orientation change would be appriciated.

 

Regards

 

Dan