예제 #1
0
        private void UpdatePosition(bool useTransitions)
        {
            if (_ya != null)
            {
                IEasingFunction ease = new CircleEase(); // ExponentialEase { Exponent = 1 };

                Duration d = new Duration(TimeSpan.Zero);
                if (useTransitions)
                {
                    double random = Random.NextDouble();
                    double min    = 1.0;
                    double extra  = random * 2.5;
                    d = new Duration(TimeSpan.FromSeconds(min + extra));
                }

                var loc = 0.0;

                switch (_currentState)
                {
                case TileState.Text:
                    loc = 0.0;
                    break;

                case TileState.Partial:
                    loc = NegativeHalfTileSize;
                    break;

                case TileState.Image:
                    loc = NegativeTileSize;
                    break;
                }

                _ya.GoTo(loc, d, ease);
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        public static DoubleAnimation OpenCloseAnimations(Button button, UserControl slot)
        {
            if (button != null && slot != null)
            {
                CircleEase circleEase = new CircleEase();
                circleEase.EasingMode = EasingMode.EaseIn;

                var animation = new DoubleAnimation();
                animation.Duration       = TimeSpan.FromSeconds(0.8);
                animation.EasingFunction = circleEase;
                animation.From           = slot.Height;

                if ((string)button.Content == "  What is it?  ")
                {
                    button.Content = "  Hide  ";
                    animation.To   = 160;
                }
                else
                {
                    button.Content = "  What is it?  ";
                    animation.To   = 64;
                }

                return(animation);
            }
            else
            {
                return(new DoubleAnimation());
            }
        }
예제 #4
0
        private static void IsExpandedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            SideBarControl sideBar = (SideBarControl)d;

            CircleEase dE = new CircleEase();

            dE.EasingMode = EasingMode.EaseOut;

            DoubleAnimation dA = new DoubleAnimation();

            dA.FillBehavior   = FillBehavior.HoldEnd;
            dA.Duration       = TimeSpan.FromMilliseconds(500);
            dA.EasingFunction = dE;

            ThicknessAnimation tA = new ThicknessAnimation();

            tA.Duration = TimeSpan.FromMilliseconds(500);

            if ((bool)e.NewValue)
            {
                dA.To = sideBar.ExpandedWidth;
                tA.To = new Thickness(0);
            }
            else
            {
                dA.To = sideBar.CollapsedWidth;
                tA.To = new Thickness(sideBar.CollapsedWidth, 0, 0, 0);
            }

            sideBar.Control.BeginAnimation(WidthProperty, dA, HandoffBehavior.Compose);
            sideBar.Content.BeginAnimation(MarginProperty, tA);
        }
예제 #5
0
        private static void Animate(double from, double to, EasingMode mode, Action complite = null)
        {
            CircleEase easing = new CircleEase
            {
                EasingMode = mode
            };

            DoubleAnimation animation = new DoubleAnimation
            {
                From           = from,
                To             = to,
                BeginTime      = TimeSpan.FromMilliseconds(100),
                FillBehavior   = FillBehavior.Stop,
                EasingFunction = easing
            };

            animation.Completed += (s, a) =>
            {
                if (Dialog != null)
                {
                    Dialog.Opacity = to;
                }

                complite?.Invoke();
            };

            if (Dialog != null)
            {
                Dialog.BeginAnimation(UIElement.OpacityProperty, animation);
            }
            else
            {
                complite?.Invoke();
            }
        }
예제 #6
0
        public static void DoAnimation(MessageDialog dialog)
        {
            DoubleAnimation da   = new DoubleAnimation();
            CircleEase      ease = new CircleEase()
            {
                EasingMode = EasingMode.EaseOut
            };

            da.From           = 0;
            da.To             = 50;
            da.Duration       = TimeSpan.FromMilliseconds(2500);
            da.EasingFunction = ease;
            dialog.BeginAnimation(FrameworkElement.HeightProperty, da);

            DispatcherTimer timer = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 0, 2, 500)
            };

            timer.Tick += (sender, args) =>
            {
                da.From           = 50;
                da.To             = 0;
                da.Duration       = TimeSpan.FromMilliseconds(1250);
                da.EasingFunction = ease;
                dialog.BeginAnimation(FrameworkElement.HeightProperty, da);
                timer.Stop();
            };
            timer.Start();
        }
        private void SettingButton_Click(object sender, RoutedEventArgs e)
        {
            Storyboard sb = new Storyboard();

            DoubleAnimation doubleAnimationHistorical = new DoubleAnimation(zedGraphHistoricalModel.Width, this.ActualWidth - 320, new Duration(TimeSpan.FromMilliseconds(200)));
            DoubleAnimation doubleAnimationRealTime   = new DoubleAnimation(zedGraphRealTimeModel.Width, this.ActualWidth - 320, new Duration(TimeSpan.FromMilliseconds(200)));
            CircleEase      ease = new CircleEase()
            {
                EasingMode = EasingMode.EaseInOut
            };

            doubleAnimationHistorical.EasingFunction = ease;
            doubleAnimationRealTime.EasingFunction   = ease;
            sb.Children.Add(doubleAnimationHistorical);
            sb.Children.Add(doubleAnimationRealTime);
            Storyboard.SetTarget(doubleAnimationHistorical, zedGraphHistoricalModel);
            Storyboard.SetTarget(doubleAnimationRealTime, zedGraphRealTimeModel);
            Storyboard.SetTargetProperty(doubleAnimationHistorical, new PropertyPath("(Width)"));
            Storyboard.SetTargetProperty(doubleAnimationRealTime, new PropertyPath("(Width)"));

            sb.Completed  += Storyboard_Completed;
            plotStoryboard = sb;
            sb.Begin();

            settingsWindowOpen = true;
        }
        private void _navigationService_RegionCleared(object sender, EventArgs e)
        {
            if (sender.ToString() == "SettingsRegion")
            {
                Storyboard sb = new Storyboard();

                DoubleAnimation doubleAnimationHistorical = new DoubleAnimation(zedGraphHistoricalModel.Width, this.ActualWidth, new Duration(TimeSpan.FromMilliseconds(200)));
                DoubleAnimation doubleAnimationRealTime   = new DoubleAnimation(zedGraphRealTimeModel.Width, this.ActualWidth, new Duration(TimeSpan.FromMilliseconds(200)));
                CircleEase      ease = new CircleEase()
                {
                    EasingMode = EasingMode.EaseInOut
                };
                doubleAnimationHistorical.EasingFunction = ease;
                doubleAnimationRealTime.EasingFunction   = ease;
                sb.Children.Add(doubleAnimationHistorical);
                sb.Children.Add(doubleAnimationRealTime);
                Storyboard.SetTarget(doubleAnimationHistorical, zedGraphHistoricalModel);
                Storyboard.SetTarget(doubleAnimationRealTime, zedGraphRealTimeModel);
                Storyboard.SetTargetProperty(doubleAnimationHistorical, new PropertyPath("(Width)"));
                Storyboard.SetTargetProperty(doubleAnimationRealTime, new PropertyPath("(Width)"));

                sb.Completed  += Storyboard_Completed;
                plotStoryboard = sb;

                sb.Begin();

                settingsWindowOpen = false;
            }
        }
