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


C# DoubleAnimation.SetValue方法代码示例

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


在下文中一共展示了DoubleAnimation.SetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ContextShrinkAnimation

        public void ContextShrinkAnimation()
        {
            Border contextCircle = stickyWindow.sContextCircle;

            DoubleAnimation animationsContextGrowX = new DoubleAnimation(10, TimeSpan.FromMilliseconds(250));
            animationsContextGrowX.SetValue(Storyboard.TargetNameProperty, contextCircle.Name);
            animationsContextGrowX.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(Border.WidthProperty));

            DoubleAnimation animationsContextGrowY = new DoubleAnimation(10, TimeSpan.FromMilliseconds(250));
            animationsContextGrowY.SetValue(Storyboard.TargetNameProperty, contextCircle.Name);
            animationsContextGrowY.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(Border.HeightProperty));

            DoubleAnimation animationsContextMoveX = new DoubleAnimation(1.5, TimeSpan.FromMilliseconds(250));
            animationsContextMoveX.SetValue(Storyboard.TargetNameProperty, contextCircle.Name);
            animationsContextMoveX.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(Canvas.LeftProperty));

            DoubleAnimation animationsContextMoveY = new DoubleAnimation(1.5, TimeSpan.FromMilliseconds(250));
            animationsContextMoveY.SetValue(Storyboard.TargetNameProperty, contextCircle.Name);
            animationsContextMoveY.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(Canvas.TopProperty));

            Storyboard storyContextShrink = new Storyboard();
            storyContextShrink.Children.Add(animationsContextGrowX);
            storyContextShrink.Children.Add(animationsContextGrowY);
            storyContextShrink.Children.Add(animationsContextMoveX);
            storyContextShrink.Children.Add(animationsContextMoveY);

            storyContextShrink.Begin(stickyWindow.sContextCircle);
        }
开发者ID:hoangduit,项目名称:stickiesspace,代码行数:28,代码来源:Animations.cs

