Advertisement
Guest User

animate

a guest
Sep 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. public void animateCover()
  2.         {
  3.             CoverLeft.Margin = new Thickness(0, 0, 0, 0);
  4.             CoverRight.Margin = new Thickness(0, 0, 0, 0);
  5.  
  6.             DispatcherTimer uiTimer = new DispatcherTimer();
  7.             uiTimer.Tick += new EventHandler(moveCoverSides);
  8.             uiTimer.Interval = new TimeSpan(0, 0, 0, 0, 1000 / 60);
  9.             uiTimer.Start();
  10.  
  11.         }
  12.  
  13.         private void moveCoverSides(object sender, EventArgs e)
  14.         {
  15.             double currentTop = CoverLeft.Margin.Top;
  16.  
  17.             CoverLeft.Margin = new Thickness(0, currentTop-50, 0, -currentTop + 50);
  18.  
  19.             double currentTopRight = CoverRight.Margin.Bottom;
  20.  
  21.             CoverRight.Margin = new Thickness(0, -currentTopRight + 50, 0, currentTopRight - 50);
  22.  
  23.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement