Advertisement
proHDscirpts

Untitled

May 27th, 2022
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. Storyboard storyboard = new Storyboard();
  2. TimeSpan duration = TimeSpan.FromMilliseconds(500);
  3. TimeSpan duration2 = TimeSpan.FromMilliseconds(1000);
  4.  
  5. private IEasingFunction Smooth
  6. {
  7. get;
  8. set;
  9. }
  10. = new QuarticEase
  11. {
  12. EasingMode = EasingMode.EaseInOut
  13. };
  14. public void Fade(DependencyObject Object)
  15. {
  16. DoubleAnimation Fade = new DoubleAnimation()
  17. {
  18. From = 0.0,
  19. To = 1.0,
  20. Duration = new Duration(duration),
  21. };
  22. Storyboard.SetTarget(Fade, Object);
  23. Storyboard.SetTargetProperty(Fade, new PropertyPath("Opacity", 1));
  24. storyboard.Children.Add(Fade);
  25. storyboard.Begin();
  26. }
  27.  
  28.  
  29. public void ObjectShift(DependencyObject Object, Thickness Get, Thickness Set)
  30. {
  31. ThicknessAnimation Animation = new ThicknessAnimation()
  32. {
  33. From = Get,
  34. To = Set,
  35. Duration = duration2,
  36. EasingFunction = Smooth,
  37. };
  38. Storyboard.SetTarget(Animation, Object);
  39. Storyboard.SetTargetProperty(Animation, new PropertyPath(MarginProperty));
  40. storyboard.Children.Add(Animation);
  41. storyboard.Begin();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement