Following what is explained on Android move object along a path I drawed a circle path and could animate an object along it
Now I need to move the same object along the same path but using the finger. Basically it should be like a drag and drop but using the path as a guide.
How can I do such a thing?
Thanks in advance,
U can try to get the pixel color of the touched point, then u can check if that color matches a pre-defined path color.
i had the same problem and find that very useful.
Related
In android I am drawing path creating a custom view and using onDraw() method. But after drawing many paths, I want to identify the paths differently and transform each of them differently. I have identified whether a point is on path or not using rectF and region, but to get contained path (using getBoundaryParh()) in the region is not helping me. So can someone help me with this, I just want to get the object of the selected path by touching on the screen. Thanks.
I want to draw a Alphabetsenter link description here A to Z one by one. first i want to write 'A' in a particular path if it is correct, then it wants to move to 'B'.. All this should connect with points for example the following link shows how i expecting the same..
you can draw to the canvas in the onDraw method of the view class.
I have 2 points(x1,y1) and (x2,y2). I need to move the image from (x1,y1) to (x2,y2). Please let me know if there is any methods in android SDK to achieve this.
If you are doing a custom view that handles it's on onDraw method you could:
Create a path object:
Move to position 1 using the moveTo method
line to position 2 using the line2 method
Create a path measure object.
User the path measure object to animate to the position.(Here is an example of that--note you will have to do it a little differently as the code doesn't show View.onDraw & View.invalidate being called).
Alternatively if you aren't handling your own on draw, you might be able to simply use a TranslateAnimation.
Looks like all you need is an animation.
Search this site for Animation Drawable and you'll get tons of examples :)
I need to move the image in the canvas. The image should not follow a linear or circle or elliptical path. I know this can be achieved by using the COS and SIN functions. But here I need to get the image traversed in a 4 different path like I have shown in the below snapshot. Please help me if there is anyway to achieve this. It should be fine even If I get any idea to achieve this .
snapshot:
I'd try the android animation package first - you should be able to define a few points and get this to smooth the path between the points.
See here: http://developer.android.com/guide/topics/graphics/view-animation.html
I am trying to develop a custom gallery like application in which, i would like to place Image views along an elliptical path whose size varies with position.
All ideas are welcomed.
Thanks & Regards,
Sen
I have only two ideas:
create a path, do the math and position the ImageViews inside a RelativeLayout/AbsoluteLayout on the calculated position. So you only use the path to do the math, not to really position the views on that
Use 2D drawing (on a canvas) there you can draw images along a path... how to draw a bitmap repeatedly on a path can be seen here: http://www.mail-archive.com/android-developers#googlegroups.com/msg14567.html