Android page Curl animation - android

Is there a simple way to do the Curl page flipping animation? A Curl animation is animation of pages flipping, including the page above rolling and the shadows over the lower page.
What is the recommended way to do a "gallery" that displays two pages at a time (just like a book)?
Is it:
Letting the adapter display a linear layout of two images at a time? (it won't let me show a page flipping over the other like a book)
Using two pages, placing somehow one near the other, and then when it's time to animate -move the next two pages over?
What is the better way that would enable displaying the left page flipping over the right page?

I'm implementing a 2D page curl in the native canvas. Check my answer in: Implement page curl on android?
EDIT: The code project of my implementation: http://code.google.com/p/android-page-curl/
EDIT2: Links updated

I am using this code. Its really really perfect for any one to understand and use. Thanks a lot to Harism
GitHub Link for Page Curl Animation in android With OpenGL

I haven't worked on the android before, but it seems to me the best way to do a page flipping type of display would be to draw it in three layers. The first being the first page's text, the second being the "page" underneath, and the third being the next page. If you draw them from back to front, the only thing the user will see will be the text on the first page.
Now, Once you have that, you'll want to do some sort of curling/flipping animation based on whatever controls you are using. Simply choose whatever method works best for you for doing that animation, but while you are doing that, have the part of the page that isn't there anymore alpha'd out. This will allow you to see the text of the page underneath (Okay, I lied. You'll need a background behind that text too).
The problem at this point is you're still drawing the text twice over the same space, so you'll want to blend the first page's text with the animation under it. In this way, the text that is over the 0 alpha sections will be invisible. It won't bend with the animation, so that may still be an issue, but depending on the speed of the flip that might be fine still. When the animation is done, simply set the first page = the second, the animation reset to plain white, and the second page = the new second page.
The shadow effect can be done simply by partially alphaing out some black behind the page turn animation. Draw over second page (as the animation layer already is doing) and voila!
I believe your two page question could use a very similar method. Good luck

This is 3d animation project (based on OpenGL 2.0) - http://anettosoftware.co.uk/npc.php

Related

How to cross-fadeing image in Android

Basically, I have images that I'd like to to update them sequentially into the same view to create custom ProgressBar.
I found Tumblr to do just that with their ProgressBar(ImageView?).
Here I put the animation side-by-side to show how the image actually cross-fade from Aa into a camera.
Exactly what I wanted:
Cross-fading effect
Indeterminate
Use the same view (I dumped view hierarchy to check)
Animation during transition (The image actually pop a little when spinning and cross-fading into the next image)
So far I have tried:
1. Frame Animation,
this allows for unlimited item(s) with definable durtion. However, it
doesn't cross-fade the image and there's no way to listen to the
transition's event to apply other animation, etc.
2. Transition Drawable, this allows cross-fading between EXACTLY two drawables. So this doesn't allow for the number of items and interminate duration as well.
I also came across CrossFadeDrawable by Romain Guy just now but it looks like it's only coded to support only two Drawable.
Right now I am not very sure if I'm approaching in the right direction or is there something I need to learn in order to do this kid of effect?
I'm not sure if you are approaching this direction but isn't this what you are looking for:
http://www.youtube.com/watch?v=atH3o2uh_94

How did they make such layout - which elements they used?