예제 #9
0
        private static Timeline doubleAnimation(double from, double to, bool expanded, DependencyProperty property)
        {
            DoubleAnimation a = new DoubleAnimation();

            a.Duration = new TimeSpan(0, 0, 0, 0, 200);
            Storyboard.SetTargetProperty(a, new PropertyPath(property));

            CircleEase b = new CircleEase();

            b.EasingMode     = EasingMode.EaseOut;
            a.EasingFunction = b;

            if (expanded)
            {
                a.From = from;
                a.To   = to;
            }
            else
            {
                a.From = to;
                a.To   = from;
            }

            return(a);
        }
예제 #10
0
        public static EasingFunctionBase GetEasingFunction()
        {
            EasingFunctionBase result = null;

            switch (random.Next(5))
            {
            case 0:
                result = new BackEase()
                {
                    EasingMode = EasingMode.EaseInOut, Amplitude = 0.8
                };
                break;

            case 1:
                result = new BounceEase()
                {
                    EasingMode = EasingMode.EaseOut, Bounces = 3, Bounciness = 8
                };
                break;

            case 2:
                result = new CircleEase()
                {
                    EasingMode = EasingMode.EaseInOut
                };
                break;

            case 3:
                result = new CubicEase()
                {
                    EasingMode = EasingMode.EaseIn
                };
                break;

            case 4:
                result = new ElasticEase()
                {
                    EasingMode = EasingMode.EaseOut, Oscillations = 3, Springiness = 4
                };
                break;

            case 5:
                result = new SineEase()
                {
                    EasingMode = EasingMode.EaseInOut
                };
                break;

            default:
                result = new BackEase()
                {
                    EasingMode = EasingMode.EaseInOut, Amplitude = 0.8
                };
                break;
            }

            return(result);
        }
