示例#1
0
        private static void IsOsuRunningPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            double value;

            SideBarControl sideBar = (SideBarControl)d;

            DoubleAnimation dA = new DoubleAnimation();

            dA.Duration     = TimeSpan.FromMilliseconds(100);
            dA.FillBehavior = FillBehavior.Stop;

            if ((bool)e.NewValue == true)
            {
                dA.To = value = 0;
            }
            else
            {
                sideBar.IdealngBackground.Opacity = 0;
                dA.To = value = 1;

                //Opacity value is from 0 to 1
                //i must be a silly b
                //da.To = 100
                //Are you silly b????
            }
            dA.Completed += (sender, a) =>
            {
                sideBar.IdealngBackground.Opacity = value;
            };
            sideBar.IdealngBackground.BeginAnimation(OpacityProperty, dA, HandoffBehavior.Compose);
        }
示例#2
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);
        }