本文整理汇总了C#中FrameworkElement.AnimateProperty方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkElement.AnimateProperty方法的具体用法?C# FrameworkElement.AnimateProperty怎么用?C# FrameworkElement.AnimateProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameworkElement
的用法示例。
在下文中一共展示了FrameworkElement.AnimateProperty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAnimation
public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
{
var transform = GetTransform(element);
var list = new List<Timeline>
{
element.AnimateProperty(AnimationProperty.Opacity)
.AddEasingKeyFrame(0.0, 0)
.AddEasingKeyFrame(Duration, 1),
};
if (Math.Abs(DistanceX) > 0)
{
list.Add(
element.AnimateProperty(AnimationProperty.TranslateX)
.AddEasingKeyFrame(0.0, transform.TranslateX + DistanceX)
.AddEasingKeyFrame(Duration, transform.TranslateX, new CubicEase()));
}
if (Math.Abs(DistanceY) > 0)
{
list.Add(
element.AnimateProperty(AnimationProperty.TranslateY)
.AddEasingKeyFrame(0.0, transform.TranslateY + DistanceY)
.AddEasingKeyFrame(Duration, transform.TranslateY, new CubicEase()));
}
return list;
}
示例2: CreateAnimation
public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
{
var transform = GetTransform(element);
var animations = new List<Timeline>();
if (Math.Abs(DistanceY) > 0.001)
animations.Add(
element.AnimateProperty(AnimationProperty.TranslateY)
.AddEasingKeyFrame(0.0, transform.TranslateY)
.AddEasingKeyFrame(Duration * 0.2, transform.TranslateY)
.AddEasingKeyFrame(Duration * 0.4, transform.TranslateY + DistanceY)
.AddEasingKeyFrame(Duration * 0.5, transform.TranslateY)
.AddEasingKeyFrame(Duration * 0.6, transform.TranslateY + (DistanceY / 2))
.AddEasingKeyFrame(Duration * 0.8, transform.TranslateY)
.AddEasingKeyFrame(Duration, transform.TranslateY)
);
if (Math.Abs(DistanceX) > 0.001)
animations.Add(
element.AnimateProperty(AnimationProperty.TranslateX)
.AddEasingKeyFrame(0.0, transform.TranslateX)
.AddEasingKeyFrame(Duration * 0.2, transform.TranslateX)
.AddEasingKeyFrame(Duration * 0.4, transform.TranslateX + DistanceX)
.AddEasingKeyFrame(Duration * 0.5, transform.TranslateX)
.AddEasingKeyFrame(Duration * 0.6, transform.TranslateX + (DistanceX / 2))
.AddEasingKeyFrame(Duration * 0.8, transform.TranslateX)
.AddEasingKeyFrame(Duration, transform.TranslateX)
);
return animations;
}
示例3: CreateAnimation
public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
{
var transform = GetTransform(element);
return new Timeline[]
{
element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
.AddDiscreteKeyFrame(0.0, new Point(0, 1)),
element.AnimateProperty(AnimationProperty.Opacity)
.AddEasingKeyFrame(0.0, 0)
.AddEasingKeyFrame(Duration, 1),
element.AnimateProperty(AnimationProperty.TranslateX)
.AddEasingKeyFrame(0.0, transform.TranslateX - 700)
.AddEasingKeyFrame(Duration*0.6, transform.TranslateX + 30, new QuadraticEase())
.AddEasingKeyFrame(Duration*0.8, transform.TranslateX),
element.AnimateProperty(AnimationProperty.SkewX)
.AddEasingKeyFrame(0.0, 30)
.AddEasingKeyFrame(Duration*0.6, -30)
.AddEasingKeyFrame(Duration*0.8, 15)
.AddEasingKeyFrame(Duration, 0),
};
}
示例4: CreateAnimation
public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
{
return new Timeline[]
{
element.AnimateProperty(AnimationProperty.Opacity)
.AddDiscreteKeyFrame(0.0, 1),
element.AnimateProperty(AnimationProperty.Rotation)
.AddDiscreteKeyFrame(0.0, 0),
element.AnimateProperty(AnimationProperty.TranslateX)
.AddDiscreteKeyFrame(0.0, 0),
element.AnimateProperty(AnimationProperty.TranslateY)
.AddDiscreteKeyFrame(0.0, 0),
element.AnimateProperty(AnimationProperty.ScaleX)
.AddDiscreteKeyFrame(0.0, 1),
element.AnimateProperty(AnimationProperty.ScaleY)
.AddDiscreteKeyFrame(0.0, 1),
element.AnimateProperty(AnimationProperty.RotationX)
.AddDiscreteKeyFrame(0.0, 0),
element.AnimateProperty(AnimationProperty.RotationY)
.AddDiscreteKeyFrame(0.0, 0),
element.AnimateProperty(AnimationProperty.RotationZ)
.AddDiscreteKeyFrame(0.0, 0),
element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
.AddDiscreteKeyFrame(0.0, new Point(0.5, 0.5)),
};
}
示例5: CreateAnimation
public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
{
return new Timeline[]
{
element.AnimateProperty(AnimationProperty.CentreOfRotationX)
.AddDiscreteKeyFrame(0.0, 0),
element.AnimateProperty(AnimationProperty.RotationY)
.AddEasingKeyFrame(0, 80)
.AddEasingKeyFrame(Duration, 0, new QuadraticEase()),
element.AnimateProperty(AnimationProperty.Opacity)
.AddEasingKeyFrame(0.0, 1),
};
}
示例6: CreateAnimation
public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
{
var transform = GetTransform(element);
if (Side == Side.Left)
return new Timeline[]
{
element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
.AddDiscreteKeyFrame(0.0, new Point(0,0)),
element.AnimateProperty(AnimationProperty.Rotation)
.AddEasingKeyFrame(0.0, 0, new CubicEase {EasingMode = EasingMode.EaseInOut})
.AddEasingKeyFrame(Duration*0.2, 80, new CubicEase {EasingMode = EasingMode.EaseInOut})
.AddEasingKeyFrame(Duration*0.4, 60, new CubicEase {EasingMode = EasingMode.EaseInOut})
.AddEasingKeyFrame(Duration*0.6, 80, new CubicEase {EasingMode = EasingMode.EaseInOut})
.AddEasingKeyFrame(Duration*0.8, 60, new CubicEase {EasingMode = EasingMode.EaseInOut})
.AddEasingKeyFrame(Duration, 70),
element.AnimateProperty(AnimationProperty.TranslateY)
.AddEasingKeyFrame(Duration*0.7, transform.TranslateY)
.AddEasingKeyFrame(Duration, transform.TranslateY + Distance, new CubicEase { EasingMode = EasingMode.EaseIn}),
element.AnimateProperty(AnimationProperty.Opacity)
.AddEasingKeyFrame(0.0, 1)
.AddEasingKeyFrame(Duration*0.9, 1)
.AddEasingKeyFrame(Duration, 0),
};
return new Timeline[]
{
element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
.AddDiscreteKeyFrame(0.0, new Point(1,0)),
element.AnimateProperty(AnimationProperty.Rotation)
.AddEasingKeyFrame(0.0, 0, new CubicEase {EasingMode = EasingMode.EaseInOut})
.AddEasingKeyFrame(Duration*0.2, -80, new CubicEase {EasingMode = EasingMode.EaseInOut})
.AddEasingKeyFrame(Duration*0.4, -60, new CubicEase {EasingMode = EasingMode.EaseInOut})
.AddEasingKeyFrame(Duration*0.6, -80, new CubicEase {EasingMode = EasingMode.EaseInOut})
.AddEasingKeyFrame(Duration*0.8, -60, new CubicEase {EasingMode = EasingMode.EaseInOut})
.AddEasingKeyFrame(Duration,-70),
element.AnimateProperty(AnimationProperty.TranslateY)
.AddEasingKeyFrame(Duration*0.7, transform.TranslateY)
.AddEasingKeyFrame(Duration, transform.TranslateY + Distance, new CubicEase { EasingMode = EasingMode.EaseIn}),
element.AnimateProperty(AnimationProperty.Opacity)
.AddEasingKeyFrame(0.0, 1)
.AddEasingKeyFrame(Duration*0.9, 1)
.AddEasingKeyFrame(Duration, 0),
};
}
示例7: CreateAnimation
public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
{
return new Timeline[]
{
element.AnimateProperty(AnimationProperty.Opacity)
.AddEasingKeyFrame(0.0, 0)
.AddEasingKeyFrame(Duration/2, 1)
.AddEasingKeyFrame(Duration, 1),
element.AnimateProperty(AnimationProperty.ScaleX)
.AddEasingKeyFrame(0.0, StartScale)
.AddEasingKeyFrame(Duration, 1.0, new CubicEase()),
element.AnimateProperty(AnimationProperty.ScaleY)
.AddEasingKeyFrame(0.0, StartScale)
.AddEasingKeyFrame(Duration, 1.0, new CubicEase()),
};
}
示例8: CreateAnimation
public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
{
return new Timeline[]
{
element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
.AddDiscreteKeyFrame(0.0, new Point(HorizontalCentre, 0.5)),
element.AnimateProperty(AnimationProperty.ScaleX)
.AddEasingKeyFrame(0.0, 1)
.AddEasingKeyFrame(Duration, 0.95), //, new CubicEase { EasingMode = EasingMode.EaseIn });
element.AnimateProperty(AnimationProperty.ScaleY)
.AddEasingKeyFrame(0.0, 1)
.AddEasingKeyFrame(Duration, 0.95), //, new CubicEase { EasingMode = EasingMode.EaseIn });
element.AnimateProperty(AnimationProperty.Opacity)
.AddEasingKeyFrame(0.0, 1)
.AddEasingKeyFrame(Duration/4, 1)
.AddEasingKeyFrame(Duration, 0.7),
};
}
示例9: CreateAnimation
public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
{
var transform = GetTransform(element);
var list = new List<Timeline>();
if (FromDirection != ZDirection.Steady)
{
list.Add(
element.AnimateProperty(AnimationProperty.ScaleX)
.AddEasingKeyFrame(0.0, (FromDirection == ZDirection.Away ? 0.3 : 2.0))
.AddEasingKeyFrame(Duration, 1, new BackEase {Amplitude = Amplitude}));
list.Add(
element.AnimateProperty(AnimationProperty.ScaleY)
.AddEasingKeyFrame(0.0, (FromDirection == ZDirection.Away ? 0.3 : 2.0))
.AddEasingKeyFrame(Duration, 1, new BackEase {Amplitude = Amplitude}));
};
list.Add(
element.AnimateProperty(AnimationProperty.Opacity)
.AddEasingKeyFrame(0.0, 0)
.AddEasingKeyFrame(Duration/4, 1));
if (Math.Abs(DistanceX) > 0)
{
list.Add(
element.AnimateProperty(AnimationProperty.TranslateX)
.AddEasingKeyFrame(0.0, transform.TranslateX + DistanceX)
.AddEasingKeyFrame(Duration, transform.TranslateX, new BackEase {Amplitude = Amplitude}));
}
if (Math.Abs(DistanceY) > 0)
{
list.Add(
element.AnimateProperty(AnimationProperty.TranslateY)
.AddEasingKeyFrame(0.0, transform.TranslateY + DistanceY)
.AddEasingKeyFrame(Duration, transform.TranslateY, new BackEase {Amplitude = Amplitude}));
}
return list;
}
示例10: CreateAnimation
public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
{
double startRotation = 0.0;
double endRotation;
if (StartRotation.HasValue)
startRotation = StartRotation.Value;
else
{
var compositeTransform = element.RenderTransform as CompositeTransform;
if (compositeTransform != null)
startRotation = compositeTransform.Rotation;
}
if (EndRotation.HasValue)
endRotation = EndRotation.Value;
else
endRotation = startRotation + 360.0;
return new Timeline[]
{
element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
.AddDiscreteKeyFrame(0.0, new Point(0.5, 0.5)),
element.AnimateProperty(AnimationProperty.Rotation)
.AddEasingKeyFrame(0.0, startRotation)
.AddEasingKeyFrame(Duration, endRotation, Easing)
.AddDiscreteKeyFrame(Duration, startRotation),
};
}