[android-developers] Re: Animation Problem
I'm not sure about the coordinates thing, but if you are trying to use rotateAnimation to rotate something such that it looks like it is spinning in-place, then 0,0 are not the coordinates you want. The coordinates are a 'pivot point'; you could think of them as the 'middle' of the rotation. If you want an object to rotate or spin without moving up/down/left/ right, then what you actually want is: RotateAnimation spin = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); This gives the middle of the image as the 'pivot' so it doesn't move in an arc. Hope this helps! On Aug 11, 1:59 am, HVT wrote: > Hello All, > > I'm new to Android and trying to develop an app that has loads of > animation. > Its a small game. > > Currently i have a object (image) moving around the canvas. I used > animation to animate it around the screen. > > But the problem here is i dont have the X&Y coordinates of that object > while its animating. > I want to get the coordinates of the bitmap whenever i want during the > animation. > > I think if there was some way where i can read the presentation layer > probably i could get the cordinates of the object. > > Please help me guys i'm stuck here now for like a week. > > My another problem is with rotate animation, i some how dont seem to > understand its functionality. > I have played with it for a couple of days but no luck, i'm still new > to it and dont get anything. > > The object makes big arcs even if the x,y values are 0,0 and the > object jumps around when i try to give it random values. > > Any help would be highly appreciated. > > Thanks in advance. > > HVT --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Animation Problem
I know its too late but Thanks for the reply. Basically what I want is a combination of Translate and rotate animation. I dont know if i chose the right thing as i'm very new to android. I want to animate a object on a random curve (like a freehand drawn curve which has no specific shape).So for this i chose a animation set of translate and rotate animatinos. I hope it makes sense. and also i want to capture clicks on the object while it animates. Do you think you can help me? Probably i chose the wrong approach kindly correct me if so. Actually if you have a little idea of iPhone development, this kind of animation can be achieved by making a image animate on a "Path". And this path can be created by us by supplying random values. Its a cake walk in iPhone. On Aug 11, 10:36 pm, jhoffman wrote: > I'm not sure about the coordinates thing, but if you are trying to use > rotateAnimation to rotate something such that it looks like it is > spinning in-place, then 0,0 are not the coordinates you want. The > coordinates are a 'pivot point'; you could think of them as the > 'middle' of the rotation. > > If you want an object to rotate or spin without moving up/down/left/ > right, then what you actually want is: RotateAnimation spin = new > RotateAnimation(0.0f, 360.0f,Animation.RELATIVE_TO_SELF, > 0.5f,Animation.RELATIVE_TO_SELF, 0.5f); > > This gives the middle of the image as the 'pivot' so it doesn't move > in an arc. Hope this helps! > > On Aug 11, 1:59 am, HVT wrote: > > > > > Hello All, > > > I'm new to Android and trying to develop an app that has loads of > >animation. > > Its a small game. > > > Currently i have a object (image) moving around the canvas. I used > >animationto animate it around the screen. > > > But the problem here is i dont have the X&Y coordinates of that object > > while its animating. > > I want to get the coordinates of the bitmap whenever i want during the > >animation. > > > I think if there was some way where i can read the presentation layer > > probably i could get the cordinates of the object. > > > Please help me guys i'm stuck here now for like a week. > > > My another problem is with rotateanimation, i some how dont seem to > > understand its functionality. > > I have played with it for a couple of days but no luck, i'm still new > > to it and dont get anything. > > > The object makes big arcs even if the x,y values are 0,0 and the > > object jumps around when i try to give it random values. > > > Any help would be highly appreciated. > > > Thanks in advance. > > > HVT --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Animation problem
Thank you for your answer. I tried all 2^6 combinations of the three flags (fillBefore, fillAfter, fillEnabled) but the animation still not works. I only want a pulsate. No matter what I do it is no liquid/smooth animation. It jerks and jumps. I can't find a solution. I would be grateful for help. On 29 Dez., 03:47, John Lussmyer wrote: > You may want to set the setFillBefore and/or setFillAfter values. (one of > them defaults to true, the other to false.) > > On Tue, Dec 28, 2010 at 3:21 PM, iced wrote: > > Hello, > > I'm new here and I don't know if this is the right place for my > > problem. Please excuse me if it's wrong. > > I want to create a scale animation where a view grows a bit from it's > > original size and then shrinks to it's old size. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Animation problem
I've tried almost exactly the same scenario. It seems like the fromXScale="1.0" does not match the actual apparent size of the view. 1.0 was quite a bit bigger than the original view size. I also tried all the combinations like you did. It was not an emulator speed issue, nor an inconsistency between emulator and hardware device. It was not a fillBefore or fillAfter issue, as far as I can tell, either. For now, my workaround is to adjust the scale parameters downward by an ugly arbitrary amount. For example, fromXScale="0.83" seems to smoothly match the un-animated size on my emulator and on my Galaxy S, regardless of screen density. I made my throb animation go from 0.83 to 1.05, instead of 1.0 to 1.2. But I'm afraid this will just not work on some other device and I'll be back where I started. I thought maybe the problem was a miscalculation of view size involving padding, but no such luck. A layout with no padding, margins, or scaling whatsoever shows the same bad scaling error. I may try to post a YouTube video of the emulator on a simple test-case, but the quoted XML should be sufficient for anyone to see the issue. On Dec 28 2010, 6:21 pm, iced wrote: > Hello, > I'm new here and I don't know if this is the right place for my > problem. Please excuse me if it's wrong. > I want to create a scale animation where a view grows a bit from it's > original size and then shrinks to it's old size. > My XML file: > > http://schemas.android.com/apk/res/android";> > android:repeatCount="infinite" > android:fromXScale="1.0" > android:toXScale="1.2" > android:fromYScale="1.0" > android:toYScale="1.2" > android:pivotX="50%" > android:pivotY="50%" > android:duration="2000" > android:startOffset="0" /> > android:repeatCount="infinite" > android:fromXScale="1.2" > android:toXScale="1.0" > android:fromYScale="1.2" > android:toYScale="1.0" > android:pivotX="50%" > android:pivotY="50%" > android:duration="2000" > android:startOffset="2000" /> > > When I start this animation the view object grows directly by the > factor 1.2. Then the animation starts and the view grows and shrinks > like I want it. After that there is another jump to the original size > of the view. So there are two jumps, which I don't want and I don't > know how to solve this problem. > Please could you help me. > Thank you -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Animation problem
On Jan 4, 9:21 am, Hari Edo wrote: > I've tried almost exactly the same scenario. It seems like the > fromXScale="1.0" does not match the actual apparent size of the view. > 1.0 was quite a bit bigger than the original view size. Replying to myself, I think this is definitely a defect, but I've only experimented on one (v2.1) SDK level. If I want the throb to go smoothly from 100% -> 120% -> 100%, I need to write the animation to go from 0.8 -> 1.2 -> 0.8 instead. Note that 0.8 is actually the reciprocal, or 1.0/1.2, of my "toXScale" value at the middle of the throb animation set. If I want it to go from 100% -> 130% -> 100% instead, then the same kind of reciprocal math is required to figure out the "fromXScale" values that should be 1.0. I include the relevant fillBefore="false" fillAfter="false" but they actually make no difference here in practice. http://schemas.android.com/apk/res/android"; android:shareInterpolator="false" > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Animation problem
"jerks and jumps" in the emulator, or one the phone? I've found that the emulator is VERY bad at running things at a consistent speed. The phone seems to do a much better job of it. On Wed, Dec 29, 2010 at 1:27 PM, iced wrote: > Thank you for your answer. > I tried all 2^6 combinations of the three flags (fillBefore, > fillAfter, fillEnabled) but the animation still not works. I only want > a pulsate. No matter what I do it is no liquid/smooth animation. It > jerks and jumps. I can't find a solution. I would be grateful for > help. > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en