3D animation between layouts like the lock screen in jelly bean - android

So basically I'm trying to replicate this. It will be used like a view flipper. I haven't had much experience in doing this sort of stuff in android yet so any help would be appreciated!

I'm not exactly sure, what are you going to achieve, but I would start with such lecture: Android flip 3D animation. It's quite easy to replace views in the middle of such animation. You may consider writing your own container, if the ViewFlipper is not enough.
If the view is too complex for Android to handle, or your animation is intended to be more interesting than simple flip/scale/move, then you may consider using OpenGL and shaders. Simply draw your views to bitmaps, pass it to OpenGL and do whatever you want to do with them.

Related

Is the structure of this code suitable for its purpose and how do I smooth animations in Android?

I am implementing a piano tiles clone for an educational purposes. I've created 5 Views (that's the rows) which extends LinearLayout. Each one of them has 4 childs (that's the 4 tiles).
I am using an Handler for the animation, and change the Y property manually every "tick".
Problem is, the animation is somewhat twitching and not smooth.
I have two questions:
Is that a good design? I know for example about surfaceView as alternative for drawing and animating but that seemed to me a bit complicated for my cause.
How would you animate those tiles? currently I use an Handler (actually I was guided on another thread to use Animation. What do you think the most feet to my case?
Thanks!
I like your grid idea, but you may have to change it if you would like the tiles to be procedurally generated. Also, here is a thread on how to make animations smoother in Java (This can probably apply to Android too):
How can I make a Java Swing animation smoother
Here is one for Android: Moving animation not smooth in android
Also, I feel you are a bit behind, the Piano Tiles phase has disappeared now, much like Flappy bird.

Android Canvas inside of each row of listview without lag

I realize this is a highly custom implementation, but im porting a app over from IOS to Android that has these photos in a listview that the user needs to be able to fluidly whipe off in one fluid motion. The only thing I could find on github anywhere close to this was this: https://github.com/winsontan520/Android-WScratchView/tree/branch_image_overlay
but,this uses a surfaceview and when implemented in my listview its EXTREMLY laggy. I did a bit more research looking for something along the lines of a photoshop eraser and came across some stuff using canvas to accomplish something similar with a single drawing area , but im not quite sure if what I want to do is possible in Android and if spending the next day or two learning canvas would be a worthwhile investment or if im barking up the wrong tree. Is this the way to go to accomplish my goal?
SurfaceView is actually a Canvas implementation that has some native improvements like duble buffering, vsync and such. But using it in a ListView is an overkill.
I say take your chance with a custom view. Just override the onDraw(Canvas canvas) and draw whatever you want. Learning canvas is pretty easy if you have some basic graphics knowledge.
As an another implementation idea, If you don't need all of your Views inside the ListView interacable when scrolling, you can use static images in ListView and when user touched one of them you replace static image with SurfaceView and go on. This way you only need one SurfaceView.
Also did you used the ViewHolder pattern ( http://developer.android.com/training/improving-layouts/smooth-scrolling.html ) when implementing the ListView? Might help with the performance but I'm not sure if it can be implementable in your case.

Android 2D animation on characters

I have created a character and I wonder how I have to animate it regarding the fact that :
It has to move when on static position, I mean for example eyes blinking, mouth closing.
It has to move on the screen regarding to player gesture.
It has to be involved in collision.
I read about, AnimationDrawable, SurfaceView, Canvas ... but which way is the best ?
Thank very much !!!
If you're trying to make a game you should consider GLSurfaceView with textures.
This is a pretty good tutorial, though it contains a few coding errors, it makes the concept very clear!
The OpenGLES method would give much much more freedom, than animating Views, but maybe harder to master.

Using opengl to render each item in a listview in android

I am trying to find a way to do some opengl based 3d animations for each item in a listview. I know that as of ICS it is possible to use a TextureView in which you can render an opengl scene. Romain Guy's answer in this thread explains in detail how this can be done.
However I am not able to figure out how this will work if the TextureView was part of a ListView? (Is there any other way of performing opengl base rendering inside a listview?)
There are two methods I can think of.
For every textureview in the listview create an opengl context which will render to that textureview's surface. (Seems very unelegant to have huge number of gl contexts, plus I think the limit is hardware dependent)
Create one opengl context and share it across multiple surfaces. And do sequential drawing calls to different surfaces. (Don't know how this can be done, and listview manages what to show and hide which further complicates things)
So my question is... Is there a way to do opengl based rendering inside a ListView? And if so how?
ListView does internal recycling. Therefore, there won't be too many View objects: usually two or three more than are visible at the same time anyway.

Android and slideshow transitions

I am trying to write a simple slideshow with various transitions between images.
I would like to have various transitions like fade in, fade out, slide left/right which could probably be done with android's API Animation. But I would also like to have more complex transitions like checkerboard left/right, box in/out, circle in/out, curtain, spiral, split horizontal, and so on which I believe can't be done with Animation.
I know that names of transitions like I named them above are not enough to know exactly how the transitions should look like, but I think you get the general idea.
So, my question is:what should be used to achieve those effects/transitions? I am not asking for the code (though some links to examples would be great of course), but more generally what should I be using? OpenGL? Regions? Clip Paths? BitmapShaders?
I just don't feel like spending a week investigating this, when I am sure you guys know the answer ;)
If possible I would like to avoid OpenGL since I haven't used it. On Android 3.0+ devices I will use hardwareAcceleration="true" in Manifest, and on devices less than 3.0 I could limit to simple slide in/out, fade in/out if necessary (read: if other transitions would be too slow not using openGL).
Check view animation and property animation.

Categories

Resources