當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。