Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.PathAnimation);

            button      = FindViewById <Button>(Resource.Id.button);
            buttonProxy = AnimatorProxy.Wrap(button);

            var density = Resources.DisplayMetrics.Density;

            // Set up the path we're animating along
            var path = new AnimatorPath();

            path.MoveTo(0 * density, 0 * density);
            path.LineTo(0 * density, 300 * density);
            path.CurveTo(100 * density, 0 * density,
                         300 * density, 900 * density,
                         400 * density, 500 * density);

            // Set up the animation
            var points = path.Points.Select(p => (Java.Lang.Object)p).ToArray();
            var anim   = ObjectAnimator.OfObject(this, "buttonLocation", new PathEvaluator(), points);

            anim.SetDuration(1000);

            button.Click += delegate
            {
                anim.Start();
            };
        }
Exemplo n.º 2
0
 public void SetAnimatorController(RuntimeAnimatorController controller)
 {
     if (animator.runtimeAnimatorController != controller)
     {
         if (actor != null)
         {
             actor.Destroy();
         }
         animator.runtimeAnimatorController = controller;
         actor = animator.GetBehaviour <AnimatorProxy>();
         actor.Init(animator);
     }
 }