public MarketItem() { InitializeComponent(); RotateTimer.Tick += delegate { var point = GetPerspectiveRotation(); Perspective.RotationX = point.X; Perspective.RotationY = point.Y; if (!IsMouseOver) { MarketItem_MouseLeave(this, null); } }; resetRotationAnim.EasingFunction = rotateEase; resetRotationAnim.Duration = rotateTime; resetRotationAnim.Completed += delegate { Perspective.BeginAnimation(Planerator.RotationXProperty, null); Perspective.BeginAnimation(Planerator.RotationYProperty, null); Perspective.RotationX = 0; Perspective.RotationY = 0; }; scaleUpAnim.EasingFunction = scaleEase; scaleUpAnim.Duration = scaleTime; scaleDownAnim.EasingFunction = scaleEase; scaleDownAnim.Duration = scaleTime; }
private void MarketItem_MouseEnter(Object sender, MouseEventArgs e) { var point = GetPerspectiveRotation(); DoubleAnimation xRotationAnim = new DoubleAnimation() { To = point.X, Duration = rotateTime, EasingFunction = rotateEase }; DoubleAnimation yRotationAnim = new DoubleAnimation() { To = point.Y, Duration = rotateTime, EasingFunction = rotateEase }; yRotationAnim.Completed += delegate { RotateTimer.Start(); Perspective.BeginAnimation(Planerator.RotationXProperty, null); Perspective.BeginAnimation(Planerator.RotationYProperty, null); }; Perspective.BeginAnimation(Planerator.RotationXProperty, xRotationAnim); Perspective.BeginAnimation(Planerator.RotationYProperty, yRotationAnim); }
private void ResetPerspective() { Perspective.BeginAnimation(Planerator.RotationXProperty, resetRotationAnim); Perspective.BeginAnimation(Planerator.RotationYProperty, resetRotationAnim); }