当前位置: 首页>>代码示例>>C#>>正文


C# Storyboard.SetValue方法代码示例

本文整理汇总了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());
 }
开发者ID:mono,项目名称:lunareclipse,代码行数:7,代码来源:Recorder.cs

示例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);
 }
开发者ID:splinter,项目名称:FantasyElementsRPG,代码行数:8,代码来源:GameLoop.cs

示例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();
 }
开发者ID:rbrother,项目名称:seikkailulaakso,代码行数:9,代码来源:GameLoop.cs

示例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);
 }
开发者ID:darwin,项目名称:silverstunts,代码行数:12,代码来源:Timer.cs

示例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);
            }
        }
开发者ID:pJqEM5Kj,项目名称:stuff,代码行数:14,代码来源:RenderWaiting.xaml.cs

示例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();
 }
开发者ID:JordanZaerr,项目名称:WPFNotifyIcon,代码行数:9,代码来源:TaskbarIcon.cs

示例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);
     }
 }
开发者ID:Marbulinek,项目名称:NIS,代码行数:29,代码来源:PatientBanner.cs

示例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);
            }
        }
开发者ID:Marbulinek,项目名称:NIS,代码行数:37,代码来源:ExtenPanelContainer.cs

示例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;
        }
开发者ID:hihack,项目名称:CRM.Mobile,代码行数:26,代码来源:CRMAppBar.cs

示例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
            
        }
开发者ID:vvalotto,项目名称:PlataformaNET,代码行数:101,代码来源:Oscilloscope.xaml.cs


注:本文中的System.Windows.Media.Animation.Storyboard.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。