• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Animation.Storyboard类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Media.Animation.Storyboard的典型用法代码示例。如果您正苦于以下问题:C# Storyboard类的具体用法?C# Storyboard怎么用?C# Storyboard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Storyboard类属于System.Windows.Media.Animation命名空间,在下文中一共展示了Storyboard类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AntGrid

        private void AntGrid(Grid g)
        {
            g.Width = 5;
            g.Height = 5;
            g.Visibility = Visibility.Visible;

            Storyboard sb = new Storyboard();
            DoubleAnimation da = new DoubleAnimation(5.0, gridmain.ActualWidth - 10, new Duration(TimeSpan.FromSeconds(2)));
            DoubleAnimation da1 = new DoubleAnimation(5.0, gridmain.RowDefinitions[0].ActualHeight - 10, new Duration(TimeSpan.FromSeconds(2)));

            DoubleAnimation da2 = new DoubleAnimation(0, 720, new Duration(TimeSpan.FromSeconds(2)));

            TransformGroup tg = new TransformGroup();
            RotateTransform rt = new RotateTransform(720);

            tg.Children.Add(rt);
            g.RenderTransform = tg;
            g.RenderTransformOrigin = new Point(0.5, 0.5);
            Storyboard.SetTarget(da2, g);
            Storyboard.SetTargetProperty(da2, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)"));//RotateTransform.AngleProperty
            sb.Children.Add(da2);

            Storyboard.SetTarget(da, g);
            Storyboard.SetTargetProperty(da, new PropertyPath(Grid.WidthProperty));
            sb.Children.Add(da);

            Storyboard.SetTarget(da1, g);
            Storyboard.SetTargetProperty(da1, new PropertyPath(Grid.HeightProperty));
            sb.Children.Add(da1);

            if (!Resources.Contains("ShowAn"))
                Resources.Add("ShowAn", sb);
            sb.AccelerationRatio = 1.0;
            sb.Begin();
        }
开发者ID:dingxinbei,项目名称:OLdBck,代码行数:35,代码来源:MainWindow.xaml.cs


示例2: Game

        public Game(UserControl userControl, Canvas drawingCanvas, Canvas debugCanvas, TextBlock txtDebug)
        {
            //Initialize
            IsActive = true;
            IsFixedTimeStep = true;
            TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16);
            Components = new List<DrawableGameComponent>();
            World = new World(new Vector2(0, 0));
            _gameTime = new GameTime();
            _gameTime.GameStartTime = DateTime.Now;
            _gameTime.FrameStartTime = DateTime.Now;
            _gameTime.ElapsedGameTime = TimeSpan.Zero;
            _gameTime.TotalGameTime = TimeSpan.Zero;

            //Setup Canvas
            DrawingCanvas = drawingCanvas;
            DebugCanvas = debugCanvas;
            TxtDebug = txtDebug;
            UserControl = userControl;

            //Setup GameLoop
            _gameLoop = new Storyboard();
            _gameLoop.Completed += GameLoop;
            _gameLoop.Duration = TargetElapsedTime;
            DrawingCanvas.Resources.Add("gameloop", _gameLoop);
        }
开发者ID:hilts-vaughan,项目名称:Farseer-Physics,代码行数:26,代码来源:Game.cs


示例3: Window3

 public Window3()
 {
     InitializeComponent();
        delRun = new DelRun(Run);
        delUpdateUI = new DelUpdateUI(UpdateUI);
        sb = (Storyboard)Resources["myAni"];
 }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:7,代码来源:Window3.xaml.cs


示例4: animating3_Completed

        void animating3_Completed(object sender, EventArgs e)
        {
            if(MainWindow.stopGesture)
            {
                myText.Content = "  2";
                var animation2Opacity = new DoubleAnimation();
                animation2Opacity.From = 1.0;
                animation2Opacity.To = 0;
                animation2Opacity.Duration = new Duration(TimeSpan.FromMilliseconds(1000));

                Storyboard.SetTarget(animation2Opacity, myText);
                Storyboard.SetTargetProperty(animation2Opacity, new PropertyPath(UIElement.OpacityProperty));

                Storyboard animating2 = new Storyboard();
                animating2.Children.Add(animation2Opacity);
                animating2.Completed += animating2_Completed;
                animating2.Begin();
            }
            else
            {
                myText.Visibility = Visibility.Collapsed;
                animationStarted = false;
            }

            

        }
