I m trying to track after the screen rendering in Android for move a simple Object on screen but with no luck.
For Example: The background and the bars in flappy bird game, How does they "move" and the bird is flying like?!
I m trying to avoid from using OpenGL.
Any tutorial? Any Tip/Trick?
In iOS it's super simple, In android is it the same?
Thanks in advance!
If you are trying to build a game (especialy if you build it for android and IOS) and need to use some tweening go and use platform such as
Corona:
http://coronalabs.com/products/corona-sdk/
Unity:
http://unity3d.com/
you could use openGL but this is a lot of power for some little app...
if you just want animations you could try to use the android animations:
http://developer.android.com/training/animation/index.html
also a nice tutorial for animations and tweening:
http://code.tutsplus.com/tutorials/android-sdk-creating-a-simple-tween-animation--mobile-14898
or extend the view class and override onDraw, this way you could draw stuff on a canvas and even create your own animations by calling invalidate() again.
all depend on your needs.
Related
Does someone know how to do complex animations in Android Stuido such as Select-Seats-Payment Animation?
I know there is Open GL for creating Spirtes and so on but do you actually do this kind of complex animations with Open Gl? And also wouldn't that be laggy?
Any hints would be very appreciated! Thanks in advance!
I guess you want to create the flight zoom and rotate animation.You don't need to go to OpenGl level. You just need to learn canvas. All the seats and the flight itself is simply plain design. So no need for bitmaps/images to create them. Create all seats by drawing them and treat them as like separate objects and give them their own properties like click listeners(Clicks should be handled by onTouch() function of the customView). But it takes lots of practice in canvas API of Android.
I was looking for information on how to implement an animation to my android application in the most efficient way (without out-of-memory error).
Let's say I have the same animation for smoke as this app does:
https://play.google.com/store/apps/details?id=com.apps4you.virtualsmoking
(The smoke effects)
And I made these with png's frame by frame animation in photoshop.
(150 frames);
When I add these to my app (using animation-list), I get a memory error.
I'm wondering how he added this animation without a memory crash error.
There can be many solutions to the problem:
1)Use canvas
2)You can even use GLSurfaceview
3)Use some game engine like Cocos2d-x,libgdx,unity or rajawali
Is there any way to synchronize 2d and 3d animations in android.
Let me explain:
i want to run a normal zoom/move/ animation of an android widget using surface view.
Same time i want a 3d cube rotation using Glsurface.
Can i achieve a parallel animation effect.
Thanks in advance.
It all depends on how you implement the animations. It could very well be enough to set the duration of both animations to exactly the same, and then start them at the same time.
As far as I know there is no "AnimationProgress" listener that you can use to get how far the 2d animation has progressed, so if you need a very exact synchronization of the two animations, you might be best off running your own animation thread updating the position of both objects continuously.
After getting help with starting android pong, I realized that I painted myself into a corner.
For reference on the code(Its long) and advice, here is a link to the last thread Updating player score in an android game
Basically the frame rate is halved when i touch the screen. I think it is due to updating everything or drawing on the canvas. This also lends itself to bad communication between the pieces of the application(the view, frame, and oncreate). Is there a recommended way to create an android 2d game? This is based off the lunar landing game and it seemed fine but when i tried to recreate it , it seemed much worse. I could not find a lot of resource on a best practice for drawing and so far this seems a bit discouraging.
So in short
How would you modify the code posted in the link to improve performance? Or did I paint myself into a poorly made corner, and it is time to start a new? If so , how?
Thanks
You don't need invalidate() in onTouch because you are already running a frame animation by the additional thread.
Try to define all the fixed values/variables in the constructor of the SurfaceView or in onSizeChanged() where you know the size of the canvas and bitmaps loaded, so not to make any unneccesary variable creation, requests or calcualtions in onDraw, onTouch or other methods to handle game logic, otherwise it will slow down.
I have in mind one simple application, but I would like to add some animations, transitions and so on. What technologies should I use besides Android SDK?
Concrete example: I have an activity with an animated background in constant loop (some waves, fancy shadows and graphics - maybe do it in Flash and import is or...?) and I have a big TextView in front. When user taps on screen - text explodes or burns or something like that and new text reappear. If I click on some button it also provides some fancy animation.
Should I use AndEngine or...?
I would recommend you use libgdx: http://code.google.com/p/libgdx/
It has a bit of a learning curve, but its really flexibel