Class AnimationHelpers
- Namespace
- HeBianGu.General.WpfControlLib
- Assembly
- HeBianGu.General.WpfControlLib.dll
Encapsulates methods and properties for handling animations.
public static class AnimationHelpers
- Inheritance
-
AnimationHelpers
- Inherited Members
Fields
HeightPercentageProperty
Identifies the HeightPercentage attached property.
public static readonly DependencyProperty HeightPercentageProperty
Field Value
WidthPercentageProperty
Identifies the WidthPercentage attached property.
public static readonly DependencyProperty WidthPercentageProperty
Field Value
Methods
AddAnimation(Storyboard, Timeline, string, DependencyProperty)
Adds the animation to the storyboard.
public static void AddAnimation(this Storyboard storyboard, Timeline timeline, string targetName, DependencyProperty property)
Parameters
storyboardStoryboardThe storyboard.
timelineTimelineThe timeline.
targetNamestringName of the target.
propertyDependencyPropertyThe property.
AddAnimation(Storyboard, Timeline, DependencyObject, DependencyProperty)
Adds the animation to the storyboard.
public static void AddAnimation(this Storyboard storyboard, Timeline timeline, DependencyObject target, DependencyProperty property)
Parameters
storyboardStoryboardThe storyboard.
timelineTimelineThe timeline.
targetDependencyObjectThe target.
propertyDependencyPropertyThe property.
AddLinearAnimation<TAnimation, T>(Storyboard, PropertyPath, T?, T?, Duration)
Creates and adds an AnimationTimeline to a Storyboard.
public static TAnimation AddLinearAnimation<TAnimation, T>(this Storyboard storyboard, PropertyPath path, T? from, T? to, Duration duration) where TAnimation : AnimationTimeline, new() where T : struct
Parameters
storyboardStoryboardThe storyboard.
pathPropertyPathThe path.
fromT?From.
toT?To.
durationDurationThe duration.
Returns
- TAnimation
Type Parameters
TAnimationThe type of the animation.
T
AttachCompletedEventHandler(Timeline, EventHandler)
Attaches the specified event handler to the Timeline.Completed event.
public static void AttachCompletedEventHandler(this Timeline timeline, EventHandler handler)
Parameters
timelineTimelineThe timeline.
handlerEventHandlerThe handler.
CreateAnimation(double, double)
创建一个Double动画
public static DoubleAnimation CreateAnimation(double toValue, double milliseconds = 200)
Parameters
Returns
CreateAnimation(Thickness, double)
创建一个Thickness动画
public static ThicknessAnimation CreateAnimation(Thickness thickness = default, double milliseconds = 200)
Parameters
Returns
GetHeightPercentage(FrameworkElement)
Gets the height percentage.
public static int GetHeightPercentage(FrameworkElement obj)
Parameters
objFrameworkElementThe obj.
Returns
GetReversedStoryboard(Storyboard)
Returns a cloned Storyboard where the To and From properties of the AnimationTimeline have been switched.
public static Storyboard GetReversedStoryboard(this Storyboard storyboard)
Parameters
storyboardStoryboardThe storyboard.
Returns
GetWidthPercentage(FrameworkElement)
Gets the width percentage.
public static int GetWidthPercentage(FrameworkElement obj)
Parameters
objFrameworkElementThe obj.
Returns
ReverseStoryboard(Storyboard)
Switches between the To and From properties of the each AnimationTimeline in the Storyboard.
public static void ReverseStoryboard(this Storyboard storyboard)
Parameters
storyboardStoryboardThe storyboard.
SetHeightPercentage(FrameworkElement, int)
Sets the height percentage.
public static void SetHeightPercentage(FrameworkElement obj, int value)
Parameters
objFrameworkElementThe obj.
valueintThe value.
SetWidthPercentage(FrameworkElement, int)
Sets the width percentage.
public static void SetWidthPercentage(FrameworkElement obj, int value)
Parameters
objFrameworkElementThe obj.
valueintThe value.