开发者ID:Jonathan1,项目名称:MasterThesis-PresentationTrainer,代码行数:27,代码来源:CountDownPause.xaml.cs


示例5: TypewriteTextblock

        private static void TypewriteTextblock(string textToAnimate, TextBlock txt, TimeSpan timeSpan)
        {
            var story = new Storyboard
            {
                FillBehavior = FillBehavior.HoldEnd
            };

            DiscreteStringKeyFrame discreteStringKeyFrame;
            var stringAnimationUsingKeyFrames = new StringAnimationUsingKeyFrames
            {
                Duration = new Duration(timeSpan)
            };

            var tmp = string.Empty;
            foreach (var c in textToAnimate)
            {
                discreteStringKeyFrame = new DiscreteStringKeyFrame
                {
                    KeyTime = KeyTime.Paced
                };
                tmp += c;
                discreteStringKeyFrame.Value = tmp;
                stringAnimationUsingKeyFrames.KeyFrames.Add(discreteStringKeyFrame);
            }

            Storyboard.SetTargetName(stringAnimationUsingKeyFrames, txt.Name);
            Storyboard.SetTargetProperty(stringAnimationUsingKeyFrames, new PropertyPath(TextBlock.TextProperty));
            story.Children.Add(stringAnimationUsingKeyFrames);
            story.Begin(txt);
        }
开发者ID:amoikevin,项目名称:Windows-Phone-Power-Tools,代码行数:30,代码来源:RevealImage.xaml.cs


示例6: Shake

 public void Shake()
 {
     if (sb != null && sb.GetCurrentState() == ClockState.Active)
         return;
     sb = (Storyboard)Resources["shaking"];
     sb.Begin();
 }
开发者ID:huozhi,项目名称:StartConnector,代码行数:7,代码来源:ShakingBall.xaml.cs


示例7: BeginEnterAnimation

        /// <summary>
        /// 登录窗体逐渐缩小动画
        /// </summary>
        private void BeginEnterAnimation()
        {
            NameScope.SetNameScope(this, new NameScope());
            ScaleTransform st = this.RenderTransform as ScaleTransform;
            this.RegisterName("scale", st);

            Storyboard sb = new Storyboard();
            sb.Completed += (s, e) =>
            {
                this.Hide();
                new MainWindow().Show();
            };

            DoubleAnimation daX = new DoubleAnimation();
            daX.To = 0;
            daX.Duration = TimeSpan.FromSeconds(0.3);

            DoubleAnimation daY = new DoubleAnimation();
            daY.To = 0;
            daY.Duration = TimeSpan.FromSeconds(0.3);

            Storyboard.SetTargetName(daX, "scale");
            Storyboard.SetTargetProperty(daX, new PropertyPath(ScaleTransform.ScaleXProperty));
            Storyboard.SetTargetName(daY, "scale");
            Storyboard.SetTargetProperty(daY, new PropertyPath(ScaleTransform.ScaleYProperty));

            sb.Children.Add(daX);
            sb.Children.Add(daY);

            sb.Begin(this);

            //ST.BeginAnimation(ScaleTransform.ScaleXProperty, new DoubleAnimation(0, new Duration(TimeSpan.FromSeconds(1))));
            //ST.BeginAnimation(ScaleTransform.ScaleYProperty, new DoubleAnimation(0, new Duration(TimeSpan.FromSeconds(1))));
        }
开发者ID:dalinhuang,项目名称:ChargeLeaderSystem,代码行数:37,代码来源:WinLogin.xaml.cs


示例8: GetStoryboard

        //得到动画画板
        private Storyboard GetStoryboard(double? From1, double To1, double? From2, double To2, double Time1, double Time2)
        {
            Storyboard myStoryboard = new Storyboard();

            DoubleAnimation myDoubleAnimation = new DoubleAnimation();
            if (From1 != null)
            {
                myDoubleAnimation.From = From1;
            }
            myDoubleAnimation.To = To1;
            myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(Time1));

            myStoryboard.Children.Add(myDoubleAnimation);
            Storyboard.SetTargetName(myDoubleAnimation, MaskFloor.Name);
            Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Rectangle.OpacityProperty));

            DoubleAnimation myDoubleAnimation1 = new DoubleAnimation();
            if (From2 != null)
            {
                myDoubleAnimation1.From = From2;
            }
            myDoubleAnimation1.To = To2;
            myDoubleAnimation1.Duration = new Duration(TimeSpan.FromSeconds(Time2));

            myStoryboard.Children.Add(myDoubleAnimation1);
            Storyboard.SetTargetName(myDoubleAnimation1, InfFloor.Name);
            Storyboard.SetTargetProperty(myDoubleAnimation1, new PropertyPath(Rectangle.OpacityProperty));

            return myStoryboard;
        }