示例2: PleaseWaitWindow

        /// <summary>
        /// Initializes a please wait window with default text.
        /// </summary>
        /// <param name="text">Text to display in the window.</param>
        public PleaseWaitWindow(string text)
        {
            InitializeComponent();

            DoubleAnimation dimmAnimation = new DoubleAnimation(DimmedValue, new Duration(new TimeSpan(0, 0, 0, 0, 200)));
            dimmAnimation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Opacity"));
            _dimmStoryboard.Children.Add(dimmAnimation);

            DoubleAnimation undimmAnimation = new DoubleAnimation(UndimmedValue, new Duration(new TimeSpan(0, 0, 0, 0, 200)));
            undimmAnimation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Opacity"));
            _undimmStoryboard.Children.Add(undimmAnimation);

            _dimmStoryboard.Completed += delegate
            {
                IsOwnerDimmed = true;

                UpdateLayout();
            };
            _undimmStoryboard.Completed += delegate
            {
                IsOwnerDimmed = false;
                Owner.IsHitTestVisible = true;

                UpdateLayout();

                Close();
            };

            this.SetOwnerWindow();

            Loaded += OnLoaded;
            LayoutUpdated += OnLayoutUpdated;

            Text = text;
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:39,代码来源:PleaseWaitWindow.xaml.cs

示例3: Create

 public static Timeline Create(DependencyObject target, DependencyProperty targetProperty,
   Duration duration, Thickness from, Thickness to)
 {
     DoubleAnimation timeAnimation = new DoubleAnimation() { From = 0, To = 1, Duration = duration };
     timeAnimation.EasingFunction = new ExponentialEase()
     {
         Exponent = 9,
         EasingMode = System.Windows.Media.Animation.EasingMode.EaseOut
     };
     timeAnimation.SetValue(TargetProperty, target);
     timeAnimation.SetValue(TargetPropertyProperty, targetProperty);
     timeAnimation.SetValue(FromProperty, from);
     timeAnimation.SetValue(ToProperty, to);
     Storyboard.SetTargetProperty(timeAnimation, new PropertyPath("(ThicknessAnimation.Time)"));
     Storyboard.SetTarget(timeAnimation, timeAnimation);
     return timeAnimation;
 }
开发者ID:ErikPel,项目名称:windows-phone,代码行数:17,代码来源:ThicknessAnimation.cs

示例4: GetOpac

        private static DoubleAnimation GetOpac(bool isInanimation, int animationTime)
        {
            double from = isInanimation ? 0 : 1;
            double to = from == 1 ? 0 : 1;

            var opac = new DoubleAnimation(from, to, new Duration(new TimeSpan(0, 0, 0, 0, animationTime)));
            opac.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Opacity"));

            return opac;
        }
开发者ID:KayRaettig,项目名称:ModernUIAnimationTest,代码行数:10,代码来源:AnimationProducer.cs

示例5: StartTimer

        private void StartTimer()
        {
            
            DoubleAnimation daValueProperty = new DoubleAnimation();
            daValueProperty.From = 200;
            daValueProperty.To = 0;
            daValueProperty.Duration = TimeSpan.FromSeconds(200);
            daValueProperty.SetValue(Storyboard.TargetNameProperty, "progressBarTimeLeft");
            daValueProperty.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Value"));

            ColorAnimation caForegroundProperty = new ColorAnimation();
            caForegroundProperty.To = Colors.Red;
            caForegroundProperty.BeginTime = TimeSpan.FromSeconds(170);
            caForegroundProperty.SetValue(Storyboard.TargetNameProperty, "progressBarTimeLeft");
            caForegroundProperty.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Foreground.Color"));



            //gör så att mot slutet börja progressbaren blinka
            //DoubleAnimation daOpacityProperty = new DoubleAnimation();
            //daOpacityProperty.From = 1;
            //daOpacityProperty.To = 0;
            //daOpacityProperty.Duration = TimeSpan.FromMilliseconds(900);
            //daOpacityProperty.AutoReverse = true;
            //daOpacityProperty.RepeatBehavior = RepeatBehavior.Forever;
            //daOpacityProperty.BeginTime = TimeSpan.FromSeconds(185);
            //daOpacityProperty.SetValue(Storyboard.TargetNameProperty, "progressBarTimeLeft");
            //daOpacityProperty.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Opacity"));

            App.TimerStoryboard = new Storyboard();
            App.TimerStoryboard.Children.Add(daValueProperty);
            App.TimerStoryboard.Children.Add(caForegroundProperty);
            //App.TimerStoryboard.Children.Add(daOpacityProperty);
            App.TimerStoryboard.Duration = TimeSpan.FromSeconds(200);

            //sb.Completed += new EventHandler(GameOver);

            App.TimerStoryboard.Begin(gameGrid, true);
        }
开发者ID:fifnicke,项目名称:MemoryV.5,代码行数:39,代码来源:SinglePlayerGameController.cs

示例6: EffectsHelper

        /// <summary>
        /// Initializes static members of the <see cref="EffectsHelper"/> class.
        /// </summary>
        static EffectsHelper()
        {
#if NETFX_CORE
            var propertyPath = "Opacity";
#else
            var propertyPath = new PropertyPath("Opacity");
#endif

            var dimmAnimation = new DoubleAnimation();
            dimmAnimation.To = DimmedValue;
            dimmAnimation.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 200));
            dimmAnimation.SetValue(Storyboard.TargetPropertyProperty, propertyPath);
            _dimmStoryboard.Children.Add(dimmAnimation);

            var undimmAnimation = new DoubleAnimation();
            undimmAnimation.To = UndimmedValue;
            undimmAnimation.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 200));
            undimmAnimation.SetValue(Storyboard.TargetPropertyProperty, propertyPath);
            _undimmStoryboard.Children.Add(undimmAnimation);
        }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:23,代码来源:EffectsHelper.cs

示例7: GetDoubleAnimation

 public DoubleAnimation GetDoubleAnimation()
 {
     var doubleAnimation = new DoubleAnimation();
     doubleAnimation.SetValue(Storyboard.TargetNameProperty,mohamedAhmed.Name);
     return doubleAnimation;
 }
开发者ID:JackWangCUMT,项目名称:Playground,代码行数:6,代码来源:Window1.xaml.cs

示例8: createFadeStoryboard

        private Storyboard createFadeStoryboard(Rectangle obj)
        {
            DoubleAnimation fade = new DoubleAnimation();
            fade.To = 0;
            fade.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
            fade.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Opacity"));
            fade.SetValue(Storyboard.TargetProperty, obj);            

            Storyboard sb = new Storyboard();
            sb.Children.Add(fade);            
            return sb;
        }
开发者ID:hihack,项目名称:CRM.Mobile,代码行数:12,代码来源:CRMScrollViewer.cs

示例9: SetTime

 public static void SetTime(DoubleAnimation animation, double value)
 {
     animation.SetValue(TimeProperty, value);
 }
开发者ID:ErikPel,项目名称:windows-phone,代码行数:4,代码来源:ThicknessAnimation.cs

