I am developing a game using Android Studio where I need the blocks to move from right to left. I have a file as an input and it contains a string list which would look something like this:
[(160,0;7,58), (160,0;7,59)..]
The elements in this list should be seen as coordinates, the 1st number of each pair (in this case 160,0) is the coordinate on the Y axis and the second number (in this case 7,58 and 7,59) is the coordinate on the X axis
The idea of this list is that the first number of every pair is the pitch heard at that ms, which is the second number. And the lines that come in from the right should arrive at the left corner at the time they were heard.
Lets say I someone said one word (with the same pitch for this example), the list would look something like this
[(160,0;5,50),(160,0;5,51),(160,0;5,52),(160,0;5,53),(160,0;5,54),(160,0;5,55),(160,0;5,56),(160,0;5,57),(160,0;5,58),(160,0;5,59),(160,0;6,00),(160,0;6,01),(160,0;6,02),(160,0;6,03)]
Now in this given list the 160,0 is the pitch of the sound and the second number is 5,50ms. Now the idea is that the lines/bars that come from the right side will reach the left side at that point. This whole list makes one word and should be displayed as one block/line that moves from right to left.
The blocks should come in and then disappear (like it is illustrated in the illustration), pretty much like rainfall or in tetris where the blocks fall down but instead of hitting the ground they disappear. In the illustration you can see one full block and the other one is just coming in from the right. The 1st long block that you see in the illustration should move to the left most screen and then gradually dissapear.
I drew a little illustration of how it should look like : https://imgur.com/a/3X1dV
Is the best approach to create one block, clone it and move it on or draw new lines with "draw" or can someone tell me how I should approach this.
Basically, I want to be able to clear the augmentation using the X button on the top-left corner of the screen, as shown in the picture.
This was done using some script in Unity3D.
Any idea how this is done?
Here's the link to the video: https://www.youtube.com/watch?v=9tksyhVlIMQ
These are my findings:
If you want on-screen buttons, then just parent the button UI to the Camera and position in a particular corner of the screen or something.
Now if you function it to work like if pressed and you want to clear or start detection use these:
TrackerManager.Instance.GetTracker<ImageTracker>().Stop();
TrackerManager.Instance.GetTracker<ImageTracker>().Start();
Took me a long time to figure this out. Hope it helps someone out there. :)
I am using RotateAnimation to animate pointing arrow that updates its position when of user updates destination point or current device position changes. I'm using interpolator.accelerate_decelerate to make animation look more smooth and "physical".
Everything goes fine until another update arrives when current animation is still processing, for example, when user changes destination while pointing arrow is still rotating. When such happens, the arrow makes a sharp bounce which looks ugly, and I'm trying to avoid this. I tried to implement a queue to make every next animation wait until previous ends and it looks nice, but behavior became quite illogical.
So my questions are following:
1) is there some way to make animated transitions more smooth in the cases when animations start one by one and overlap each other?
2) is there a way to stop animation that is currently processing and get intermediate position of an object?--if I decide to stop animation before its end and use current position as starting point for next animation.
ok so the easiest is to create a custom Animation similar to RotateAnimation and saving the current rotation angle in applyTransformation, this angle can be then used as a start angle for next Animation thus avoiding the "jumps"
A custom class extending ImageView that performs animation based on angular movement of dipole in magnetic field:
https://stackoverflow.com/a/22738030/3459206
I was just playing with Android SDK Demos and I found the rotating dialer example which you can find here : Android Rotating Dialer and I'm curious about one thing. How can I set the image to rotate only when I click on image..not inside in or out. I don't want to rotate it if I click at the center (in white area) or outside of the image (again in white area).
Any suggestions how can I achieve this?
Interesting question.
This would be possible by modifiying the code of myOnTouchListener. Just before the switch statement you would perform a calculation to check whether the x,y coords of the touch were outside an inner radius and inside an outer radius.
Some simple Pythagoras and it wouldn't be too hard. If this was not the case then return true at that point.
Depending upon the user i may need to move it to right ,left,top or bottom.
Should i use animation for the purpose?
Or is there any method to move image dynamically?
I meant the things in android application
You use animation for a movement that has a distinct start and stop point. For example you might move the image right to left at a button push. It would slide a cross the screen and then appear back at its original position.
If you wanted to move things around this way you could do so by having 2 (or more) copies of the same view.. hiding the view at the old position and showing it again at the new one. You generally won't be stopping this animation between its begin and end point.
If you want some more interactive movement (say move along with the user's finger on the screen), you'll need to make use of the canvas and some touch listeners. In that case I recommend looking up drag and drop samples as they address what is needed for this to happen (and then some).