开发者ID:yonglehou,项目名称:BPMSV1,代码行数:31,代码来源:MaskControl.xaml.cs


示例9: SetScrollEffect

 public static void SetScrollEffect(DependencyObject obj, int value)
 {
     var elem = obj as FrameworkElement;
     var transGroup = new TransformGroup();
     transGroup.Children.Add(new ScaleTransform());
     transGroup.Children.Add(new SkewTransform());
     transGroup.Children.Add(new RotateTransform());
     transGroup.Children.Add(new TranslateTransform());
     elem.RenderTransform = transGroup;
     var sb = new Storyboard();
     var da = new DoubleAnimationUsingKeyFrames();
     Storyboard.SetTarget(da, obj);
     Storyboard.SetTargetProperty(da, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)", new object[0]));
     da.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero), Value = 60 });
     da.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(value)), Value = 60 });
     da.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(value + 900)), Value = 0, EasingFunction = new CircleEase { EasingMode = EasingMode.EaseOut } });
     sb.Children.Add(da);
     var da2 = new DoubleAnimationUsingKeyFrames();
     Storyboard.SetTarget(da2, obj);
     Storyboard.SetTargetProperty(da2, new PropertyPath(UIElement.OpacityProperty));
     da2.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero), Value = 0 });
     da2.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(value)), Value = 0 });
     da2.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(value + 400)), Value = 1 });
     sb.Children.Add(da2);
     elem.Loaded += (a, b) =>
     {
         sb.Begin();
     };
     obj.SetValue(ScrollEffectProperty, value);
 }
开发者ID:xdusongwei,项目名称:ErlangEditor,代码行数:30,代码来源:EffectHelper.cs


示例10: LoadingSpin

        public LoadingSpin()
        {
            InitializeComponent();
            this.FlashText.Begin();
            this.intervalTimer = new Storyboard()
            {
                Duration = new Duration(TimeSpan.FromMilliseconds(100))
            };
            this.intervalTimer.Completed += new EventHandler(this.OnIntervalTimerCompleted);

            this.animations = new List<Storyboard>()
            {
                CycleAnimation0,
                CycleAnimation1,
                CycleAnimation2,
                CycleAnimation3,
                CycleAnimation4,
                CycleAnimation5,
                CycleAnimation6,
                CycleAnimation7,
                CycleAnimation8,
                CycleAnimation9
            };
            this.Loaded += new RoutedEventHandler(LoadingSpin_Loaded);
        }
开发者ID:HogwartsRico,项目名称:AGS-PgRouting,代码行数:25,代码来源:LoadingSpin.xaml.cs


示例11: ucSchedule

        public ucSchedule()
        {
            try
            {
                InitializeComponent();

                sbFadeIn = (Storyboard)FindResource("sbFadeIn");
                sbFadeOut = (Storyboard)FindResource("sbFadeOut");
                sbFadeOut.Completed += sbFadeOut_Completed;
                sbFadeIn.Completed += sbFadeIn_Completed;

                btnRetry.MouseLeftButtonUp += btnRetry_MouseLeftButtonUp;
                btnRetry.TouchUp += btnRetry_TouchUp;

                btnUseLast.MouseLeftButtonUp += btnUseLast_MouseLeftButtonUp;
                btnUseLast.TouchUp += btnUseLast_TouchUp;

                timerschedule = new DispatcherTimer();
                timerschedule.Interval = TimeSpan.FromSeconds(1);
                timerschedule.Tick += timerschedule_Tick;

                timercountdown = new DispatcherTimer();
                timercountdown.Interval = TimeSpan.FromSeconds(1);
                timercountdown.Tick += timercountdown_Tick;
            }
            catch { }
        }
开发者ID:rtegarp,项目名称:TugasAkhir,代码行数:27,代码来源:ucSchedule.xaml.cs


