本文整理汇总了C#中System.Windows.Media.Animation.DoubleAnimation.SetTargetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# DoubleAnimation.SetTargetProperty方法的具体用法?C# DoubleAnimation.SetTargetProperty怎么用?C# DoubleAnimation.SetTargetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Animation.DoubleAnimation
的用法示例。
在下文中一共展示了DoubleAnimation.SetTargetProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DialogPanelShow
public void DialogPanelShow(bool bShow)
{
if (bShow) // force visibility since you can't animate the Visible property
{
m_this.Visibility = Visibility.Visible;
if (m_BackgroundElement != null)
m_BackgroundElement.Visibility = Visibility.Visible;
}
Storyboard storyBoard = new Storyboard();
//j m_this.Resources.Add("SomeSortofKeyName", storyBoard);
DoubleAnimation animation = new DoubleAnimation();
animation.From = (bShow ? 0 : 1);
animation.To = (bShow ? 1 : 0);
animation.Duration = TimeSpan.FromSeconds(0.5);
animation.SetTarget(m_RootDialogElement);
animation.SetTargetProperty("(UIElement.Opacity)");
storyBoard.Children.Add(animation);
if (bShow) storyBoard.Completed += ShowCompleted; else storyBoard.Completed += HideCompleted;
storyBoard.Begin();
}
示例2: FadeAnimation
private DoubleAnimation FadeAnimation(bool forward)
{
DoubleAnimation animation = new DoubleAnimation();
//animation.EasingFunction = EasingFunction;
//animation.BeginTime = (forward ? TimeSpan.FromSeconds(DelayForward) : TimeSpan.FromSeconds(DelayReverse));
//animation.Duration = (forward ? TimeSpan.FromSeconds(SecondsForward) : TimeSpan.FromSeconds(SecondsReverse));
animation.Duration = TimeSpan.FromSeconds(1);
//animation.From = (forward ? 0 : 1);
animation.To = (forward ? 1 : 0);
animation.SetTargetProperty("Opacity");
return animation;
}
示例3: TranslateAnimation
private DoubleAnimation TranslateAnimation(bool forward, bool horizontal, double offset)
{
DoubleAnimation animation = new DoubleAnimation();
animation.EasingFunction = (forward ? EasingFunctionForward : EasingFunctionReverse);
animation.BeginTime = (forward ? TimeSpan.FromSeconds(DelayForward) : TimeSpan.FromSeconds(DelayReverse));
animation.Duration = (forward ? TimeSpan.FromSeconds(SecondsForward) : TimeSpan.FromSeconds(SecondsReverse));
//animation.From = (forward ? offset : 0);
animation.To = (forward ? 0 : offset);
string target = (horizontal ? "X" : "Y");
animation.SetTargetProperty(string.Format("(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.{0})", target));
return animation;
}
示例4: ScaleAnimation
private DoubleAnimation ScaleAnimation(bool forward, bool horizontal, double scale)
{
DoubleAnimation animation = new DoubleAnimation();
animation.EasingFunction = EasingFunction;
animation.BeginTime = (forward ? TimeSpan.FromSeconds(DelayForward) : TimeSpan.FromSeconds(DelayReverse));
animation.Duration = (forward ? TimeSpan.FromSeconds(SecondsForward) : TimeSpan.FromSeconds(SecondsReverse));
//animation.From = 0;
animation.To = (forward ? 1 : scale);
string target = (horizontal ? "X" : "Y");
animation.SetTargetProperty(string.Format("(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.Scale{0})", target));
return animation;
}