예제 #11
0
        internal static EasingFunctionBase GetEase(this AnimationSettings settings)
        {
            EasingFunctionBase ease;

            switch (settings.Easing)
            {
            case EasingType.Back:
                ease = new BackEase();
                break;

            case EasingType.Bounce:
                ease = new BounceEase();
                break;

            case EasingType.Circle:
                ease = new CircleEase();
                break;

            case EasingType.Cubic:
                ease = new CubicEase();
                break;

            case EasingType.Elastic:
                ease = new ElasticEase();
                break;

            case EasingType.Linear:
                ease = null;
                break;

            case EasingType.Quadratic:
                ease = new QuadraticEase();
                break;

            case EasingType.Quartic:
                ease = new QuarticEase();
                break;

            case EasingType.Quintic:
                ease = new QuinticEase();
                break;

            case EasingType.Sine:
                ease = new SineEase();
                break;

            default:
                ease = new CubicEase();
                break;
            }

            if (ease != null)
            {
                ease.EasingMode = settings.EasingMode;
            }

            return(ease);
        }
예제 #12
0
        private void ZoomViewTo(Point center, double orientation, Vector scale)
        {
            CircleEase ease = new CircleEase();

            ease.EasingMode = EasingMode.EaseInOut;
            AnimateUtility.AnimateElementPoint(zoomCanvas.CurrentView, DisplayMatrix.CenterProperty, center, 0, 1.5, ease);
            AnimateUtility.AnimateElementDouble(zoomCanvas.CurrentView, DisplayMatrix.OrientationProperty, orientation, 0, 1.5, ease);
            AnimateUtility.AnimateElementVector(zoomCanvas.CurrentView, DisplayMatrix.ScaleProperty, scale, 0, 1.5, ease);
        }
예제 #13
0
        private void ChangeMonth(DateTime dt)
        {
            var easing = new CircleEase {
                EasingMode = EasingMode.EaseInOut
            };
            var animDur = TimeSpan.FromMilliseconds(300);

            CalendarDays.BeginAnimation(OpacityProperty, new DoubleAnimation(CalendarDays.Opacity, 0, animDur)
            {
                EasingFunction = easing
            });
            PersianTitle.BeginAnimation(OpacityProperty, new DoubleAnimation(PersianTitle.Opacity, 0, animDur)
            {
                EasingFunction = easing
            });
            GregorianTitle.BeginAnimation(OpacityProperty, new DoubleAnimation(GregorianTitle.Opacity, 0, animDur)
            {
                EasingFunction = easing
            });
            HijriTitle.BeginAnimation(OpacityProperty, new DoubleAnimation(HijriTitle.Opacity, 0, animDur)
            {
                EasingFunction = easing
            });

            var timer = new DispatcherTimer {
                Interval = animDur
            };

            timer.Start();
            timer.Tick += (sender, args) =>
            {
                ((DispatcherTimer)sender)?.Stop();
                NowDateTime = dt;
                DesignCalendar();

                CalendarDays.BeginAnimation(OpacityProperty,
                                            new DoubleAnimation(CalendarDays.Opacity, 1, animDur)
                {
                    EasingFunction = easing
                });
                PersianTitle.BeginAnimation(OpacityProperty,
                                            new DoubleAnimation(PersianTitle.Opacity, 1, animDur)
                {
                    EasingFunction = easing
                });
                GregorianTitle.BeginAnimation(OpacityProperty,
                                              new DoubleAnimation(GregorianTitle.Opacity, 1, animDur)
                {
                    EasingFunction = easing
                });
                HijriTitle.BeginAnimation(OpacityProperty,
                                          new DoubleAnimation(HijriTitle.Opacity, 1, animDur)
                {
                    EasingFunction = easing
                });
            };
        }
예제 #14
0
        /// <summary>
        ///		Obtiene una función Circle
        /// </summary>
        private CircleEase GetCircleEase(CircleEaseModel circleEase)
        {
            CircleEase ease = new CircleEase();

            // Asigna las propiedades
            ease.EasingMode = ConvertEaseMode(circleEase.EaseMode);
            // Devuelve la función
            return(ease);
        }
