本文整理汇总了C#中System.Windows.Media.Animation.Storyboard.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Storyboard.GetValue方法的具体用法?C# Storyboard.GetValue怎么用?C# Storyboard.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Animation.Storyboard
的用法示例。
在下文中一共展示了Storyboard.GetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyPointChartAnimation
/// <summary>
/// Apply animation for point chart
/// </summary>
/// <param name="pointGrid">Point chart grid</param>
/// <param name="storyboard">Stroyboard</param>
/// <param name="width">Width of the chart canvas</param>
/// <param name="height">Height of the chart canvas</param>
/// <returns>Storyboard</returns>
private static Storyboard ApplyPointChartAnimation(DataSeries currentDataSeries, Panel pointGrid, Storyboard storyboard, Double width, Double height)
{
#if WPF
if (storyboard != null && storyboard.GetValue(System.Windows.Media.Animation.Storyboard.TargetProperty) != null)
storyboard.Stop();
#else
if (storyboard != null)
storyboard.Stop();
#endif
TransformGroup group = new TransformGroup();
ScaleTransform scaleTransform = new ScaleTransform() { ScaleX = 0, ScaleY = 0, CenterX = 0.5, CenterY = 0.5 };
TranslateTransform translateTransform = new TranslateTransform() { X = 0, Y = 0 };
group.Children.Add(scaleTransform);
group.Children.Add(translateTransform);
pointGrid.RenderTransform = group;
Random rand = new Random((Int32)DateTime.Now.Ticks);
double begin = rand.NextDouble();
pointGrid.Measure(new Size(Double.MaxValue, Double.MaxValue));
DoubleCollection times = Graphics.GenerateDoubleCollection(0, 0.5, 0.75, 1);
DoubleCollection scaleValues = Graphics.GenerateDoubleCollection(0, 1, 0.5, 1);
DoubleCollection translateXValues = Graphics.GenerateDoubleCollection(pointGrid.DesiredSize.Width / 2, 0, pointGrid.DesiredSize.Width / 4, 0);
DoubleCollection translateYValues = Graphics.GenerateDoubleCollection(pointGrid.DesiredSize.Height / 2, 0, pointGrid.DesiredSize.Height / 4, 0);
List<KeySpline> splines1 = AnimationHelper.GenerateKeySplineList(new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1));
List<KeySpline> splines2 = AnimationHelper.GenerateKeySplineList(new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1));
List<KeySpline> splines3 = AnimationHelper.GenerateKeySplineList(new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1));
List<KeySpline> splines4 = AnimationHelper.GenerateKeySplineList(new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1), new Point(0, 0.5), new Point(0.5, 1));
DoubleAnimationUsingKeyFrames xScaleAnimation = AnimationHelper.CreateDoubleAnimation(currentDataSeries, scaleTransform, "(ScaleTransform.ScaleX)", begin + 0.5, times, scaleValues, splines1);
DoubleAnimationUsingKeyFrames yScaleAnimation = AnimationHelper.CreateDoubleAnimation(currentDataSeries, scaleTransform, "(ScaleTransform.ScaleY)", begin + 0.5, times, scaleValues, splines2);
DoubleAnimationUsingKeyFrames xTranslateAnimation = AnimationHelper.CreateDoubleAnimation(currentDataSeries, translateTransform, "(TranslateTransform.X)", begin + 0.5, times, translateXValues, splines3);
DoubleAnimationUsingKeyFrames yTranslateAnimation = AnimationHelper.CreateDoubleAnimation(currentDataSeries, translateTransform, "(TranslateTransform.Y)", begin + 0.5, times, translateYValues, splines4);
storyboard.Children.Add(xScaleAnimation);
storyboard.Children.Add(yScaleAnimation);
storyboard.Children.Add(xTranslateAnimation);
storyboard.Children.Add(yTranslateAnimation);
return storyboard;
}
示例2: CreateExplodingIn3DAnimation
/// <summary>
/// Create exploding in animation for 3D Pie/Doughnut
/// </summary>
/// <param name="dataPoint">DataPoint</param>
/// <param name="storyboard">Stroyboard used for animation</param>
/// <param name="pathElements">Path elements reference</param>
/// <param name="label">Label reference</param>
/// <param name="labelLine">Label line reference</param>
/// <param name="unExplodedPoints">Unexploded points</param>
/// <param name="explodedPoints">Exploded points</param>
/// <param name="xOffset">X offset</param>
/// <param name="yOffset">Y offset</param>
/// <returns>Storyboard</returns>
private static Storyboard CreateExplodingIn3DAnimation(DataSeries currentDataSeries, DataPoint dataPoint, Storyboard storyboard, List<Shape> pathElements, Panel label, Path labelLine, PieDoughnut3DPoints unExplodedPoints, PieDoughnut3DPoints explodedPoints, Double xOffset, Double yOffset)
{
DoubleCollection values;
DoubleCollection frames;
List<KeySpline> splines;
#if WPF
if (storyboard != null && storyboard.GetValue(System.Windows.Media.Animation.Storyboard.TargetProperty) != null)
storyboard.Stop();
#else
if (storyboard != null)
storyboard.Stop();
#endif
#region Animating Slice
foreach (Shape path in pathElements)
{
if (path == null) continue;
TranslateTransform translateTransform = path.RenderTransform as TranslateTransform;
values = Graphics.GenerateDoubleCollection(xOffset, 0);
frames = Graphics.GenerateDoubleCollection(0, 0.4);
splines = AnimationHelper.GenerateKeySplineList
(
new Point(0, 0), new Point(1, 1),
new Point(0, 0), new Point(0, 1)
);
DoubleAnimationUsingKeyFrames sliceXAnimation = CreateDoubleAnimation(currentDataSeries, dataPoint, translateTransform, "(TranslateTransform.X)", 0, frames, values, splines);
values = Graphics.GenerateDoubleCollection(yOffset, 0);
frames = Graphics.GenerateDoubleCollection(0, 0.4);
splines = AnimationHelper.GenerateKeySplineList
(
new Point(0, 0), new Point(1, 1),
new Point(0, 0), new Point(0, 1)
);
DoubleAnimationUsingKeyFrames sliceYAnimation = CreateDoubleAnimation(currentDataSeries, dataPoint, translateTransform, "(TranslateTransform.Y)", 0, frames, values, splines);
storyboard.Children.Add(sliceXAnimation);
storyboard.Children.Add(sliceYAnimation);
}
#endregion Animating Slice
#region Animating Label
if (dataPoint.LabelStyle == LabelStyles.Inside)
{
if (label != null)
{
TranslateTransform translateTransform = label.RenderTransform as TranslateTransform;
values = Graphics.GenerateDoubleCollection(xOffset, 0);
frames = Graphics.GenerateDoubleCollection(0, 0.4);
splines = AnimationHelper.GenerateKeySplineList
(
new Point(0, 0), new Point(1, 1),
new Point(0, 0), new Point(0, 1)
);
DoubleAnimationUsingKeyFrames labelXAnimation1 = CreateDoubleAnimation(currentDataSeries, dataPoint, translateTransform, "(TranslateTransform.X)", 0, frames, values, splines);
values = Graphics.GenerateDoubleCollection(yOffset, 0);
frames = Graphics.GenerateDoubleCollection(0, 0.4);
splines = AnimationHelper.GenerateKeySplineList
(
new Point(0, 0), new Point(1, 1),
new Point(0, 0), new Point(0, 1)
);
DoubleAnimationUsingKeyFrames labelYAnimation2 = CreateDoubleAnimation(currentDataSeries, dataPoint, translateTransform, "(TranslateTransform.Y)", 0, frames, values, splines);
storyboard.Children.Add(labelXAnimation1);
storyboard.Children.Add(labelYAnimation2);
}
}
else
{
values = Graphics.GenerateDoubleCollection(explodedPoints.LabelPosition.X, unExplodedPoints.LabelPosition.X);
frames = Graphics.GenerateDoubleCollection(0, 0.4);
splines = AnimationHelper.GenerateKeySplineList
(
new Point(0, 0), new Point(1, 1),
//.........这里部分代码省略.........
示例3: CreateUnExplodingAnimation
internal static Storyboard CreateUnExplodingAnimation(DataSeries dataSeries, DataPoint dataPoint, Storyboard storyboard, Panel visual, Double targetValue)
{
#if WPF
if (storyboard != null && storyboard.GetValue(System.Windows.Media.Animation.Storyboard.TargetProperty) != null)
storyboard.Stop();
#else
if (storyboard != null)
storyboard.Stop();
#endif
Double fromValue = (Double)visual.GetValue(Canvas.TopProperty);
DoubleCollection values = Graphics.GenerateDoubleCollection(fromValue, targetValue);
DoubleCollection frames = Graphics.GenerateDoubleCollection(0, .2);
List<KeySpline> splines = AnimationHelper.GenerateKeySplineList(frames.Count);
DoubleAnimationUsingKeyFrames topAnimation = PieChart.CreateDoubleAnimation(dataSeries, dataPoint, visual, "(Canvas.Top)", 0, frames, values, splines);
storyboard.Children.Add(topAnimation);
return storyboard;
}