Android Question Animate the flipping of a Label

thedesolatesoul

Expert
Licensed User
Longtime User
I will find this hard to explain.
I am trying to figure out a way to animate a label / textview (rotate across the z-axis). i.e. like it is flipping around.
To be honest, if you flip it on any axis, I am sure the code can be changed to adapt to any axis.
What I am after is I want to flip it around, and at the point where the rotation rotates the text completely out of view i.e. width = 0, then I will change the text, and the next text will animate into view.
Any ideas?
 

eps

Expert
Licensed User
Longtime User
Would it be easier to squeeze the text to zero width and then expand the new text?

Although I'm still not quite so sure how you'd do that, but I guess if you held it in a panel and reduced the width of the panel to zero and then re-expanded it again it would be quite similar?
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
In my case I was thinking of height, but same concept.
I could use the ScaleAnimation to do that, but it is not the same. The illusion of flipping comes due to a skew in text size, i.e. one side of the text is coming towards you. This means the text height/width of individual charachters will be changing along the axis.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
You can use a canvas and transformation formulae for this. I guess it may be slow, so another option is to do this letter by letter, by adjusting h/w/ts in order to give the impression of an accurate transformation.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Upvote 0

Informatix

Expert
Licensed User
Longtime User
I will find this hard to explain.
I am trying to figure out a way to animate a label / textview (rotate across the z-axis). i.e. like it is flipping around.
To be honest, if you flip it on any axis, I am sure the code can be changed to adapt to any axis.
What I am after is I want to flip it around, and at the point where the rotation rotates the text completely out of view i.e. width = 0, then I will change the text, and the next text will animate into view.
Any ideas?
Why don't you use my NineOldAndroid library? One of the demos shows a label rotating in 3D.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Upvote 0

Informatix

Expert
Licensed User
Longtime User
The answer to that will be, that I forgot about that library as I hadnt tried it!
I would try it (and maybe I will have to), but currently I have found an easier solution with @LonelyStar library here: http://www.b4x.com/android/forum/threads/icosflip3dview-is-new-for-animation.16684/#post-116668
I have issues with ICOSFlip3DView on some devices as you can see on this screenshot (on the device, with the animation, it's worse):
flip3d.png

Don't ask me why. I don't know. It seems that's more a problem with the lib than with the devices.
 
Last edited:
Upvote 0

eps

Expert
Licensed User
Longtime User
In my case I was thinking of height, but same concept.
I could use the ScaleAnimation to do that, but it is not the same. The illusion of flipping comes due to a skew in text size, i.e. one side of the text is coming towards you. This means the text height/width of individual charachters will be changing along the axis.

You are correct, of course. I guess we'll have to wait and see if you get any luck with the nineoldandroid lib!
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
I knew about the Tween library but thought it would be overkill for such a small animation.
Anyway, I have got it working with NineoldAndroids with as minimum code, I hope.
I do realize that both Tween and NineOldAndroid are very similar in the way that you need to select a property and animate values against it.

Performance wise I do not know which would be better.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Cheers both :)

I like the idea of keeping Apps as inclusive as possible, although there only seems to be a bit of interest around Android v 2 - 2.3 anything before that seems to have dropped like a stone to almost nil.
 
Upvote 0
Top