예제 #15
0
        //       public override MyAnimateBase Animate()
        //{
        //    RegisterName();
        //    CreateStoryboard();
        //    CompleteTypeStory();
        //    return this;
        //}

        private void RegisterName()
        {
            Element.Visibility = Visibility.Visible;

            var tex1 = Story.GetValue(FrameworkElement.NameProperty);

            if (tex1 == null || tex1.ToString() == "")
            {
                StoryName = "aystory" + base.AnimateName + MyExtension.GetGuidNoSplit;

                Win.Resources.Add(StoryName, Story);
            }
            else
            {
                StoryName = tex1.ToString();
            }

            var tex = Element.GetValue(FrameworkElement.NameProperty);

            if (tex == null || tex.ToString() == "")
            {
                ElementName = "ay" + base.AnimateName + Element.GetHashCode();
                Win.RegisterName(ElementName, Element);
                IsAutoAddName = true;
            }
            else
            {
                ElementName = tex.ToString();
            }

            CircleEase cirDefault = null;

            switch (AniEasingMode)
            {
            case 1:
                cirDefault            = new CircleEase();
                cirDefault.EasingMode = EasingMode.EaseIn;
                break;

            case 2:
                cirDefault            = new CircleEase();
                cirDefault.EasingMode = EasingMode.EaseOut;
                break;

            case 3:
                cirDefault            = new CircleEase();
                cirDefault.EasingMode = EasingMode.EaseInOut;
                break;

            default:

                break;
            }
        }
예제 #16
0
        private IEasingFunction ObterFuncaoDaAnimacao()
        {
            EasingFunctionBase funcaoDaAnimacao = null;

            switch (FuncaoDaAnimacao.SelectedValue.ToString())
            {
            case "BackEase":
                funcaoDaAnimacao = new BackEase();
                break;

            case "BounceEase":
                funcaoDaAnimacao = new BounceEase();
                break;

            case "CircleEase":
                funcaoDaAnimacao = new CircleEase();
                break;

            case "CubicEase":
                funcaoDaAnimacao = new CubicEase();
                break;

            case "ElasticEase":
                funcaoDaAnimacao = new ElasticEase();
                break;

            case "ExponentialEase":
                funcaoDaAnimacao = new ExponentialEase();
                break;

            case "PowerEase":
                funcaoDaAnimacao = new PowerEase();
                break;

            case "QuadraticEase":
                funcaoDaAnimacao = new QuadraticEase();
                break;

            case "QuarticEase":
                funcaoDaAnimacao = new QuarticEase();
                break;

            case "QuinticEase":
                funcaoDaAnimacao = new QuinticEase();
                break;

            case "SineEase":
                funcaoDaAnimacao = new SineEase();
                break;
            }

            funcaoDaAnimacao.EasingMode = ObterModoDaAnimacao();
            return(funcaoDaAnimacao);
        }
예제 #17
0
        private void SmoothProgressTo(int value)
        {
            CircleEase backEase = new CircleEase();

            backEase.EasingMode = EasingMode.EaseIn;

            var animation = new DoubleAnimation((double)value, TimeSpan.FromSeconds(0.5));

            animation.EasingFunction = backEase;

            SelectorStage.BeginAnimation(ProgressBar.ValueProperty, animation);
        }
