Beispiel #1
0
        public bool OnTouch(View v, MotionEvent e)
        {
            var  touch     = new SKPoint(e.GetX(), e.GetY());
            bool startAnim = false;

            switch (e.Action)
            {
            case MotionEventActions.Cancel:
                break;

            case MotionEventActions.Down:
                startAnim = true;
                _controlsContainer.Visibility = ViewStates.Invisible;
                break;

            case MotionEventActions.Move:
                startAnim = true;
                break;

            case MotionEventActions.Up:
                _controlsContainer.Visibility = ViewStates.Visible;
                break;
            }

            if (startAnim)
            {
                var touchAnimation = new RandomTouch(_polyLibView.CurrentTriangulation, 12, touch.X, touch.Y, 150);
                _polyLibView.AddAnimation(touchAnimation);
            }

            return(true);
        }
Beispiel #2
0
        void HandleTap(UITapGestureRecognizer recognizer)
        {
            //state doesnt matter here, only executed if tap gesture
            var loc            = recognizer.LocationOfTouch(0, recognizer.View);
            var touchAnimation = new RandomTouch(_currentTriangulation, 6, (float)(loc.X * UIScreen.MainScreen.Scale), (float)(loc.Y * UIScreen.MainScreen.Scale), 250);

            _polyLibViewRef.AddAnimation(touchAnimation);
        }