示例12: fade

        internal void fade(bool fadein)
        {            // Create a storyboard to contain the animations.
            storyboard = new Storyboard();
            TimeSpan duration = new TimeSpan(0, 0, 1);

            // Create a DoubleAnimation to fade the not selected option control
            DoubleAnimation animation = new DoubleAnimation();
            if (fadein)
            {
                animation.From = 0.0;
                animation.To = 1.0;
            }
            else
            {
                animation.From = 1.0;
                animation.To = 0.0;
            }
            animation.Duration = new Duration(duration);
            // Configure the animation to target de property Opacity
            Storyboard.SetTargetName(animation, this.uiImage.Name);
            Storyboard.SetTargetProperty(animation, new PropertyPath(Image.OpacityProperty));
            // Add the animation to the storyboard
            storyboard.Children.Add(animation);

            // Begin the storyboard
            storyboard.Begin(this.uiImage);
        }
开发者ID:muzefm,项目名称:ebucms,代码行数:27,代码来源:ImgSlot.xaml.cs


示例13: PerformAppearanceAnimation

        private void PerformAppearanceAnimation()
        {
            double w = System.Windows.Application.Current.Host.Content.ActualWidth;
            double h = System.Windows.Application.Current.Host.Content.ActualHeight;

            CompositeTransform ct = (CompositeTransform)LayoutRoot.RenderTransform;
            ct.TranslateY = h;

            LayoutRoot.Visibility = Visibility.Visible;

            Storyboard animation = new Storyboard();
            animation.Duration = new Duration(TimeSpan.FromSeconds(0.3));

            // Y animation
            DoubleAnimation galleryAnimation = new DoubleAnimation();
            galleryAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.3));
            galleryAnimation.To = 0.0;
            galleryAnimation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };
            Storyboard.SetTarget(galleryAnimation, LayoutRoot);
            Storyboard.SetTargetProperty(galleryAnimation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateY)"));
            animation.Children.Add(galleryAnimation);
            animation.Begin();
            animation.Completed += (sender, e) =>
            {
                OnPageAppeared();
            };
        }
开发者ID:powerytg,项目名称:indulged-flickr,代码行数:27,代码来源:PhotoSetPageAnimationExtension.cs


示例14: DrawLeftPage

        private void DrawLeftPage()
        {
            //Tworzę obiekt canvas
            Canvas cv = new Canvas();
            cv.Width = 100;
            cv.Height = 100;
            SolidColorBrush sb = new SolidColorBrush(Color.FromArgb(255, 0, 255, 255));
            cv.Background = sb;
            Canvas.SetLeft(cv, 150);
            Canvas.SetTop(cv, 100);

            //Projekcja
            PlaneProjection pp = new PlaneProjection();
            pp.LocalOffsetX = -50.0;
            cv.Projection = pp;

            //Dodaję canvas
            plutno.Children.Add(cv);

            //Tworzę animację
            stL = new Storyboard();
            DoubleAnimation db = new DoubleAnimation();
            db.Duration = new Duration(TimeSpan.FromMilliseconds(1000));
            db.From = 0.0;
            db.To = -180.0;

            Storyboard.SetTarget(db, pp);
            Storyboard.SetTargetProperty(db, new PropertyPath(PlaneProjection.RotationYProperty));

            //Dodanie animacji do storyboarda
            stL.Children.Add(db);
        }
开发者ID:dawidwekwejt,项目名称:KCK_projekt,代码行数:32,代码来源:MainPage.xaml.cs


示例15: LoginView

        public LoginView()
        {
            this.InitializeComponent();
            this.confirmSpinnerAnimation = (Storyboard)this.Resources["RotateConfirmSpinner"];

            this.IsVisibleChanged += this.onIsVisibleChanged;
        }
开发者ID:Nukil,项目名称:toggldesktop,代码行数:7,代码来源:LoginView.xaml.cs


示例16: Scanner

        public Scanner()
        {
            InitializeComponent();

            // Hook up to storyboard(s)
            FrameworkElement templateRoot = VisualTreeHelper.GetChild(this, 0) as FrameworkElement;
            if (null != templateRoot)
            {
                foreach (VisualStateGroup group in VisualStateManager.GetVisualStateGroups(templateRoot))
                {
                    if (VisibilityGroupName == group.Name)
                    {
                        foreach (VisualState state in group.States)
                        {
                            if ((ClosedVisibilityStateName == state.Name) && (null != state.Storyboard))
                            {
                                _closedStoryboard = state.Storyboard;
                                _closedStoryboard.Completed += OnClosedStoryboardCompleted;
                            }
                        }
                    }
                }
            }

            // Play the Open state
            VisualStateManager.GoToState(this, OpenVisibilityStateName, true);
        }
