Anbu Raj
Anbu Raj

Reputation: 841

Titanium Flip animation for Android

I have superview (flashcardView ), i added the two subviews(frontView and backView) to this view. If user tap the any one of the view it flip and shows the other view. I am using the following code for achieve this functionality.

frontView.addEventListener('click', function(e) {

            var animation = require('alloy/animation');

            animation.flip( frontView,backView, 'horizontal',500, function(){
                    });

        });

backView.addEventListener('click', function(e) {

             var animation = require('alloy/animation');

                animation.flip( backView,frontView, 'horizontal',500, function(){
            });

This code is only working in iOS devices. It is not working in Android devices. Pls suggest me to do the flip animation for Android.

Upvotes: 0

Views: 470

Answers (1)

Robin Ellerkmann
Robin Ellerkmann

Reputation: 2113

In Titanium available animations depend on the system (iOS or Android) you use. Therefore the code you use is only working for iOS. As far as I know there is no built-in flip animation for Android. But there is a solution by another user he gave in this answer.

Here is the code he uses:

var anim_minimize = Titanium.UI.createAnimation({width:0,duration:500});
var anim_maximize = Titanium.UI.createAnimation({width:320,duration:500});

tabGroup.animate(anim_minimize);

setTimeout(function(){

tabGroup.animate(anim_maximize);

},500);

Basically he creates the views next to each other and uses another animation which should look the same as a flip animation.

Another option you could try is using a module such as Flipium.

Upvotes: 0

Related Questions