How to spin an image in android? - android

I have an image. i want it to spin/flip 360 degree continuously. All the tutorials i m referring are of rotating image 360 on a 2D axis.
I tried using the rotate animation from android but it has same problem of rotating around a point but not 3D spin or flip.
Thanks

What you are describing sounds very similar to a card flip (google android documentation). Bare in mind that you need to think about what is on the opposite side of the image (for your specific use case) if you are going to implement that.

Related

Scrolling home screen in LibGdx

I am using LibGdx to develop a game. For Now I am not using scene2D. I am struck up in increasing the levels of the game as I do not have the scrolling screen.
I like to design a a scrolling screen as it is in many games which are level based (for ref, lets say Candy crush). Could you please point me a example on how to have such a scrolling screen to show a bigger area where I can show many levels.
Thanks is Advance !
Using the Scene2D function is not necessary for this and is more for GUI implementation and different screens. The Scroll pane really shines when creating reading content that does not fit your phone. I do advice to start learning Scene2D to create MenuScreens and UI though.
What Candy Crush "simply" does is having multiple backgrounds that are placed next to each other and tile seamlessly. They use buttons in the correct place for levels. By dragging a finger across the screen the camera will move in that direction. For the movement from one level to the next there is probably something like a spline in play.
It is important only to draw the background tiles and buttons that are actually visible on the screen if you have many. Since these have fixed positions and you know your camera area and position you can calculate what to draw and what not. Just drawing everything each frame is likely to slow down your fps.
You can do a search on:
Tilemaps, for you backgrounds but you probably want them in just one direction so a simple 1D array would suffice.
Dragging, to move your camera. Here I gave a basic explanations on how I do it.
Splines, are a bit tougher and you do not really need them. They could be used to animate or move something along a curve.
Thats all, expecting you know how to create something like a button (click a sprite).

Use sensors like gyro and accelerometer to look around a 360 virtual image?

I'd like to create a 360 degree view for my device and use my device to move around and look around me to all points in the view. If you're similar to Yelp's Monocle, I kind of want to do that sort of thing, but instead of looking through the camera I want to look at a panoramic view. Is such a thing possible?
Yes, it's possible. If you don't know how to use the accelerometer Here there is a quick tutorial:
http://karanbalkar.com/2012/09/tutorial-1-android-accelerometer-demo/
Then you only need to translate the (x,y,z) acceleration into a vector orientation (Simply do some maths).
Take care about screen orientation be sure that you fixed it to portrait or landscape if not the app will be reoriented.
PD: Another tutorial from nvidia website for developer: http://docs.nvidia.com/tegra/data/How_To_Use_the_Android_Accelerometer.html

Rotate sprite image in all angles using j2me

I'm developing a game in Android and Java. In android I am using andengine for sprite image and i was able to rotate in all directions.
int bikeFrame:
//bikeFrame++,bikeFrame--
bikeSprite.setRotation(bikeFrame);
I want to make the game in j2me also. But in j2me we have only four methods to rotate angle
(TRANS_MIRROR,TRANS_MIRROR 90,TRANS_MIRROR 270,TRANS_MIRROR 180)..
If i take images as frames I am still not getting smooth animation.
How to rotate sprite image in all angles in j2me?
See this thread, omarhassan123 created a code snippet that should allow you to rotate the image by any angle you like.
There is a library called J2ME ARMY KNIFE that provides all sorts of image manipulation techniques, you can get it here.
Also, see this question:
Image rotation algorithm
Another idea: decompile a game called Flexis Extreme. They do a lot of image rotation in real time so you could try to find out how they did it.
If you can, try LWUIT Image.rotate there is a sample at this page http://lwuit.blogspot.com.br/2008/11/round-round-infinite-progress-and.html

animation with sprite 2D android

I am building a virtual store with the effect same like this
enter link description here
The user can freely rotate the image from left to right and top to bottom or vice versa. I suppose to use sprite 2D to implement that animation. There are some tutorials I found but because Im pretty new about graphic programming so could anyone point me to the correct way that approach my expected performance. Thanks a lot.
The easiest way is to use the Canvas API in Android. Here is an example of how to use it with sprites.

openglES - give a curved effect to a wall of pictures

I am starting with openglES (on android).
I have in my app a wall of pictures. I have already made a simple tiled wall where I can browse with translations and zooms, and implemented a simple picking system.
Now I would like to give this wall a curved effect like we can see often (like in safari, see my images)
Do you think i can do it by applying simples (naive..) Y-rotations and Z-translations on each tile?
My first exemple seems to do that wheras my second looks more complicated.
Can you give me some ideas or a solution if you already did it for one of your project??
Exemple 1 : motorola xoom
Exemple 2 : safari top sites
Just write it out on paper. Start with a circle of whatever radius you want your pictures laid out in, then figure out the math to calculate a position along that circle for each object and translate/rotate each image/polygon to it's correct location. Then you could do the rest in one of two ways, you could have a rotation variable that rotates all your images around the vertical axis, or you could rotate your camera to look at a different spot on your picture wall. If you wanted to get really fancy, you could apply your images to curved surfaces so that rather than being a bunch of flat polygons, you could actually be looking at the curved images.

Categories

Resources