At the moment, I am using Euro 2012 app and it has some interesting layout parts. If you go to matches->knockout screen, you'll see 3 screens like this.
If you slide left or right, you move between them not like between one activity to another, but just like all these elements are laid on one big canvas and you slide each screen into focus. Even thou, if you slide left/right, the screen cannot be stopped in the way that half of each image is visible, so I guess it's not a big canvas. Somehow you can slide screen like one big image, and yet it always lock perfectly as if they used 3 activities for this.
How did the do this?
It's a ViewPager, available in Android support package and described in their blog.
The designing is not so much difficult, As i think to draw that boxes showing quarterfinals, semifinals.
They having layout( we can do by placing image in background also).
The major role played by FrameLayout which shows you that effect(emphasis), the flages are fetch from url as matches are decided(not essentially images only names are sufficient as flags came inside app and gets applied as updated).
After your click i think the start image gets change it's just replacing that image with new one.
As you said they are not on single canvas (but if they did customization of heir Viewpager that it's not stopping in between activities), but i think it's on single canvas.
If your taking about quickness of loading and all it's up to you as much code and processing you optimized it gives you smooth feel and fast processing.
We can appreciate the work but we can not say it's too much difficult as i think it's quit easy...
Hope this explanation helps you to understand ....

Android Book Pages

What's the best way to implement functionality in Android where I have a large amount of text (let's say a book), and I display one page at a time. However, instead of displaying it all at once, and having the user scroll through it, I would want to create it like iBooks where each page is separate, and the user "flips" through it [although, I don't need a fancy flip. A simple slide, like Kindle for iOS, would do].
So how should I go about this? Is creating a customview necessary, or is there some way to do it without that?
Previously asked (I think): How to do page flip/turn/curl effect in android
Possibly answered: Implement page curl on android? with a project at http://code.google.com/p/android-page-curl/
If that doesn't do what you need, you will probably need a custom view, and you'll probably need to do some OpenGL work. The animation and page bending done (to simulate bending the corner of a page) is quite possible but would require some knowledge of the math, which appears to be described at the answer. Your mileage may vary.
EDIT: ah, see Android Left to Right slide animation

How to turn the page [duplicate]

Is there a simple way to do the Curl page flipping animation? A Curl animation is animation of pages flipping, including the page above rolling and the shadows over the lower page.
What is the recommended way to do a "gallery" that displays two pages at a time (just like a book)?
Is it:
Letting the adapter display a linear layout of two images at a time? (it won't let me show a page flipping over the other like a book)
Using two pages, placing somehow one near the other, and then when it's time to animate -move the next two pages over?
What is the better way that would enable displaying the left page flipping over the right page?
I'm implementing a 2D page curl in the native canvas. Check my answer in: Implement page curl on android?
EDIT: The code project of my implementation: http://code.google.com/p/android-page-curl/
EDIT2: Links updated
I am using this code. Its really really perfect for any one to understand and use. Thanks a lot to Harism
GitHub Link for Page Curl Animation in android With OpenGL
I haven't worked on the android before, but it seems to me the best way to do a page flipping type of display would be to draw it in three layers. The first being the first page's text, the second being the "page" underneath, and the third being the next page. If you draw them from back to front, the only thing the user will see will be the text on the first page.
Now, Once you have that, you'll want to do some sort of curling/flipping animation based on whatever controls you are using. Simply choose whatever method works best for you for doing that animation, but while you are doing that, have the part of the page that isn't there anymore alpha'd out. This will allow you to see the text of the page underneath (Okay, I lied. You'll need a background behind that text too).
The problem at this point is you're still drawing the text twice over the same space, so you'll want to blend the first page's text with the animation under it. In this way, the text that is over the 0 alpha sections will be invisible. It won't bend with the animation, so that may still be an issue, but depending on the speed of the flip that might be fine still. When the animation is done, simply set the first page = the second, the animation reset to plain white, and the second page = the new second page.
The shadow effect can be done simply by partially alphaing out some black behind the page turn animation. Draw over second page (as the animation layer already is doing) and voila!
I believe your two page question could use a very similar method. Good luck
This is 3d animation project (based on OpenGL 2.0) - http://anettosoftware.co.uk/npc.php

Android TranslateAnimation after scrollTo() = undrawn view

This might be a "duh" question but I'm going to go ahead and ask it anyway.
I have an oversized (bigger than the screen) RelativeLayout, and I'm using swipes to start a TranslateAnimation from viewing one part of the layout to another. Say for instance the layout is two screen wide and two screens tall. After the nice animation to shift the screen, I was using View.scrollTo() to set the new position. This works fine going from the first screen (top left at 0,0) to one of the others. When I swipe to animate back to the first screen though, because the View.scrollTo() invalidated that part of the layout (I assume), that part of the layout is all black as I animate through it. I tried a couple things to get it to redraw itself after the scrollTo() but haven't had any luck, so I figured I'd ask here.
thanks!
joe d
I can't help with your specific problem since I've never tried working with a layout bigger than the screen, but there might be another way to achieve what you're trying to do. If you simply want to be able to finger-swipe from one View to another, without ever displaying part of one screen and part of another (i.e. you aren't smoothly panning around a large View but rather just jumping from one distinct section of the layout to another), then these tutorials might help, here and here. They show you how to use touch events and the ViewFlipper widget to change between Views using animations.

Categories

Resources