예제 #18
0
        //脑残版数据绑定  男女比例
        private void sexRatio_ComboBox_DropDownClosed(object sender, object e)
        {
            if (sexRatio_ComboBox.SelectedItem == null)
            {
                return;
            }

            int    index        = sexRatio_ComboBox.SelectedIndex;
            double __menRatio   = Convert.ToDouble(sexList[index].MenRatio);
            double __womenRatio = Convert.ToDouble(sexList[index].WomenRatio);


            //保留两位小数
            double _menRatio   = Math.Round(__menRatio, 2);
            double _womenRatio = Math.Round(__womenRatio, 2);

            Debug.WriteLine("sexRatio_ComboBox.SelectedIndex " + index);
            Debug.WriteLine(_menRatio + "    " + _womenRatio);

            //storyboard 定义的动画最后的 to 不需要赋值
            //MenRatioCPB.ProgressNum = _menRatio;
            //WomenRatioCPB.ProgressNum = _womenRatio;

            //动画
            CircleEase circleEase = new CircleEase();

            circleEase.EasingMode = EasingMode.EaseInOut;

            var storyBoard       = new Storyboard();
            var extendAnimation1 = new DoubleAnimation {
                Duration = new Duration(TimeSpan.FromSeconds(0.5)), From = 0, To = _menRatio, EnableDependentAnimation = true
            };

            extendAnimation1.EasingFunction = circleEase;

            Storyboard.SetTarget(extendAnimation1, MenRatioCPB);
            Storyboard.SetTargetProperty(extendAnimation1, "ProgressNum");

            var extendAnimation2 = new DoubleAnimation {
                Duration = new Duration(TimeSpan.FromSeconds(0.5)), From = 0, To = _womenRatio, EnableDependentAnimation = true
            };

            extendAnimation2.EasingFunction = circleEase;

            Storyboard.SetTarget(extendAnimation2, WomenRatioCPB);
            Storyboard.SetTargetProperty(extendAnimation2, "ProgressNum");

            storyBoard.Children.Add(extendAnimation1);
            storyBoard.Children.Add(extendAnimation2);

            storyBoard.AutoReverse = false;
            storyBoard.Begin();
        }
예제 #19
0
        private void btnMenuItemClick(object sender, RoutedEventArgs e)
        {
            CircleEase ease = new CircleEase()
            {
                EasingMode = EasingMode.EaseOut
            };
            DoubleAnimation doubleAnimation = new DoubleAnimation();

            Button button = (Button)sender;
            Grid   grid;

            switch (button.Name)
            {
            case nameof(btnCatalogs):
            {
                grid = grdCatalogs;
                break;
            }

            case nameof(btnReports):
            {
                grid = grdReports;
                break;
            }

            case nameof(btnOperations):
            {
                grid = grdOperations;
                break;
            }

            default:
                return;
            }

            StackPanel stackPanel = (StackPanel)grid.Children[0];
            int        childCount = stackPanel.Children.Count;

            if (grid.Height != 0)
            {
                doubleAnimation.To = 0;
            }
            else
            {
                doubleAnimation.To = childCount * 30;
            }

            doubleAnimation.Duration       = TimeSpan.FromMilliseconds(childCount * 150);
            doubleAnimation.EasingFunction = ease;
            grid.BeginAnimation(HeightProperty, doubleAnimation);
        }
예제 #20
0
        private static ThicknessAnimation MarginAnimation()
        {
            var animation = new ThicknessAnimation();

            //animation.From = new Thickness(40);
            animation.To          = new Thickness(40);
            animation.Duration    = TimeSpan.FromMilliseconds(150);
            animation.AutoReverse = true;
            var ease = new CircleEase();

            //ease.Power = 3;
            ease.EasingMode = EasingMode.EaseOut;
            //animation.EasingFunction = ease;
            return(animation);
        }
예제 #21
0
        private static DoubleAnimation FontAnimation()
        {
            var animation = new DoubleAnimation();

            //animation.From = 6;
            animation.To          = 18;
            animation.Duration    = TimeSpan.FromMilliseconds(100);
            animation.AutoReverse = true;
            var ease = new CircleEase();

            //ease.Power = 3;
            ease.EasingMode          = EasingMode.EaseIn;
            animation.EasingFunction = ease;
            return(animation);
        }
