Ejemplo n.º 1
0
        private double GetStepFactor(Canvas canvas)
        {
           if (canvas != null)
           {
              double width = canvas.GetWidth();
              double height = canvas.GetHeight();

              double x = width/2;
              double y = height/2;

              double maxDistance = Math.Min(x, y);
              return maxDistance/10; // assumes that 10 is the maximum gravitational value.
           }
           return 0;
        }
Ejemplo n.º 2
0
       private void DoDraw(Canvas canvas, double stepFactor)
         {
            double width = canvas.GetWidth();
            double height = canvas.GetHeight();

            double x = width/2;
            double y = height/2;

            x += xOrientation * stepFactor;
            y += yOrientation * stepFactor;

            // Set background color
            canvas.DrawColor(Color.BLUE);
            var paint = new Paint();
            paint.TextAlign =(Paint.Align.CENTER);

            // Draw a circle
            paint.Color =(Color.ParseColor("#ffd700"));
            canvas.DrawCircle((float) x, (float) y, 30, paint);
         }