I need to use animations in the app. Is it better to use frame-to-frame ImageView animations or to use video animations? Video animations are SWF (which I can probably convert to mp4).
The animations last up to 4s what would be around 80 images in one frame-to-frame animation. This is the layout of the app.
A different animation will appear in the red area based on which button on the right side is pressed.
Now, which approach is best to use?
I know that frame-to-frame approach may create an app with a lot of MBs.
I also do not know if video approach could make smooth animations? Can I play SWF files inside the such layout or I would have to convert each into mp4 in order to use this app on pre-Android-2.2 mobile phones.
Please advise!
For an ImageView, I assume you will be doing the animation by repeatedly calling the invalidate method. This will not give you a high frame rate. To do real-time animation, you need a SurfaceView or subclass thereof, perhaps a VideoView.
Related
I have an animation-list drawable with 100 frames, and its working fine. But now I want to jump to a specific frame and then start the animation from that frame. So is it possible in animation-list drawable
No. There's no built-in way to do this. You're gonna have to create a separate animation which starts from whichever frame you need.
I want to create an animation like a slot machine, in Android, but I'm not sure how to do this.
I want the animation to look like this:
http://www.youtube.com/watch?v=EX-uzP6BdjI (its pretty obvious I guess), but then with 8 bars, and instead of the fruits, I want letters.
Now, I've already got the image of the letters (seperate for each letter, and one for all letters).
But because I want to display the letters in some sort of frame, I need to keep the letters within that frame (just like the example), which seems very hard to me, with one image.
What is the best way to make an animation like this?
The end position (the final letter) will be randomly chosen before the animation starts, and the animation needs to be able to change depending on that letter.
The animation doesn't have to be smooth (it can come to a sudden stop at the ending, instead of a smooth ending), but if it's easy to do, I'd prefer that.
Try creating an animation video of each possible scroll, then randomly choose the outcome and play the corresponding videos. a simple if clause can call the correct video, although if you have many possibilities, you might prefer to use switch case.
If you do so, then you can put together photographs of each predetermined outcome, and use them for your drag and drop imageview.
This is the effect on the ios
Like the effect of paper folded
PaperFold for iOS :https://github.com/honcheng/PaperFold-for-iOS
I suppose you can use scale animations on ImageViews that simulate the paper already folded. The scale effect would be used when you scroll through and expand the entire paper as you continue to scroll through the sets of images. Once you fully scroll through the paper ImageView and the animation is completed, you just kill the animation and have a normal view of a full page paper. Just make a separate folder for animation and inside that folder, create an XML file, select scale and play around with the attributes to test the best suitable effects for your animation.
Hope this helps!
There is a library that helps to implement not accordion-like but another quite interesting folding effect: http://www.youtube.com/watch?v=GzWGhp_NDTg
The explanation & code here http://cases.azoft.com/creating-paper-folding-animation-in-android/
You can use Foldable Layout Lib.
https://github.com/worldline/FoldableLayout
I am developing a 2d android strategy game, it runs on SurfaceView, so I can't(or can I?) use LibGdx's particle system. And I would like to make a raining effect, I am aiming for something like this( http://ridingwiththeriver.files.wordpress.com/2010/09/rain-fall-animation.gif ), I don't need the splash effect in the end (although that would be superb, but probably would take up a lot of system resources). How could I achieve that raining effect? Any ideas?
There's one similar code from JakeWharton called DroidFlake. It seem like snowfall effect but worthy to check DroidFlake
The easiest would be to put the rain drops in a PNG with alpha and display that at the end. You would only need a few frames to make it smooth, but it would eat up a bit of resources if this were a full screen image.
If you cannot afford this, you could put each distinct raindrop in a smaller PNG file with alpha, then display this (these) single PNG(s) multiple times. This would reduce the memory used a lot, although your rendering code will get a bit more complex, and depending on how many drops you have, it might affect performance.
A trade-off between the two would be to have a PNG file that contains more drops, but not for the full screen, and display that a few times.
You could have another frame (or frames) where the raindrop splashed, which you could display before ending the animation of each drop, or you could have the final frame in the large PNG contain the splashes.
There are many ways of doing this. You could create a sprite sheet like:
In that spritesheet, you could simply have a drop of water advance in each frame until it reaches the bottom and you create the splash effect. You then need to be able to animate it (very easy). You can then create multiple instances of the image, or draw the one image multiple times to create the rain storm.
I'm attempting to fade between two background images on my Droid, but the animation seems to get 5fps if not less. Is there any method I can use other than fading in\out a couple image views that would be smoother?
You can set your background to be defined by a TransitionDrawable. Used it to develop a nice splash screen that fades in and didn't have any issues.
I'm not exactly sure what you want to do, but if you want to change from one screen to the other within the same app you should use the ViewFlipper.
View Flipper on Android Developer site
This will allow to smoothly change from one screen to the other (much like the iPhone way).
If it is about the actual Android background i can't help you. Sorry.