/// <summary> /// when tap to lockscreen, plays animation /// </summary> /// <param name="arg"></param> /// <returns></returns> private bool OnTap(Point arg) { var screenAnimation = new FunctionBasedAnimation(FunctionBasedAnimation.Functions.Linear) { Duration = 1000, From = 100, To = 0, OnAnimation = v => { Location = new Point(-(int)(Math.Round(Math.Abs(Math.Sin(v / 10.0) * v))), 0); Update(); }, OnAnimationStop = () => { Location = new Point(0, 0); }, }; StoryBoard.BeginPlay(screenAnimation); return true; }
/// <summary> /// when tap to lockscreen, plays animation /// </summary> /// <param name="arg"></param> /// <returns></returns> private bool OnTap(Point arg) { if (_mediaPlayer.Visible) { if (arg.Y < (_mediaPlayer.Location.Y + _mediaPlayer.Size.Height + 50) && (arg.Y > _mediaPlayer.Location.Y)) { return true; } } if (!_enabledScreenAnimation) { return true; } var screenAnimation = new FunctionBasedAnimation(FunctionBasedAnimation.Functions.Linear) { Duration = 1000, From = 100, To = 0, OnAnimation = v => { Location = new Point(-(int)(Math.Round(Math.Abs(Math.Sin(v / 10.0) * v))),0); Update(); }, OnAnimationStop = () => { Location = new Point(0, 0); }, }; StoryBoard.BeginPlay(screenAnimation); return true; }
private void SwitchScreen(int fromSection, int toSection) { //!! todo - перенести потом в локскрин AllKeys(toSection == 0); OnDeactivate(); var oldSection = _sections[fromSection] as IVisible; if (oldSection != null) oldSection.Visible = false; //var animateArrow = (toPage + fromPage >= 2); //var ArrowPosFrom = (toPage == 1) ? ArrowPos2 : ArrowPos1; //var arrowPosTo = (toPage == 1) ? ArrowPos1 : ArrowPos2; var screenAnimation = new FunctionBasedAnimation(FunctionBasedAnimation.Functions.Linear) { Duration = 300, From = _sections[fromSection].Location.X, To = _sections[toSection].Location.X, OnAnimation = v => { _homeScreenCanvas.Location = new Point(-v, 0); _homeScreenCanvas.Update(); /* пока слишком медленно if (animateArrow) { var ArrowPos = ArrowPosFrom + (ArrowPosTo - ArrowPosFrom) * (v - _pages[fromPage].Location.X) / (_pages[toPage].Location.X - _pages[fromPage].Location.X); _switchArrow.Location = new Point(ArrowPos, _switchArrow.Location.Y); _switchArrow.Update(); } */ }, OnAnimationStop = () => { /* if (toPage == 1) _switchArrow.Next(); else _switchArrow.Prev(); _switchArrow.Location = new Point(arrowPosTo, _switchArrow.Location.Y); _switchArrow.Update(); */ var newSection = _sections[toSection] as IVisible; if (newSection != null) newSection.Visible = true; OnActivated(); }, }; StoryBoard.BeginPlay(screenAnimation); }