开发者ID:damian-tarnawsky,项目名称:cordova-barcode-scanner,代码行数:27,代码来源:Scanner.xaml.cs


示例17: SmoothSetAsync

        public static Task SmoothSetAsync(this FrameworkElement @this, DependencyProperty dp, double targetvalue,
            TimeSpan iDuration, CancellationToken iCancellationToken)
        {
            TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
            DoubleAnimation anim = new DoubleAnimation(targetvalue, new Duration(iDuration));
            PropertyPath p = new PropertyPath("(0)", dp);
            Storyboard.SetTargetProperty(anim, p);
            Storyboard sb = new Storyboard();
            sb.Children.Add(anim);
            EventHandler handler = null;
            handler = delegate
            {
                sb.Completed -= handler;
                sb.Remove(@this);
                @this.SetValue(dp, targetvalue);
                tcs.TrySetResult(null);
            };
            sb.Completed += handler;
            sb.Begin(@this, true);

            iCancellationToken.Register(() =>
            {
                double v = (double)@this.GetValue(dp);  
                sb.Stop(); 
                sb.Remove(@this); 
                @this.SetValue(dp, v);
                tcs.TrySetCanceled();
            });

            return tcs.Task;
        }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:31,代码来源:FrameworkElementExtender.cs


示例18: UpdateCell

 public UpdateCell(TextBlock tb, Storyboard sbUp, Storyboard sbDown, Storyboard sbSame)
 {
     this.tb = tb;
     this.sbUp = sbUp;
     this.sbDown = sbDown;
     this.sbSame = sbSame;
 }
开发者ID:mikelear,项目名称:CIAPI.CS,代码行数:7,代码来源:MainPage.xaml.cs


示例19: AnimateScrollIntoViewMainMenu

        public static void AnimateScrollIntoViewMainMenu(this ItemsControl itemsControl, object item)
        {
            try
            {
                ScrollViewer scrollViewer = VisualTreeHelpers.GetVisualChild<ScrollViewer>(itemsControl);

                UIElement container = itemsControl.ItemContainerGenerator.ContainerFromItem(item) as UIElement;
                int index = itemsControl.ItemContainerGenerator.IndexFromContainer(container);
                double toValue = scrollViewer.ExtentWidth * ((double)index / itemsControl.Items.Count);
                Point relativePoint = container.TranslatePoint(new Point(0.0, 0.0), Window.GetWindow(container));

                DoubleAnimation horizontalAnimation = new DoubleAnimation();
                horizontalAnimation.From = scrollViewer.HorizontalOffset;
                horizontalAnimation.To = toValue;
                horizontalAnimation.DecelerationRatio = .2;
                horizontalAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(1000));
                Storyboard storyboard = new Storyboard();
                storyboard.Children.Add(horizontalAnimation);
                Storyboard.SetTarget(horizontalAnimation, scrollViewer);
                Storyboard.SetTargetProperty(horizontalAnimation, new PropertyPath(ScrollViewerBehavior.HorizontalOffsetProperty));
                storyboard.Begin();
            }
            catch (Exception)
            {

                
            }
        }
开发者ID:kabellrics,项目名称:htpcMusic,代码行数:28,代码来源:ItemsControlExtensions.cs


示例20: Animate

        public static void Animate(this DependencyObject target, double from, double to, object propertyPath, int duration, int startTime, IEasingFunction easing = null, Action completed = null)
        {
            if (easing == null)
                easing = new SineEase();

            var db = new DoubleAnimation();
            db.To = to;
            db.From = from;
            db.EasingFunction = easing;
            db.Duration = TimeSpan.FromMilliseconds(duration);

            Storyboard.SetTarget(db, target);
            Storyboard.SetTargetProperty(db, new PropertyPath(propertyPath));

            var sb = new Storyboard();
            sb.BeginTime = TimeSpan.FromMilliseconds(startTime);

            if (completed != null)
            {
                sb.Completed += (s, e) => completed();
            }

            sb.Children.Add(db);
            sb.Begin();
        }
开发者ID:kiendev,项目名称:FarjiChat,代码行数:25,代码来源:Extensions.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Animation.ThicknessAnimation类代码示例发布时间:2022-05-26
下一篇:
C# Animation.KeyTime类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap