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
storyboard
StoryboardThe storyboard.
timeline
TimelineThe timeline.
targetName
stringName of the target.
property
DependencyPropertyThe 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
storyboard
StoryboardThe storyboard.
timeline
TimelineThe timeline.
target
DependencyObjectThe target.
property
DependencyPropertyThe 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
storyboard
StoryboardThe storyboard.
path
PropertyPathThe path.
from
T?From.
to
T?To.
duration
DurationThe duration.
Returns
- TAnimation
Type Parameters
TAnimation
The 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
timeline
TimelineThe timeline.
handler
EventHandlerThe 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
obj
FrameworkElementThe 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
storyboard
StoryboardThe storyboard.
Returns
GetWidthPercentage(FrameworkElement)
Gets the width percentage.
public static int GetWidthPercentage(FrameworkElement obj)
Parameters
obj
FrameworkElementThe 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
storyboard
StoryboardThe storyboard.
SetHeightPercentage(FrameworkElement, int)
Sets the height percentage.
public static void SetHeightPercentage(FrameworkElement obj, int value)
Parameters
obj
FrameworkElementThe obj.
value
intThe value.
SetWidthPercentage(FrameworkElement, int)
Sets the width percentage.
public static void SetWidthPercentage(FrameworkElement obj, int value)
Parameters
obj
FrameworkElementThe obj.
value
intThe value.