예제 #22
0
        //==================================================================================================================
        //======================================= CONSTRUCTOR / DESTRUCTOR =================================================
        //==================================================================================================================

        public MainWindow()
        {
            InitializeComponent();

            ((INotifyCollectionChanged)xe_ListTab_ListBox.Items).CollectionChanged +=
                xe_ListTab_ListBox_OnCollectionChange;

            xe_TIPPbar_Grid.Height = 0;
            xe_CheckTab_Grid.Width = 0;
            xe_ListTab_Grid.Width  = 0;

            v_storyBoardBox = new Storyboard();
            v_storyboardFunctionBarColor = new Storyboard();
            v_storyBoardTab = new Storyboard();

            v_animationBox = new DoubleAnimation();
            v_animationFunctionBarColor = new ColorAnimation();
            v_animationTab = new DoubleAnimation();

            v_storyBoardBox.Children.Add(v_animationBox);
            v_storyboardFunctionBarColor.Children.Add(v_animationFunctionBarColor);
            v_storyBoardTab.Children.Add(v_animationTab);


            v_animationBox.Duration = new Duration(TimeSpan.FromSeconds(0.3));
            v_animationFunctionBarColor.Duration = new Duration(TimeSpan.FromSeconds(0.2));
            v_animationTab.Duration = new Duration(TimeSpan.FromSeconds(0.5));

            CircleEase ease = new CircleEase();

            ease.EasingMode = EasingMode.EaseInOut;
            v_animationTab.EasingFunction = ease;


            Storyboard.SetTargetProperty(v_animationBox, new PropertyPath(WidthProperty));
            Storyboard.SetTargetProperty(v_animationFunctionBarColor, new PropertyPath("(Panel.Background).(SolidColorBrush.Color)"));

            xe_CheckTab_TEXTBOX.Text = v_textEnterNumber;

            v_regexAmericanExpres = new Regex("^3[47][0-9]{13}$");
            v_regexDinersClub     = new Regex("^3(?:0[0-5]|[68][0-9])[0-9]{11}$");
            v_regexDiscover       = new Regex("^6(?:011|5[0-9]{2})[0-9]{12}$");
            v_regexJCB            = new Regex("^(?:2131|1800|35\\d{3})\\d{11}$");
            v_regexMasterCard     = new Regex("^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$");
            v_regexVisa           = new Regex("^4[0-9]{12}(?:[0-9]{3})?$");

            xe_CheckTab_TEXTBOX.TextChanged += em_CheckTab_TEXTBOX_OnTextChange;
        }
예제 #23
0
        public static AnimationClock AnimateElementDouble(DependencyObject element, DependencyProperty property, double targetValue, double fromTime, double toTime, IEasingFunction ease = null)
        {
            if (!(element is IAnimatable))
            {
                throw new InvalidOperationException("Element must be IAnimatable.");
            }

            if (double.IsNaN(targetValue))
            {
                throw new ArgumentException("targetValue cannot be NaN", "targetValue");
            }

            StopAnimation(element, property);

            if (ease == null)
            {
                ease = new CircleEase();
            }

            double initialValue = (double)element.GetValue(property);

            if (double.IsNaN(initialValue))
            {
                initialValue = 0.0;
            }

            DoubleAnimation anim = new DoubleAnimation(initialValue, targetValue, new Duration(TimeSpan.FromSeconds(toTime - fromTime)));

            //DoubleAnimationUsingKeyFrames anim = new DoubleAnimationUsingKeyFrames();

            //anim.KeyFrames.Add(new SplineDoubleKeyFrame(initialValue,
            //                            KeyTime.FromTimeSpan(TimeSpan.FromSeconds(fromTime))));
            //anim.KeyFrames.Add(new SplineDoubleKeyFrame(targetValue,
            //                            KeyTime.FromTimeSpan(TimeSpan.FromSeconds(toTime))
            //                            , new KeySpline(0.0, 0, 0.05, 1))
            //                         );

            anim.EasingFunction = ease;

            if (fromTime > 0.0)
            {
                return(AnimateElementDelayHelper(element, property, anim, fromTime));
            }
            else
            {
                return(AnimateElementHelper(element, property, anim));
            }
        }
예제 #24
0
 private void closeMe()
 {
     try
     {
         var anim  = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(1));
         var goout = new DoubleAnimation(-226, (Duration)TimeSpan.FromSeconds(1));
         var ce    = new CircleEase();
         ce.EasingMode        = EasingMode.EaseIn;
         goout.EasingFunction = ce;
         anim.Completed      += (s, _) => this.Close();
         this.BeginAnimation(UIElement.OpacityProperty, anim);
         this.BeginAnimation(TopProperty, goout);
     }
     catch (Exception ex)
     {
         //MessageBox.Show("Popup: closeMe: " + ex.Message);
     }
 }
예제 #25
0
        private void BackgroudAnimation(bool show)
        {
            CircleEase easing = new CircleEase();

            easing.EasingMode = EasingMode.EaseInOut;
            ThicknessAnimation animation = new ThicknessAnimation();

            animation.Duration       = TimeSpan.FromSeconds(0.5);
            animation.EasingFunction = easing;
            if (show)
            {
                animation.To = new Thickness(0, 0, 0, 0);
            }
            else
            {
                animation.To = new Thickness(0, -520, 0, 520);
            }
            background.BeginAnimation(Grid.MarginProperty, animation);
        }
