本文整理汇总了C#中System.Windows.Media.Animation.Storyboard.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Storyboard.SetValue方法的具体用法?C# Storyboard.SetValue怎么用?C# Storyboard.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Animation.Storyboard
的用法示例。
在下文中一共展示了Storyboard.SetValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Recorder
public Recorder()
{
storyboard = new Storyboard();
storyboard.BeginTime = TimeSpan.Zero;
storyboard.Duration = TimeSpan.Zero;
storyboard.SetValue(Storyboard.ChildrenProperty, new TimelineCollection());
}
示例2: GameLoop
public GameLoop(FrameworkElement parent, double storyBoardMilliseconds)
{
gameLoop = new Storyboard();
gameLoop.Duration = TimeSpan.FromMilliseconds(storyBoardMilliseconds);
gameLoop.SetValue(FrameworkElement.NameProperty, "gameloop");
parent.Resources.Add("gameloop", gameLoop);
gameLoop.Completed += new EventHandler(gameLoop_Completed);
}
示例3: Attach
public void Attach(Canvas canvas)
{
_storyboard = new Storyboard();
_storyboard.SetValue(FrameworkElement.NameProperty, "gameloop");
canvas.Resources.Add("gameloop", _storyboard);
_lastUpdateTime = DateTime.Now;
_storyboard.Completed += storyboard_Completed;
_storyboard.Begin();
}
示例4: Attach
public void Attach(Canvas canvas, string name, TickDelegate tickEvent, TimeSpan interval)
{
if (this.canvas != null) return;
this.canvas = canvas;
this.tickEvent = tickEvent;
storyboard = new Storyboard();
storyboard.SetValue<string>(Storyboard.NameProperty, name);
canvas.Resources.Add(storyboard);
lastUpdateTime = DateTime.Now;
storyboard.Duration = new Duration(interval);
storyboard.Completed += new EventHandler(Tick);
}
示例5: RenderWaiting_Loaded
private void RenderWaiting_Loaded(object sender, RoutedEventArgs e)
{
if (DesignerProperties.GetIsInDesignMode(this))
{
return;
}
storyboard = Resources["storyboard"] as Storyboard;
if (storyboard != null)
{
storyboard.SetValue(Storyboard.TargetNameProperty, "animationTarget");
storyboard.Begin(animationTarget);
}
}
示例6: MoveWithAnimation
private void MoveWithAnimation(Popup popup, double newVertical)
{
var storyBoard = new Storyboard();
storyBoard.SetValue(Storyboard.TargetProperty, popup);
storyBoard.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("VerticalOffset"));
storyBoard.Children.Add(new DoubleAnimation(popup.VerticalOffset, newVertical, TimeSpan.FromSeconds(0.25)));
storyBoard.Completed += OnStoryBoardCompleted;
storyBoard.Begin();
}
示例7: _SetupYTranslationStoryboard
void _SetupYTranslationStoryboard(TranslateTransform transform, string sbName, double translation)
{
if (Resources.Contains(sbName))
{
Storyboard sb = Resources[sbName] as Storyboard;
DoubleAnimationUsingKeyFrames anim = sb.Children[0] as DoubleAnimationUsingKeyFrames;
SplineDoubleKeyFrame keyFrame = anim.KeyFrames[0] as SplineDoubleKeyFrame;
keyFrame.Value = translation;
}
else
{
Storyboard sb = new Storyboard();
sb.SetValue(FrameworkElement.NameProperty, sbName);
DoubleAnimationUsingKeyFrames anim = new DoubleAnimationUsingKeyFrames();
sb.Children.Add(anim);
Storyboard.SetTarget(anim, transform);
Storyboard.SetTargetProperty(anim, new PropertyPath("Y"));
anim.BeginTime = new TimeSpan(0, 0, 0);
SplineDoubleKeyFrame keyFrame = new SplineDoubleKeyFrame();
KeySpline spline = new KeySpline();
spline.ControlPoint1 = new Point(0, 1);
spline.ControlPoint2 = new Point(1, 1);
keyFrame.KeySpline = spline;
keyFrame.KeyTime = new TimeSpan(0, 0, 1);
keyFrame.Value = translation;
anim.KeyFrames.Add(keyFrame);
Resources.Add(sbName, sb);
}
}
示例8: _AddStoryboard
private void _AddStoryboard(UIElement panel, double value)
{
TransformGroup tGroup = new TransformGroup();
TranslateTransform translate = new TranslateTransform();
translate.Y = 0;
tGroup.Children.Add(translate);
panel.RenderTransform = tGroup;
string sbName = (panel as FrameworkElement).Name + "Animation";
if (Resources.Contains(sbName))
{
Storyboard sb = Resources[sbName] as Storyboard;
DoubleAnimationUsingKeyFrames anim = sb.Children[0] as DoubleAnimationUsingKeyFrames;
SplineDoubleKeyFrame keyFrame = anim.KeyFrames[0] as SplineDoubleKeyFrame;
keyFrame.Value = -(value);
}
else
{
Storyboard sb = new Storyboard();
sb.SetValue(NameProperty, sbName);
DoubleAnimationUsingKeyFrames anim = new DoubleAnimationUsingKeyFrames();
sb.Children.Add(anim);
Storyboard.SetTargetName(anim, (panel as FrameworkElement).Name);
Storyboard.SetTargetProperty(anim, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)"));
anim.BeginTime = new TimeSpan(0, 0, 0);
SplineDoubleKeyFrame keyFrame = new SplineDoubleKeyFrame();
KeySpline spline = new KeySpline();
spline.ControlPoint1 = new Point(0, 1);
spline.ControlPoint2 = new Point(1, 1);
keyFrame.KeySpline = spline;
keyFrame.KeyTime = new TimeSpan(0, 0, 1);
keyFrame.Value = -(value);
anim.KeyFrames.Add(keyFrame);
Resources.Add(sbName, sb);
}
}
示例9: createDoubleAnimation
private static Storyboard createDoubleAnimation(DependencyObject p, bool expanded)
{
DoubleAnimation a = new DoubleAnimation();
a.Duration = new TimeSpan(0, 0, 0, 0, 200);
Storyboard.SetTargetProperty(a, new PropertyPath(HeightProperty));
CircleEase b = new CircleEase();
b.EasingMode = EasingMode.EaseOut;
a.EasingFunction = b;
if (expanded)
{
a.From = (double)p.GetValue(CRMAppBar.ClosedHeightProperty);
a.To = (double)p.GetValue(CRMAppBar.PanelHeightProperty);
}
else
{
a.From = (double)p.GetValue(CRMAppBar.PanelHeightProperty);
a.To = (double)p.GetValue(CRMAppBar.ClosedHeightProperty);
}
Storyboard sb = new Storyboard();
sb.SetValue(Storyboard.TargetProperty, p);
sb.Children.Add(a);
return sb;
}
示例10: OnCompositionTargetRendering
//.........这里部分代码省略.........
Polyline polyline = new Polyline
{
StrokeThickness = this.Brightness,
Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0, 0xFF, 0)),
StrokeStartLineCap = PenLineCap.Round,
StrokeEndLineCap = PenLineCap.Round,
StrokeLineJoin = PenLineJoin.Round
};
PointCollection points = polyline.Points;
#endif
// Interpolate from lastDateTime to current dateTime
int milliseconds = (int)(dateTime - lastDateTime).TotalMilliseconds;
for (int msec = 0; msec <= milliseconds; msec++)
{
DateTime dt = lastDateTime + TimeSpan.FromMilliseconds(msec);
Point point = new Point(0.5 * LayoutRoot.ActualWidth * (1 + XProvider.GetAxisValue(dt)),
0.5 * LayoutRoot.ActualHeight * (1 + YProvider.GetAxisValue(dt)));
points.Add(point);
}
lastDateTime = dateTime;
#if USE_CANVAS_WITH_ANIMATION_FADEOUT
ColorAnimation anima = new ColorAnimation
{
To = Color.FromArgb(0, 0, 0xFF, 0),
Duration = TimeSpan.FromSeconds(this.Persistence)
};
Storyboard.SetTarget(anima, polyline.Stroke as SolidColorBrush);
Storyboard.SetTargetProperty(anima, new PropertyPath(SolidColorBrush.ColorProperty));
Storyboard storyboard = new Storyboard();
storyboard.SetValue(Oscilloscope.AnimatedObjectProperty, polyline);
storyboard.Children.Add(anima);
storyboard.Completed += new EventHandler(storyboard_Completed);
storyboard.Begin();
#endif
#if USE_CANVAS
screenCanvas.Children.Add(polyline);
#elif USE_WRITEABLEBITMAP_WITH_POLYLINE
writeableBitmap.Render(polyline, null);
#else // USE_WRITEABLEBITMAP_WITH_OUTLINE_FILL
lineList.Clear();
for (int i = 0; i < points.Count - 1; i++)
{
RoundCappedLine line = new RoundCappedLine(points[i], points[i + 1], this.Brightness / 2);
lineList.Add(line);
}
for (int y = 0; y < writeableBitmap.PixelHeight; y++)
{
xCollection.Clear();
foreach (RoundCappedLine line in lineList)
line.GetAllX(y, xCollection);
if (xCollection.Count > 0)
{
int rowIndex = y * writeableBitmap.PixelWidth;
for (int pair = 0; pair < xCollection.Count; pair += 2)
{
int x1 = (int)xCollection[pair];
int x2 = (int)xCollection[pair + 1];
if (x1 != x2)
{
int xMin = Math.Max(0, Math.Min(writeableBitmap.PixelWidth - 1, Math.Min(x1, x2)));
int xMax = Math.Max(0, Math.Min(writeableBitmap.PixelWidth - 1, Math.Max(x1, x2)));
for (int x = xMin; x < xMax; x++)
{
writeableBitmap.Pixels[rowIndex + x] = beamPixel;
}
}
}
}
}
#endif
}
#if USE_WRITEABLEBITMAP
writeableBitmap.Invalidate();
#endif
}