示例10: CreateAnimation

        private Storyboard CreateAnimation(IEnumerable<ExpandableWrapper> controls, bool visible)
        {
            Storyboard sb = new Storyboard();
            sb.FillBehavior = FillBehavior.HoldEnd;

            var ease = new PowerEase() { Power = 5 };
            var duration = TimeSpan.FromMilliseconds(700);

            foreach (var c in controls)
            {
                DoubleAnimation opacity = new DoubleAnimation(visible ? 1 : 0, duration);
                opacity.EasingFunction = ease;
                opacity.SetValue(Storyboard.TargetProperty, c);
                opacity.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(ExpandableWrapper.OpacityProperty));
                sb.Children.Add(opacity);

                // replace the current transform with one that's not currently locked by an old animation.
                ScaleTransform st = new ScaleTransform(c.Scale.ScaleX, c.Scale.ScaleY);
                if (Orientation == Orientation.Horizontal)
                    st.ScaleY = 1;
                else
                    st.ScaleX = 1;
                c.Scale = st;

                DoubleAnimation size = new DoubleAnimation(visible ? 1 : 0, duration);
                size.EasingFunction = ease;
                size.SetValue(Storyboard.TargetProperty, c);
                size.SetValue(Storyboard.TargetPropertyProperty,
                    new PropertyPath(Orientation == Orientation.Horizontal ? "LayoutTransform.ScaleX" : "LayoutTransform.ScaleY"));
                sb.Children.Add(size);

                c.Child.Focusable = visible && c.ChildFocusableDefault;
            }
            return sb;
        }
开发者ID:caesay,项目名称:CS.Util,代码行数:35,代码来源:ExpandingStackPanel.cs

示例11: ApplyResizeEffect

        private void ApplyResizeEffect(FrameworkElement element, double factor, double width, double height)
        {
            TimeSpan speed = TimeSpan.FromMilliseconds(100);
            DoubleAnimation daWidth = new DoubleAnimation { To = factor*width, Duration = new Duration(speed) };
            DoubleAnimation daHeight = new DoubleAnimation { To = factor*height, Duration = new Duration(speed) };
            Storyboard sb = new Storyboard();
			daHeight.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Height"));
			daWidth.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Width"));
			sb.Children.Add(daWidth);
			sb.Children.Add(daHeight);
			Storyboard.SetTarget(daWidth, element);
            Storyboard.SetTarget(daHeight, element);
            sb.Begin();
        }
开发者ID:percipio-dk,项目名称:arcgis-silverlight-toolkit-v2.4-with-wms-authentication,代码行数:14,代码来源:Toolbar.cs

示例12: OnCloseButtonClicked

 private void OnCloseButtonClicked(object sender, RoutedEventArgs e)
 {
     if (_popup != null && _border != null)
     {
         if (_popup.PopupAnimation == PopupAnimation.Slide)
         {
             _border.RenderTransform = new TranslateTransform(0, 0);
             var closeAnimation = new DoubleAnimation(this.RenderSize.Height * -1, new Duration(new System.TimeSpan(0, 0, 0, 0, 200)));
             closeAnimation.SetValue(Storyboard.TargetProperty, _border);
             closeAnimation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("RenderTransform.Y"));
             var storyboard = new Storyboard();
             storyboard.Children.Add(closeAnimation);
             storyboard.Completed += this.OnCloseStoryboardCompleted;
             storyboard.Begin();
         }
         else
         {
             _popup.IsOpen = false;
         }
     }
 }
开发者ID:nagyistoce,项目名称:ArchitectureCampSample,代码行数:21,代码来源:PopupHost.cs

示例13: SetTo

 public static void SetTo(DoubleAnimation animation, Thickness value)
 {
     animation.SetValue(ToProperty, value);
 }
开发者ID:chris-tomich,项目名称:Glyma,代码行数:4,代码来源:ThicknessAnimation.cs

示例14: SetFrom

 public static void SetFrom(DoubleAnimation animation, Thickness value)
 {
     animation.SetValue(FromProperty, value);
 }
开发者ID:chris-tomich,项目名称:Glyma,代码行数:4,代码来源:ThicknessAnimation.cs

示例15: ShowComment

		void ShowComment(bool show)
		{
			if(show && BorderComment.Height != 0)
				return;
			if(!show && BorderComment.Height != 40)
				return;
			
			DoubleAnimation animation = new DoubleAnimation();
			animation.From = show ? 0 : 40;
			animation.To = show ? 40 : 0;
			
			animation.Duration = new Duration(TimeSpan.FromMilliseconds(300));
			animation.SetValue(Storyboard.TargetProperty, BorderComment);
			animation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(Border.HeightProperty));
			
			Storyboard board = new Storyboard();
			board.Children.Add(animation);
			board.Begin(this);
		}
开发者ID:kleinux,项目名称:SharpDevelop,代码行数:19,代码来源:PinDebuggerControl.xaml.cs


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