private async void PressBeganEffect(object sender, PositionEventArgs e) { lock (TapLocker) _isTaped = false; if (AnimationEffect == AnimationType.atScaling) { await this.ScaleTo(1 + (AnimationScale / 100), AnimationSpeed, Easing.CubicOut); } else if (AnimationEffect == AnimationType.atFlashingTap && !_animateFlashBox.IsVisible) { _animateFlashBox.TranslationX = e.PositionX - _mainContent.Width / 2; _animateFlashBox.IsVisible = true; _animateFlashBox.Animate( "AnimateFlashBox", t => t * _mainContent.Width, x => { _animateFlashBox.WidthRequest = x; var delta = _mainContent.Width / 2 - Math.Abs(_animateFlashBox.TranslationX) - x / 2; if (delta < 0) { if (_animateFlashBox.TranslationX < 0) { _animateFlashBox.TranslationX -= delta; } else { _animateFlashBox.TranslationX += delta; } } }, 16, AnimationSpeed, Easing.SinOut, (x, y) => { _animateFlashBox.WidthRequest = 1; _animateFlashBox.IsVisible = false; }); } else if (AnimationEffect == AnimationType.atFlashing && !_animateFlashBox.IsVisible) { _animateFlashBox.TranslationX = 0; _animateFlashBox.IsVisible = true; _animateFlashBox.Animate( "AnimateFlashBox", t => t * _mainContent.Width, x => _animateFlashBox.WidthRequest = x, 16, AnimationSpeed, Easing.SinOut, (x, y) => { _animateFlashBox.WidthRequest = 1; _animateFlashBox.IsVisible = false; }); } }
private async void PressBeganEffect(object sender, PositionEventArgs e) { lock (TapLocker) _isTaped = false; if (AnimationEffect == AnimationType.atScaling) { await this.ScaleTo(1 + (AnimationScale/100), AnimationSpeed, Easing.CubicOut); } else if (AnimationEffect == AnimationType.atFlashingTap && !_animateFlashBox.IsVisible) { _animateFlashBox.TranslationX = e.PositionX - _mainContent.Width/2; _animateFlashBox.IsVisible = true; _animateFlashBox.Animate( "AnimateFlashBox", (t) => t*_mainContent.Width, (x) => { _animateFlashBox.WidthRequest = x; var delta = _mainContent.Width/2 - Math.Abs(_animateFlashBox.TranslationX) - x/2; if (delta < 0) { if (_animateFlashBox.TranslationX < 0) _animateFlashBox.TranslationX -= delta; else _animateFlashBox.TranslationX += delta; } }, 16, AnimationSpeed, Easing.SinOut, (x, y) => { _animateFlashBox.WidthRequest = 1; _animateFlashBox.IsVisible = false; }); } else if (AnimationEffect == AnimationType.atFlashing && !_animateFlashBox.IsVisible) { _animateFlashBox.TranslationX = 0; _animateFlashBox.IsVisible = true; _animateFlashBox.Animate( "AnimateFlashBox", (t) => t*_mainContent.Width, (x) => { _animateFlashBox.WidthRequest = x; }, 16, AnimationSpeed, Easing.SinOut, (x, y) => { _animateFlashBox.WidthRequest = 1; _animateFlashBox.IsVisible = false; }); } }