예제 #26
0
        public PageTurner(RadBook book)
        {
            PageTurner pageTurner  = this;
            CircleEase circleEase1 = new CircleEase();

            circleEase1.EasingMode = EasingMode.EaseOut;
            CircleEase circleEase2 = circleEase1;

            pageTurner.easingFunction = (IEasingFunction)circleEase2;
            this.timer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromMilliseconds(1.0)
            };
            // ISSUE: explicit constructor call
            // base.\u002Ector();
            this.book        = book;
            this.IsAvailable = true;
            this.timer.Tick += new EventHandler(this.Timer_Tick);
        }
예제 #27
0
            public void Go(bool @in, Action completedAction = null)
            {
                var             combinedStoryboard = new AnimationStory();
                var             start          = @in ? _startValue : _endValue;
                var             end            = @in ? _endValue : _startValue;
                IEasingFunction easingFunction = new CircleEase
                {
                    EasingMode = @in ? EasingMode.EaseIn : EasingMode.EaseOut
                };

                var opacityAnimation = new DoubleAnimation(start, end, _animationDuration)
                {
                    EasingFunction = easingFunction
                };

                AnimationStory.SetTarget(opacityAnimation, _dependencyObject);
                AnimationStory.SetTargetProperty(opacityAnimation, new PropertyPath("Opacity"));
                combinedStoryboard.Children.Add(opacityAnimation);

                var scaleAnimationX = new DoubleAnimation(start, end, _animationDuration)
                {
                    EasingFunction = easingFunction
                };

                AnimationStory.SetTarget(scaleAnimationX, _dependencyObject);
                AnimationStory.SetTargetProperty(scaleAnimationX, new PropertyPath("LayoutTransform.Children[0].ScaleX"));
                combinedStoryboard.Children.Add(scaleAnimationX);

                var scaleAnimationY = new DoubleAnimation(start, end, _animationDuration);

                AnimationStory.SetTarget(scaleAnimationY, _dependencyObject);
                AnimationStory.SetTargetProperty(scaleAnimationY, new PropertyPath("LayoutTransform.Children[0].ScaleY"));
                combinedStoryboard.Children.Add(scaleAnimationY);

                combinedStoryboard.Duration = _animationDuration;
                if (completedAction != null)
                {
                    combinedStoryboard.Completed += (o, args) => completedAction();
                }

                combinedStoryboard.Begin();
            }
예제 #28
0
        protected override void OnIsPressedChanged(DependencyPropertyChangedEventArgs e)
        {
            base.OnIsPressedChanged(e);

            if (dot != null && IsChecked.HasValue && IsChecked.Value && IsPressed)
            {
                var to = dot.Margin;
                to.Left -= dot.ActualWidth * 1.3333 - dot.ActualWidth;

                var ease = new CircleEase()
                {
                    EasingMode = EasingMode.EaseInOut
                };
                var animation = new ThicknessAnimation(to, TimeSpan.FromSeconds(0.36))
                {
                    EasingFunction = ease
                };

                dot.BeginAnimation(MarginProperty, animation);
            }
        }
예제 #29
0
        public static void CreateStoryBoard(this FrameworkElement obj, SolidColorBrush toColor, string propertyPath)
        {
            var easing = new CircleEase {
                EasingMode = EasingMode.EaseInOut
            };
            var dayLeadColorAnim = new ColorAnimation
            {
                AutoReverse    = false,
                Duration       = TimeSpan.FromMilliseconds(300),
                EasingFunction = easing,
                To             = toColor.Color
            };

            var dayLeadStoryBoard = new Storyboard();

            dayLeadStoryBoard.Children.Add(dayLeadColorAnim);

            Storyboard.SetTarget(dayLeadColorAnim, obj);
            Storyboard.SetTargetProperty(dayLeadColorAnim, new PropertyPath(propertyPath));
            dayLeadStoryBoard.Begin(obj);
        }
예제 #30
0
        public async Task HidMsg()
        {
            //sb.Begin();
            Storyboard sb = new Storyboard();

            DoubleAnimation anim = new DoubleAnimation();

            anim.From     = 1;
            anim.To       = 0;
            anim.Duration = TimeSpan.FromMilliseconds(300);

            CircleEase ease = new CircleEase();

            ease.EasingMode     = EasingMode.EaseOut;
            anim.EasingFunction = ease;

            Storyboard.SetTarget(anim, st);
            Storyboard.SetTargetProperty(anim, "ScaleY");
            sb.Children.Add(anim);
            await sb.BeginAsync();
        }