I've done a bit of searching and I don't think this has been asked yet (if it has, then I have been searching with the wrong terminology)
I'm trying to find out how to record touch gestures/actions done on Android touchscreen (with respect to time), then use the path of that gesture as the path for a graphic to follow (using android's tweening capabilities)
I'm also looking to be able to save the animation so that it can be loaded later on or exported as a file.
My thoughts around this are to take the point of touch's (x,y) coordinates and save the pair across a set interval of time. Then the coordinates can be loaded from the file later on for an ImageView (or some other view) to be tweened across the device.
Plus, I figure a method like this could make it cross-compatible on screens of different sizes if I saved the coordinates as percents instead of actual values, they can then be loaded depending on the screen size of the device
My questions are: Am I on the right track? Or would this be an inefficient way of doing it?
If this is the right idea, what is the best way of recording the positions and then using the tweening capabilities to animate the object (or is there a better method than tweening to provide a smooth animation)?
And if not, what would be the suggested solution to my problem?
All answers appreciated!
Bitwize
There is a tool to record gestures in the devloper application examples. You can find on the emulator : GestureBuilder.
Here is a tutorial about gestures.
Though, gestures have been provided to be recognized as gestures not like an animation path. But I believe you can extract data from gestures and get the "path" of given single touch gesture. Here is the main class to represent a gesture.
It has a toPath() method that could be useful to you.
Related
Here is a scenario on which i done a lot of research on google but hopeless. the scenario is, i am going to develop a 2D game in which i want to use multiple backgrounds and i want to translate them as they are moving forward, it must look like one background is near and translating/moving fast and the other background is a bit far and translating/moving a little slow. the nearer background have almost full intensity and the farer background have a bit low intensity. you can say they have different transparency levels. the question is, how can i get this task done or is this possible to use multiple backgrounds.
any suggestion will be appreciated.
as an example, see the image of BADLAND game bellow.
I think as far as I got your question you want to put two or more images one over another. I mean if you are trying to overlap the multiple backgrounds and asking for it yes it can be done easily.
What you need to do is to use the FrameLayout. as
"FrameLayout represents a simple layout for the user interface of
Android applications. It is usually used for displaying single Views
at a specific area on the screen or overlapping its child views."
and then you can implements the animations on them and translate them You can find different types of translation over them.
Here is all about using the frame layout frameLayout1 framelayout2 and for animations and translation here are links. link , link2 , link3
I am trying to check if an image is on a program's interface. I know how to grab the program's image but I cannot figure out a way to check if the image on on the program's screen. How can I do this?
I think checking containing one image in another is a question of "computer vision", so maybe some special libraries like OpenCV can helps you.
And this question on stackoverflow could be so useful too
OpenCV Template Matching example in Android
If you want to do the checking within the same program as the one that loads the image, it should be possible by checking the user interface control properties/attributes, and also the return values of the functions/methods used to set the image. In such a situation, Computer Vision is overkill. In this case, may be you can post some of the code used for loading the image, so that others can suggest solutions.
But if you are using a different program to capture the screen and look for the image, SIFT and SURF features of OpenCV should do the job. The accuracy won't be bad in this application.
I am using eclipse with the adk android plugin and I am completely lost
That would depend on what do you mean by displaying their location:
Relative to each other on a blank screen.
Read up on distance calculation in coordinates and draw the locations relative to their distance from each other.
On a map, each one separately from the other or together.
Use a web/binary API for map display like Google Maps (don't want to spam and post links with my reputation), or write your app to display Open map data from sources like OpenStreetMap.
On a satellite/aerial images.
Pretty much the same as #3 just you have less options to investigate and try.
If you were a bit clearer in your question, I could have been more specific with the answers, if you edit your question and clarify more, I could be more specific.
I have an object that continuously follows the users touch coordinates. I would like to make it so the object has an easing effect.
by which i mean, the object has a start point and when the user touches the screen, said object would move to the users touch coordinates. which it already does but it jumps to the coordinates. i want a controlled transistion from point A to point B.
this easing or tween affect would need to happen on every frame if the user dragged or swipped their touch coordinates.
i have been reading about interpolation and animation affects for the android sdk but i dont really understand how to implement them on an object and not a view. or continuously as well.
any direction would be great. thank you!
I built a complete tweening engine for Java. It doesn't allocate anything dynamically so it's totally safe for Android (I made it primarily to develop games on Android).
http://code.google.com/p/java-universal-tween-engine/
Your tween would look like:
Tween.to(yourObject, Type.POSITION, 1000)
.target(touchX, touchY)
.ease(Quad.OUT)
.start(aManager);
I used a similar syntax as the TweenMax engine, so you shouldn't be lost too long :)
I have following task - I need to draw on Google Maps a cross with certain coordinates. I know how can I do it using ItemOverlay but I think that there is means without using a custom marker. I need simple black cross with my coordinates. Please, tell me, is it possible?
UPDATE: I don't want to use ItemOverlay because I need to make a custom drawable for it and I hope there is simple android internal elements for it.
I'm sorry, but using Overlays seems to be the only way of drawing any line on Google Maps.
You could draw an ImageView right over the google maps view (with absolute positioning using margins). But then you'd have to take care of coord conversion (and reacting to user scrolling, zooming the map) "by hand".
I think you could also use SurfaceView fully aligned to google maps view and draw your marker right on it.
But both solutions are pretty much overkill; you're better off using ItemizedOverlay unless you have a really good reason no to - in which case you might wanna add some info on what's the reason, maybe we'll find you a nice solution to that one :)