[mono-android] AnimationSet and animation questions

Sayed Arian Kooshesh kooshesh at gmail.com
Sat Dec 29 18:43:00 UTC 2012


I could bind libgdx. It'd take about 2 weeks.

On Sat, Dec 29, 2012 at 10:45 AM, Paul Johnson
<paul at all-the-johnsons.co.uk>wrote:

> Hi,
>
> I've decided to go native with my animation and only use what is in there.
> My device is 2.3, so it's the basics.
>
> I've got my view set up with an image view in it and have set up an
> AnimationSet to store what I want in it. From what I've read, this looks
> right.
>
> Problem is, only the last animation is ever displayed.
>
>                         AnimationSet animation = new AnimationSet (true);
>                         animation.Interpolator = new CycleInterpolator (6);
>                         animation.FillAfter = true;
>
>                         TranslateAnimation tanim = new TranslateAnimation
> (0f, 200f, 200f, 0f);
>                         tanim.Duration = 2000;
>                         tanim.FillAfter = true;
>                         animation.AddAnimation (tanim);
>
>                         RotateAnimation ranim = new RotateAnimation (0f,
> -359.9f, 180f, 180f);
>                         ranim.Duration = 600;
>                         ranim.FillAfter = true;
>                         ranim.RepeatCount = 5;
>                         animation.AddAnimation (ranim);
>
>                         RotateAnimation ranim2 = new RotateAnimation
> (-359.9f, 0f, 0f, 0f);
>                         ranim2.Duration = 600;
>                         ranim2.FillAfter = true;
>                         ranim2.RepeatCount = 5;
>                         animation.AddAnimation (ranim2);
>
>                         foreach (Animation anim in animation.Animations) {
>                                 animate.Animation = anim;
>                                 animate.StartAnimation (anim);
>                         }
>
> animation.Animations shows there are 3 animations in there.
>
> What I'm also trying to do is to replicate the XML in the Xamarin examples
> (so for example
>
> <set xmlns:android="http://schemas.**android.com/apk/res/android<http://schemas.android.com/apk/res/android>
> "
>     android:interpolator="@**android:anim/linear_**interpolator">
>   <rotate
>       android:fromDegrees="0"
>       android:toDegrees="360"
>       android:pivotX="50%"
>       android:pivotY="50%"
>       android:duration="2000"
>       android:startOffset="0"/>
> </set>
>
> becomes more like ranim or ranim2. I think I have from/toDegrees correct
> in the ranim constructor, but can't find a way of setting the pivot)
>
> So the question above all, am I doing this the right way. I cannot use XML
> for this as my drawing animations are dependent on data from elsewhere
> (such as an XML file sent to me).
>
> Thanks
>
> Paul
> --
> "Space," it says, "is big. Really big. You just won't believe how vastly,
> hugely, mindbogglingly big it is. I mean, you may think it's a long way
> down the road to the chemist's, but that's just peanuts to space, listen..."
> Hitch Hikers Guide to the Galaxy, a truly remarkable book!
>
> ______________________________**_________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/**mailman/listinfo/monodroid<http://lists.ximian.com/mailman/listinfo/monodroid>
>



-- 
Extreme Knowledge is not something for which he programs a computer but for
which his computer is programming him.

-Wozniak


   - if my programming advice has helped you, feel free to donate to :
<https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KYUXV2PG88YQQ>

<https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KYUXV2PG88YQQ>
<https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KYUXV2PG88YQQ>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20121229/8761d67e/attachment-0001.html>


More information about the Monodroid mailing list