示例#1
0
        public static void ChangeObjectScaleX(FrameworkElement o, double oldScale, double newScale, double duration = 250, double delay = 0)
        {
            o.RenderTransform = new CompositeTransform();

            SineEase easingFunction = new SineEase();

            easingFunction.EasingMode = EasingMode.EaseInOut;

            DoubleAnimation scaleAnimation = new DoubleAnimation
            {
                From     = oldScale,
                To       = newScale,
                Duration = TimeSpan.FromMilliseconds(duration),
                EnableDependentAnimation = true,
                EasingFunction           = easingFunction,
                BeginTime = TimeSpan.FromMilliseconds(delay)
            };

            Storyboard.SetTargetProperty(scaleAnimation, "(UIElement.RenderTransform).(CompositeTransform.ScaleX)");
            Storyboard.SetTarget(scaleAnimation, o);

            Storyboard s = new Storyboard();

            s.Children.Add(scaleAnimation);
            s.Begin();
        }
        private Storyboard GetTurnAnimation(double angle)
        {
            Storyboard      storyboard = new Storyboard();
            DoubleAnimation turn       = new DoubleAnimation();

            turn.By       = angle;
            turn.Duration = new Duration(TimeSpan.FromSeconds(0.5));

            storyboard.Completed += InstructionAnimation_Completed;
            if (angle < 0)
            {
                storyboard.Completed += TurnLeftAnimation_Completed;
            }
            else
            {
                storyboard.Completed += TurnRightAnimation_Completed;
            }

            SineEase sineEase = new SineEase();

            sineEase.EasingMode = EasingMode.EaseInOut;
            turn.EasingFunction = sineEase;

            Storyboard.SetTarget(turn, control);
            Storyboard.SetTargetProperty(turn, new PropertyPath("(UIElement.RenderTransform).(RotateTransform.Angle)"));
            storyboard.Children.Add(turn);
            return(storyboard);
        }
示例#3
0
        public static void ChangeObjectHeight(DependencyObject o, double oldHeight, double newHeight, double duration = 250, double delay = 0, EasingFunctionBase easing = null)
        {
            SineEase defaultEasing = new SineEase();

            defaultEasing.EasingMode = EasingMode.EaseInOut;

            DoubleAnimation heightAnimation = new DoubleAnimation
            {
                From     = oldHeight,
                To       = newHeight,
                Duration = TimeSpan.FromMilliseconds(duration),
                EnableDependentAnimation = true,
                EasingFunction           = defaultEasing,
                BeginTime = TimeSpan.FromMilliseconds(delay)
            };

            if (easing != null)
            {
                heightAnimation.EasingFunction = easing;
            }

            Storyboard.SetTargetProperty(heightAnimation, "(FrameworkElement.Height)");
            Storyboard.SetTarget(heightAnimation, o);

            Storyboard s = new Storyboard();

            s.Children.Add(heightAnimation);
            s.Begin();
        }
示例#4
0
        private void DoTransition()
        {
            if (!IsLoaded || Math.Abs(MaxValue - default(double)) < double.Epsilon)
            {
                return;
            }

            double          progress            = Value / MaxValue;
            double          progressTargetWidth = _progressBackgroundLine.ActualWidth * progress;
            IEasingFunction easing = new SineEase {
                EasingMode = EasingMode.EaseIn
            };

            var widthAnimation = new DoubleAnimation
            {
                From           = 0d,
                To             = progressTargetWidth,
                Duration       = TimeSpan.FromMilliseconds(AnimationLength),
                EasingFunction = easing,
            };

            var valueAnimation = new DoubleAnimation
            {
                From           = 0d,
                To             = Value,
                Duration       = TimeSpan.FromMilliseconds(AnimationLength),
                EasingFunction = easing,
            };

            _progressLine.BeginAnimation(Rectangle.WidthProperty, widthAnimation);
            _progressText.BeginAnimation(AnimatedTextBlock.ValueProperty, valueAnimation);
        }
示例#5
0
        /// <summary>
        /// Smoothly animates a FrameworkElement's opacity according to the given paramaters
        /// </summary>
        public static void ChangeObjectOpacity(FrameworkElement o, double oldOpacity, double newOpacity, double duration = 250, double delay = 0)
        {
            SineEase easingFunction = new SineEase();

            easingFunction.EasingMode = EasingMode.EaseInOut;

            o.Opacity = oldOpacity;

            DoubleAnimation heightAnimation = new DoubleAnimation
            {
                From           = oldOpacity,
                To             = newOpacity,
                EasingFunction = easingFunction,
                Duration       = TimeSpan.FromMilliseconds(duration),
                BeginTime      = TimeSpan.FromMilliseconds(delay)
            };

            Storyboard.SetTargetProperty(heightAnimation, "(FrameworkElement.Opacity)");
            Storyboard.SetTarget(heightAnimation, o);

            Storyboard s = new Storyboard();

            s.Children.Add(heightAnimation);
            s.Begin();
        }
示例#6
0
        public static void FadeObjectVisibility(DependencyObject o, double oldOpacity, double newOpacity, Visibility visibility, double duration = 250, double delay = 0)
        {
            SineEase easingFunction = new SineEase();

            easingFunction.EasingMode = EasingMode.EaseInOut;

            DoubleAnimation heightAnimation = new DoubleAnimation
            {
                From           = oldOpacity,
                To             = newOpacity,
                EasingFunction = easingFunction,
                Duration       = TimeSpan.FromMilliseconds(duration),
                BeginTime      = TimeSpan.FromMilliseconds(delay)
            };

            UIElement uiElement = o as UIElement;

            if (visibility == Visibility.Visible)
            {
                uiElement.Visibility = Visibility.Visible;
            }
            else
            {
                heightAnimation.Completed += delegate { uiElement.Visibility = Visibility.Collapsed; };
            }

            Storyboard.SetTargetProperty(heightAnimation, "(FrameworkElement.Opacity)");
            Storyboard.SetTarget(heightAnimation, o);

            Storyboard s = new Storyboard();

            s.Children.Add(heightAnimation);
            s.Begin();
        }
示例#7
0
        public ROFLCopter(List <Grid> targetGrids)
        {
            _copter         = new Image();
            _copter.Stretch = Stretch.None;

            _targetGrids = targetGrids;

            var gif = new BitmapImage();

            gif.BeginInit();
            gif.UriSource = new Uri("..\\images\\roflcropped.gif", UriKind.Relative);
            gif.EndInit();

            ImageBehavior.SetAnimatedSource(_copter, gif);

            _translatePitch = new RotateTransform(10);
            _translateXY    = new TranslateTransform();

            var group = new TransformGroup();

            _copter.RenderTransform = group;
            _copter.Width           = 300;
            _copter.Height          = 300;

            group.Children.Add(_translatePitch);
            group.Children.Add(_translateXY);

            var easingY = new SineEase
            {
                EasingMode = EasingMode.EaseInOut
            };

            var easingPitch = new QuadraticEase
            {
                EasingMode = EasingMode.EaseOut
            };

            _animatePitch = new DoubleAnimation(0, 10, new Duration(new TimeSpan(0, 0, 5)))
            {
                EasingFunction = easingPitch,
                AutoReverse    = true
            };

            _animateY = new DoubleAnimation()
            {
                EasingFunction = easingY,
                AutoReverse    = true
            };

            _animateX            = new DoubleAnimation();
            _animateX.Completed += OnAnimationCompleted;

            _copter.Loaded += (s, a) =>
            {
                Play();
            };

            SetActiveGrid();
            _activeGrid.Children.Add(_copter);
        }
示例#8
0
        public void Animate(DependencyObject target, double from, double to,
                            string propertyPath, int duration, int startTime,
                            SineEase easing = null, Action completed = null)
        {
            if (easing == null)
            {
                easing = new SineEase();
            }

            var db = new DoubleAnimation
            {
                To                       = to,
                From                     = from,
                EasingFunction           = easing,
                Duration                 = TimeSpan.FromMilliseconds(duration),
                EnableDependentAnimation = true
            };

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

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

            if (completed != null)
            {
                sb.Completed += (s, e) => completed();
            }
            sb.Children.Add(db);
            sb.Begin();
        }
示例#9
0
        // close
        void CloseButton_Click(object sender, RoutedEventArgs e)
        {
            // opacity animation
            var opacityAnim = new DoubleAnimation(0, TimeSpan.FromMilliseconds(600));

            // scale Y animation
            SineEase easingFunction = new SineEase();

            easingFunction.EasingMode = EasingMode.EaseIn;
            var sclaeYAnim = new DoubleAnimation(0.001, TimeSpan.FromMilliseconds(300));

            sclaeYAnim.EasingFunction = easingFunction;

            // scale X animation
            var scaleXAnim = new DoubleAnimation(0, TimeSpan.FromMilliseconds(200));

            scaleXAnim.BeginTime = TimeSpan.FromMilliseconds(300);

            // storyboard
            var storyboard = new Storyboard();

            Storyboard.SetTargetProperty(opacityAnim, new PropertyPath(UIElement.OpacityProperty));
            Storyboard.SetTargetName(sclaeYAnim, "MyAnimatedScaleTransform");
            Storyboard.SetTargetProperty(sclaeYAnim, new PropertyPath(ScaleTransform.ScaleYProperty));
            Storyboard.SetTargetName(scaleXAnim, "MyAnimatedScaleTransform");
            Storyboard.SetTargetProperty(scaleXAnim, new PropertyPath(ScaleTransform.ScaleXProperty));

            storyboard.Children.Add(opacityAnim);
            storyboard.Children.Add(sclaeYAnim);
            storyboard.Children.Add(scaleXAnim);

            storyboard.Completed += delegate { window.Close(); };

            window.BeginStoryboard(storyboard);
        }
示例#10
0
        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();
            }

            if (target != null)
            {
                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();
            }
        }
示例#11
0
        private void ReShow()
        {
            void DoAnimate(PropertyPath propertyPath, Double to, EventHandler completed = null)
            {
                DoubleAnimationUsingKeyFrames easing = new DoubleAnimationUsingKeyFrames {
                    Duration = TimeSpan.FromMilliseconds(300)
                };
                SineEase efb = new SineEase {
                    EasingMode = EasingMode.EaseOut
                };
                EasingDoubleKeyFrame edkf = new EasingDoubleKeyFrame(to)
                {
                    EasingFunction = efb
                };

                easing.KeyFrames.Add(edkf);
                Storyboard sb = new Storyboard();

                Storyboard.SetTarget(easing, mainShow);
                Storyboard.SetTargetProperty(easing, propertyPath);
                if (completed != null)
                {
                    sb.Completed += completed;
                }
                sb.Children.Add(easing);
                sb.Begin();
            }

            DoAnimate(new PropertyPath(Image.OpacityProperty), 0, (sender, o) =>
            {
                mainShow.Source = images.GetWordCloud(year, season);
                DoAnimate(new PropertyPath(Image.OpacityProperty), 1);
            });
        }
示例#12
0
        private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            if (msg == ApiCodes.WM_SYSCOMMAND)
            {
                // minimize actions
                if (wParam.ToInt32() == ApiCodes.SC_MINIMIZE)
                {
                    SineEase easingFunction = new SineEase();
                    easingFunction.EasingMode = EasingMode.EaseIn;

                    var anim = new DoubleAnimation(0, TimeSpan.FromMilliseconds(300));
                    anim.EasingFunction = easingFunction;
                    anim.Completed     += delegate { window.WindowState = WindowState.Minimized; };
                    window.BeginAnimation(UIElement.OpacityProperty, anim);

                    handled = true;
                }
                // restore actions
                else if (wParam.ToInt32() == ApiCodes.SC_RESTORE)
                {
                    SineEase easingFunction = new SineEase();
                    easingFunction.EasingMode = EasingMode.EaseIn;

                    window.WindowState = WindowState.Normal;
                    var anim = new DoubleAnimation(1, TimeSpan.FromMilliseconds(300));
                    anim.EasingFunction = easingFunction;
                    window.BeginAnimation(UIElement.OpacityProperty, anim);

                    handled = true;
                }
            }
            return(IntPtr.Zero);
        }
示例#13
0
        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 animation = new DoubleAnimation
            {
                To             = to,
                From           = @from,
                EasingFunction = easing,
                Duration       = TimeSpan.FromMilliseconds(duration)
            };

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

            var storyBoard = new Storyboard {
                BeginTime = TimeSpan.FromMilliseconds(startTime)
            };

            if (completed != null)
            {
                storyBoard.Completed += (sender, args) => completed();
            }

            storyBoard.Children.Add(animation);
            storyBoard.Begin();
        }
        public void confirmDenyPhoto(bool _yesNo)
        {
            // Hide the yes and no buttons
            DoubleAnimation daHeight  = new DoubleAnimation(0, 150, new Duration(TimeSpan.FromSeconds(0.3)));
            DoubleAnimation daFHeight = new DoubleAnimation(0, 150, new Duration(TimeSpan.FromSeconds(0.3)));
            SineEase        ease      = new SineEase();

            ease.EasingMode          = EasingMode.EaseIn;
            daHeight.EasingFunction  = ease;
            daFHeight.EasingFunction = ease;
            daFHeight.BeginTime      = TimeSpan.FromSeconds(0.2);
            YNSpacer2.BeginAnimation(Canvas.HeightProperty, daFHeight);
            YNSpacer.BeginAnimation(Canvas.HeightProperty, daHeight);
            //btnYes.BeginAnimation(Button.MarginProperty

            // Show take photo
            DoubleAnimation daOpacity = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(0.5)));

            txtTakePhoto.Text = "TAKE PHOTO";
            txtTakePhoto.BeginAnimation(TextBlock.OpacityProperty, daOpacity);
            txtStartCountdown.BeginAnimation(TextBlock.OpacityProperty, daOpacity);

            if (_yesNo == true)
            {
                // Captions
                requestNewCaption(ApplicationStates.STATE_PHOTO_SUBMITTED, false);
                saveImageFrame();
            }
            else
            {
                // Captions
                requestNewCaption(ApplicationStates.STATE_PHOTO_DESTROYED, false);
                freezePhoto = false;
            }
        }
示例#15
0
        //Function that animates the circle to a certain state with a certain timing
        public void AnimateCircleAngle(double PercentBefore, double PercentAfter, double seconds, bool initialAnimation = true, bool useEase = true)
        {
            //We multiply the percentage by 3.6 because a full circle is 360 degrees, divide 360 by 100 and you get 3.6
            //So half a circle would be 50(%) * 3.6 = 180 degrees, half a circle.
            DoubleAnimation da = new DoubleAnimation(PercentBefore * 3.6, PercentAfter * 3.6, TimeSpan.FromSeconds(seconds));

            if (useEase)
            {
                SineEase ease = new SineEase();
                da.EasingFunction = ease;
            }

            if (initialAnimation)
            {
                da.Completed += (sender, e) =>
                {
                    AnimateCircleThickness(5, 15);
                    Status = "Aan het verwerken";
                };

                Status = "Een ogenblik geduld";
                AnimateLabelPeriods(statusLabel);
            }
            ProgressGraphic.BeginAnimation(Microsoft.Expression.Shapes.Arc.EndAngleProperty, da);
        }
示例#16
0
        // Refresh UI
        private void button4_Click(object sender, RoutedEventArgs e)
        {
            Storyboard     storyboardscale = new Storyboard();
            ScaleTransform scale           = new ScaleTransform();

            backgr.RenderTransform = scale;
            DoubleAnimation scaleAnim = new DoubleAnimation();

            scaleAnim.Duration = TimeSpan.FromMilliseconds(400);
            scaleAnim.From     = 2.0;
            scaleAnim.To       = 1.0;
            SineEase easingFunctionscale = new SineEase();

            easingFunctionscale.EasingMode = EasingMode.EaseInOut;
            scaleAnim.EasingFunction       = easingFunctionscale;
            Storyboard.SetTarget(scaleAnim, appBar);
            Storyboard.SetTargetProperty(scaleAnim, "(UIElement.RenderTransform).(ScaleTransform.ScaleX)");
            storyboardscale.Children.Add(scaleAnim);
            if (isAppBarOpen)
            {
                storyboardscale.Begin();
            }
            fadeInStoryboard.Begin();
            fadeInGridOpacity.Begin();
        }
示例#17
0
        private void setArrowAnimation(Image image, int beginTime)
        {
            Storyboard storyboard = new Storyboard();

            storyboard.Duration       = new Duration(new TimeSpan(0, 0, 2));
            storyboard.RepeatBehavior = RepeatBehavior.Forever;
            storyboard.AutoReverse    = true;
            storyboard.SpeedRatio     = 1.5;

            ((UIElement)image).RenderTransform = (Transform) new TranslateTransform();
            DoubleAnimation doubleAnimation1 = new DoubleAnimation();

            doubleAnimation1.Duration = new Duration(new TimeSpan(0, 0, 1));
            doubleAnimation1.From     = 50;
            doubleAnimation1.To       = 0;

            SineEase easingFunction = new SineEase();

            easingFunction.EasingMode       = EasingMode.EaseInOut;
            doubleAnimation1.EasingFunction = easingFunction;

            Storyboard.SetTarget((Timeline)doubleAnimation1, (DependencyObject)image.RenderTransform);
            Storyboard.SetTargetProperty((Timeline)doubleAnimation1, "X");
            ((ICollection <Timeline>)storyboard.Children).Add((Timeline)doubleAnimation1);

            storyboard.BeginTime = new TimeSpan(0, 0, 0, 0, beginTime);
            storyboard.Begin();
        }
示例#18
0
        public void initiatePhotoTake()
        {
            // Just in case it's a re-take, ensure the buttons are hidden
            // and background selection is hidden
            gsView.freezePhotoOrNot(false);

            if (Canvas.GetTop(btnStack) < (GlobalConfiguration.currentScreenH + btnStack.Height + 30))
            {
                DoubleAnimation daHeight = new DoubleAnimation(Canvas.GetTop(contentBorder) + contentBorder.ActualHeight + 50, (GlobalConfiguration.currentScreenH + btnStack.ActualHeight + 30), new Duration(TimeSpan.FromSeconds(0.3)));

                SineEase ease = new SineEase();
                ease.EasingMode         = EasingMode.EaseIn;
                daHeight.EasingFunction = ease;

                // Moves buttons down
                btnStack.BeginAnimation(Canvas.TopProperty, daHeight);
            }
            if (Canvas.GetLeft(stackBGs) < (GlobalConfiguration.currentScreenW + 50))
            {
                DoubleAnimation daFHeight = new DoubleAnimation((GlobalConfiguration.currentScreenW / 2 - stackBGs.ActualWidth / 2), (GlobalConfiguration.currentScreenW + 50), new Duration(TimeSpan.FromSeconds(0.3)));

                SineEase ease2 = new SineEase();
                daFHeight.EasingFunction = ease2;
                daFHeight.BeginTime      = TimeSpan.FromSeconds(0.2);
                // Moves backgrounds off to the right
                stackBGs.BeginAnimation(Canvas.LeftProperty, daFHeight);
            }

            if (sfxQueue != null)
            {
                sfxQueue = null;
            }

            // Disable cursors - way too distracting
            if (_mainWin != null)
            {
                _mainWin.enableDisableAllCursors(false);
            }

            // Hide take photo
            DoubleAnimation daOpacityHide = new DoubleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(0.5)));

            txtTakePhoto.BeginAnimation(TextBlock.OpacityProperty, daOpacityHide);
            txtStartCountdown.BeginAnimation(TextBlock.OpacityProperty, daOpacityHide);
            takePhoto.BeginAnimation(Button.OpacityProperty, daOpacityHide);
            takePhoto.IsHitTestVisible = false;
            // Hide the button

            sfxQueue = new List <string>();
            // Set the countdown text at the top most number
            countDown.Text = Properties.Settings.Default.photoCountdownSeconds.ToString();
            for (int i = 0; i < Properties.Settings.Default.photoCountdownSeconds; i++)
            {
                sfxQueue.Add("TDGenBeep.wav");
            }
            sfxQueue.Add("CameraFlash.mp3");
            playSoundEffect(sfxQueue[0]);
            countDown.Visibility = System.Windows.Visibility.Visible;
        }
示例#19
0
        internal void ShowTwist(TwistDirection twistDirection)
        {
            Double currentAngle   = (double)MasterGrid.RenderTransform.GetValue(CompositeTransform.RotationProperty);
            Double totalTwistTime = 1.0;

            ((DoubleAnimation)QuadrantRotation.Children[0]).From = currentAngle;
            ((DoubleAnimation)QuadrantRotation.Children[0]).To   =
                (twistDirection == TwistDirection.Clockwise) ? currentAngle + 90 : currentAngle - 90;
            ((DoubleAnimation)QuadrantRotation.Children[0]).Duration = new Duration(TimeSpan.FromSeconds(totalTwistTime));
            QuadrantRotation.BeginTime = TimeSpan.FromSeconds(1);

            SineEase f = new SineEase();

            f.EasingMode = EasingMode.EaseOut;

            ((DoubleAnimation)QuadrantTranslation.Children[0]).From = 0;
            Double to = 0;

            switch (this.Name.ToLower())
            {
            case "upperleft":
            case "lowerleft":
                to = -1 * MasterGrid.ActualWidth * (Math.Sqrt(2.0) - 1) / 2.0;
                break;

            case "upperright":
            case "lowerright":
                to = MasterGrid.ActualWidth * (Math.Sqrt(2.0) - 1) / 2.0;
                break;
            }
            ((DoubleAnimation)QuadrantTranslation.Children[0]).To = to;

            ((DoubleAnimation)QuadrantTranslation.Children[0]).EasingFunction = f;
            ((DoubleAnimation)QuadrantTranslation.Children[0]).Duration       = new Duration(TimeSpan.FromSeconds(totalTwistTime / 2.0));

            ((DoubleAnimation)QuadrantTranslation.Children[1]).From = 0;
            switch (this.Name.ToLower())
            {
            case "upperleft":
            case "upperright":
                to = -1 * MasterGrid.ActualWidth * (Math.Sqrt(2.0) - 1) / 2.0;
                break;

            case "lowerleft":
            case "lowerright":
                to = MasterGrid.ActualWidth * (Math.Sqrt(2.0) - 1) / 2.0;
                break;
            }
            ((DoubleAnimation)QuadrantTranslation.Children[1]).To             = to;
            ((DoubleAnimation)QuadrantTranslation.Children[1]).EasingFunction = f;
            ((DoubleAnimation)QuadrantTranslation.Children[1]).Duration       = new Duration(TimeSpan.FromSeconds(totalTwistTime / 2.0));
            QuadrantTranslation.AutoReverse = true;
            QuadrantTranslation.BeginTime   = TimeSpan.FromSeconds(1);



            QuadrantRotation.Begin();
            QuadrantTranslation.Begin();
        }
示例#20
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);
        }
示例#21
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);
        }
示例#22
0
        /// <summary>
        ///		Obtiene una función seno
        /// </summary>
        private SineEase GetSineEase(SineEaseModel sineEase)
        {
            SineEase ease = new SineEase();

            // Asigna las propiedades
            ease.EasingMode = ConvertEaseMode(sineEase.EaseMode);
            // Devuelve la función
            return(ease);
        }
示例#23
0
        private void nextSFXStep()
        {
            if (sfxQueue != null)
            {
                sfxQueue.RemoveAt(0);
                if (sfxQueue.Count > 0)
                {
                    playSoundEffect(sfxQueue[0]);
                    if (countDown.Visibility == System.Windows.Visibility.Visible)
                    {
                        countDown.Text = Convert.ToString(sfxQueue.Count - 1);
                    }

                    if (sfxQueue.Count == 1)
                    {
                        // Hide the count
                        countDown.Visibility = System.Windows.Visibility.Hidden;
                        countDown.Text       = Properties.Settings.Default.photoCountdownSeconds.ToString();

                        // Take the photo
                        gsView.freezePhotoOrNot(true);

                        // Flash the white
                        DoubleAnimation daFlashOpacity = new DoubleAnimation(0, .8, new Duration(TimeSpan.FromSeconds(0.1)));
                        daFlashOpacity.AutoReverse = true;

                        camFlash.BeginAnimation(Ellipse.OpacityProperty, daFlashOpacity);
                    }
                }
                else
                {
                    sfxQueue = null;
                    // Done
                    destroySFXPlayer();

                    // show yes or no button
                    DoubleAnimation daHeight = new DoubleAnimation((GlobalConfiguration.currentScreenH + btnStack.ActualHeight + 30), Canvas.GetTop(contentBorder) + contentBorder.ActualHeight + 50, new Duration(TimeSpan.FromSeconds(0.3)));

                    SineEase ease = new SineEase();
                    ease.EasingMode         = EasingMode.EaseOut;
                    daHeight.EasingFunction = ease;
                    daHeight.BeginTime      = TimeSpan.FromSeconds(6);
                    // Add a tiny delay
                    btnStack.BeginAnimation(Canvas.TopProperty, daHeight);

                    // Captions
                    requestNewCaption(ApplicationStates.STATE_LOOKINGGOOD, false);
                    requestNewCaption(ApplicationStates.STATE_YES_NOPHOTO, true);

                    // Re-enable the cursors
                    if (_mainWin != null)
                    {
                        _mainWin.enableDisableAllCursors(true);
                    }
                }
            }
        }
示例#24
0
        public async void AnimationNews()//Выезд и уход за экран окна новостей. Проверяет текущее состояние новостей и выполняет требуемые действияю
        {
            //  Canvas canvas = window.Content as Canvas;
            //  StackPanel contentControlNews = canvas.Children[3] as StackPanel;
            ThicknessAnimation thicknessAnimation = new ThicknessAnimation();
            SineEase           se = new SineEase();

            se.EasingMode = EasingMode.EaseInOut;
            thicknessAnimation.EasingFunction    = se;
            thicknessAnimation.DecelerationRatio = 0.5;

            if (showNews == true)//если истина, то выводим экран новостей
            {
                thicknessAnimation.From = NewsPanel.Margin;
                thicknessAnimation.To   = VideoViewAdv.Margin;// new Thickness(canvas.ma, canvas.Height / 2, 0, 0);
            }
            else
            {
                thicknessAnimation.From = NewsPanel.Margin;
                thicknessAnimation.To   = new Thickness(VideoViewAdv.Width / 2, VideoViewAdv.Height, 0, 0);
            }

            thicknessAnimation.Duration = TimeSpan.FromSeconds(3);

            storyboard = new Storyboard();
            Storyboard.SetTargetName(thicknessAnimation, NewsPanel.Name);
            Storyboard.SetTargetProperty(thicknessAnimation,
                                         new PropertyPath(StackPanel.MarginProperty));
            storyboard.Children.Add(thicknessAnimation);
            storyboard.Completed += Storyboard_Completed;

            if (showNews == true)//если истина, то выводим экран новостей
            {
                VideoViewNews.Visibility = Visibility.Visible;
            }

            await Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                                                             new Action(() => {
                storyboard.Begin(this);
            }));



            // Dispatcher.Invoke(() => { storyboard.Begin(this); });

            // await Dispatcher.InvokeAsync(() => { storyboard.Begin(this); });

            //  await BeginAnimationAsync(this);
            //NewsPanel.BeginAnimation(StackPanel.MarginProperty, thicknessAnimation);

            //Storyboard storyboard = new Storyboard();
            //storyboard.Be
            //  return this;
        }
示例#25
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);
        }
示例#26
0
        private void Window_Initialized(object sender, EventArgs e)
        {
            Opacity = 0;
            DoubleAnimation fadein = new()
            {
                Duration = TimeSpan.FromSeconds(0.5),
                From     = 0,
                To       = 1
            };

            BeginAnimation(OpacityProperty, fadein);
            IEasingFunction se = new SineEase();

            ((SineEase)se).EasingMode = EasingMode.EaseInOut;
            ThicknessAnimationUsingKeyFrames horz = new()
            {
                Duration       = TimeSpan.FromSeconds(3),
                RepeatBehavior = RepeatBehavior.Forever,
                AutoReverse    = true
            };

            horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(3, -3, 0, 0), KeyTime.Uniform, se));
            horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(3, 0, 0, 0), KeyTime.Uniform, se));
            horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(-3, -3, 0, 0), KeyTime.Uniform, se));
            horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(-3, 3, 0, 0), KeyTime.Uniform, se));
            horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(0, -3, 0, 0), KeyTime.Uniform, se));
            horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(-3, 0, 0, 0), KeyTime.Uniform, se));
            horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(3, 3, 0, 0), KeyTime.Uniform, se));
            horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(0, -3, 0, 0), KeyTime.Uniform, se));
            horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(0, 0, 0, 0), KeyTime.Uniform, se));
            Ship.BeginAnimation(MarginProperty, horz);
            DoubleAnimationUsingKeyFrames flicker = new()
            {
                Duration       = TimeSpan.FromSeconds(0.3),
                RepeatBehavior = RepeatBehavior.Forever,
                AutoReverse    = true
            };

            flicker.KeyFrames.Add(new EasingDoubleKeyFrame(0.3));
            flicker.KeyFrames.Add(new EasingDoubleKeyFrame(0));
            Flame.BeginAnimation(OpacityProperty, flicker);
        }

        private void Website_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            e.Handled = true;
            Process.Start("OpenWith.exe", Site);
        }

        private void Window_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            Close();
        }
示例#27
0
        public static void CreateFadeStoryboard(UIElement element, Storyboard storyboard, bool isInvertFade = false, bool reverse = true, int animationTime = 500)
        {
            storyboard.Children.Clear();
            TimeSpan duration = TimeSpan.FromMilliseconds(animationTime);

            DoubleAnimation fadeOutAnimation = new(element.Opacity > 0 ? element.Opacity : isInvertFade ? 0 : 1, toValue : isInvertFade ? 1 : 0, duration : new Duration(duration))
            { EasingFunction = new SineEase(), AutoReverse = reverse, FillBehavior = reverse ? FillBehavior.HoldEnd : FillBehavior.Stop };

            Storyboard.SetTarget(fadeOutAnimation, element);
            Storyboard.SetTargetProperty(fadeOutAnimation, new PropertyPath(nameof(FrameworkElement.Opacity)));
            storyboard.Children.Add(fadeOutAnimation);
        }
    }
示例#28
0
        public void AnimateCircleColor(Color NewColor, int timespan = 1000)
        {
            SolidColorBrush OldColor = new SolidColorBrush(BrushToColor(ProgressGraphic.Stroke));

            ProgressGraphic.Stroke = OldColor;

            ColorAnimation ca = new ColorAnimation(OldColor.Color, NewColor, TimeSpan.FromMilliseconds(timespan));

            SineEase ease = new SineEase();

            ca.EasingFunction = ease;

            OldColor.BeginAnimation(SolidColorBrush.ColorProperty, ca);
        }
        private static ThicknessAnimation RandomMarginAnimation(double left, double top, double right, double length)
        {
            var animation = new ThicknessAnimation();

            animation.From        = new Thickness(0);
            animation.To          = new Thickness(left, top, right, 0);
            animation.Duration    = TimeSpan.FromMilliseconds(length);
            animation.AutoReverse = true;
            var ease = new SineEase();

            ease.EasingMode          = EasingMode.EaseInOut;
            animation.EasingFunction = ease;
            return(animation);
        }
示例#30
0
        //Function that animates the circle to a certain state
        private void AnimateCircleAngle(double PercentBefore, double PercentAfter)
        {
            //Make time relative based on how much we are animating
            double time = PercentAfter - PercentBefore;

            //We multiply the percentage by 3.6 because a full circle is 360 degrees, divide 360 by 100 and you get 3.6
            //So half a circle would be 50(%) * 3.6 = 180 degrees, half a circle.
            DoubleAnimation da = new DoubleAnimation(PercentBefore * 3.6, PercentAfter * 3.6, TimeSpan.FromSeconds(time * 0.025));

            SineEase ease = new SineEase();

            da.EasingFunction = ease;

            ProgressGraphic.BeginAnimation(Microsoft.Expression.Shapes.Arc.EndAngleProperty, da);
        }
示例#31
0
 private void InitializeResources()
 {
     // Resource - [ToolTipText] String
     this.Add("ToolTipText", "Click to open message box");
     // Resource - [TitleResource] String
     this.Add("TitleResource", "Basic UI Example");
     // Resource - [logoSunburn] BitmapImage
     BitmapImage r_2_bm = new BitmapImage();
     r_2_bm.TextureAsset = "Images/SunBurn";
     this.Add("logoSunburn", r_2_bm);
     // Resource - [buttonStyle] Style
     var r_3_s_bo = this[typeof(Button)];
     Style r_3_s = new Style(typeof(Button), r_3_s_bo as Style);
     Setter r_3_s_S_0 = new Setter(Button.BackgroundProperty, new SolidColorBrush(new ColorW(255, 140, 0, 255)));
     r_3_s.Setters.Add(r_3_s_S_0);
     Setter r_3_s_S_1 = new Setter(Button.WidthProperty, 200F);
     r_3_s.Setters.Add(r_3_s_S_1);
     Setter r_3_s_S_2 = new Setter(Button.PaddingProperty, new Thickness(2F));
     r_3_s.Setters.Add(r_3_s_S_2);
     this.Add("buttonStyle", r_3_s);
     // Resource - [logoEmptyKeys] BitmapImage
     BitmapImage r_4_bm = new BitmapImage();
     r_4_bm.TextureAsset = "Images/EmptyKeysLogoTextSmall";
     this.Add("logoEmptyKeys", r_4_bm);
     // Resource - [buttonAnimStyle] Style
     var r_5_s_bo = this[typeof(Button)];
     Style r_5_s = new Style(typeof(Button), r_5_s_bo as Style);
     Setter r_5_s_S_0 = new Setter(Button.WidthProperty, 200F);
     r_5_s.Setters.Add(r_5_s_S_0);
     Setter r_5_s_S_1 = new Setter(Button.MarginProperty, new Thickness(0F, 1F, 0F, 1F));
     r_5_s.Setters.Add(r_5_s_S_1);
     Setter r_5_s_S_2 = new Setter(Button.SnapsToDevicePixelsProperty, false);
     r_5_s.Setters.Add(r_5_s_S_2);
     EventTrigger r_5_s_ET_0 = new EventTrigger(Button.MouseEnterEvent);
     r_5_s.Triggers.Add(r_5_s_ET_0);
     BeginStoryboard r_5_s_ET_0_AC_0 = new BeginStoryboard();
     r_5_s_ET_0_AC_0.Name = "r_5_s_ET_0_AC_0";
     r_5_s_ET_0.AddAction(r_5_s_ET_0_AC_0);
     Storyboard r_5_s_ET_0_AC_0_SB = new Storyboard();
     r_5_s_ET_0_AC_0.Storyboard = r_5_s_ET_0_AC_0_SB;
     r_5_s_ET_0_AC_0_SB.Name = "r_5_s_ET_0_AC_0_SB";
     ThicknessAnimation r_5_s_ET_0_AC_0_SB_TL_0 = new ThicknessAnimation();
     r_5_s_ET_0_AC_0_SB_TL_0.Name = "r_5_s_ET_0_AC_0_SB_TL_0";
     r_5_s_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_5_s_ET_0_AC_0_SB_TL_0.From = new Thickness(0F, 1F, 0F, 1F);
     r_5_s_ET_0_AC_0_SB_TL_0.To = new Thickness(0F, 5F, 0F, 5F);
     SineEase r_5_s_ET_0_AC_0_SB_TL_0_EA = new SineEase();
     r_5_s_ET_0_AC_0_SB_TL_0.EasingFunction = r_5_s_ET_0_AC_0_SB_TL_0_EA;
     Storyboard.SetTargetProperty(r_5_s_ET_0_AC_0_SB_TL_0, Button.MarginProperty);
     r_5_s_ET_0_AC_0_SB.Children.Add(r_5_s_ET_0_AC_0_SB_TL_0);
     FloatAnimation r_5_s_ET_0_AC_0_SB_TL_1 = new FloatAnimation();
     r_5_s_ET_0_AC_0_SB_TL_1.Name = "r_5_s_ET_0_AC_0_SB_TL_1";
     r_5_s_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_5_s_ET_0_AC_0_SB_TL_1.To = 220F;
     SineEase r_5_s_ET_0_AC_0_SB_TL_1_EA = new SineEase();
     r_5_s_ET_0_AC_0_SB_TL_1.EasingFunction = r_5_s_ET_0_AC_0_SB_TL_1_EA;
     Storyboard.SetTargetProperty(r_5_s_ET_0_AC_0_SB_TL_1, Button.WidthProperty);
     r_5_s_ET_0_AC_0_SB.Children.Add(r_5_s_ET_0_AC_0_SB_TL_1);
     EventTrigger r_5_s_ET_1 = new EventTrigger(Button.MouseLeaveEvent);
     r_5_s.Triggers.Add(r_5_s_ET_1);
     BeginStoryboard r_5_s_ET_1_AC_0 = new BeginStoryboard();
     r_5_s_ET_1_AC_0.Name = "r_5_s_ET_1_AC_0";
     r_5_s_ET_1.AddAction(r_5_s_ET_1_AC_0);
     Storyboard r_5_s_ET_1_AC_0_SB = new Storyboard();
     r_5_s_ET_1_AC_0.Storyboard = r_5_s_ET_1_AC_0_SB;
     r_5_s_ET_1_AC_0_SB.Name = "r_5_s_ET_1_AC_0_SB";
     ThicknessAnimation r_5_s_ET_1_AC_0_SB_TL_0 = new ThicknessAnimation();
     r_5_s_ET_1_AC_0_SB_TL_0.Name = "r_5_s_ET_1_AC_0_SB_TL_0";
     r_5_s_ET_1_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_5_s_ET_1_AC_0_SB_TL_0.From = new Thickness(0F, 5F, 0F, 5F);
     r_5_s_ET_1_AC_0_SB_TL_0.To = new Thickness(0F, 1F, 0F, 1F);
     SineEase r_5_s_ET_1_AC_0_SB_TL_0_EA = new SineEase();
     r_5_s_ET_1_AC_0_SB_TL_0.EasingFunction = r_5_s_ET_1_AC_0_SB_TL_0_EA;
     Storyboard.SetTargetProperty(r_5_s_ET_1_AC_0_SB_TL_0, Button.MarginProperty);
     r_5_s_ET_1_AC_0_SB.Children.Add(r_5_s_ET_1_AC_0_SB_TL_0);
     FloatAnimation r_5_s_ET_1_AC_0_SB_TL_1 = new FloatAnimation();
     r_5_s_ET_1_AC_0_SB_TL_1.Name = "r_5_s_ET_1_AC_0_SB_TL_1";
     r_5_s_ET_1_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_5_s_ET_1_AC_0_SB_TL_1.To = 200F;
     SineEase r_5_s_ET_1_AC_0_SB_TL_1_EA = new SineEase();
     r_5_s_ET_1_AC_0_SB_TL_1.EasingFunction = r_5_s_ET_1_AC_0_SB_TL_1_EA;
     Storyboard.SetTargetProperty(r_5_s_ET_1_AC_0_SB_TL_1, Button.WidthProperty);
     r_5_s_ET_1_AC_0_SB.Children.Add(r_5_s_ET_1_AC_0_SB_TL_1);
     this.Add("buttonAnimStyle", r_5_s);
     // Resource - [MessageBoxButtonYes] String
     this.Add("MessageBoxButtonYes", "Yes!");
     // Resource - [Sounds] SoundSourceCollection
     var r_7_sounds = new SoundSourceCollection();
     r_7_sounds.Add(new SoundSource { SoundType = SoundType.ButtonsClick, SoundAsset = "Click" });
     SoundManager.Instance.AddSound("Click");
     r_7_sounds.Add(new SoundSource { SoundType = SoundType.TextBoxKeyPress, SoundAsset = "KeyPress" });
     SoundManager.Instance.AddSound("KeyPress");
     r_7_sounds.Add(new SoundSource { SoundType = SoundType.TabControlMove, SoundAsset = "Move" });
     SoundManager.Instance.AddSound("Move");
     r_7_sounds.Add(new SoundSource { SoundType = SoundType.TabControlSelect, SoundAsset = "Select" });
     SoundManager.Instance.AddSound("Select");
     this.Add("Sounds", r_7_sounds);
     ImageManager.Instance.AddImage("Images/SunBurn");
     ImageManager.Instance.AddImage("Images/EmptyKeysLogoTextSmall");
     FontManager.Instance.AddFont("Segoe UI", 13.33333F, FontStyle.Regular, "Segoe_UI_10_Regular");
     FontManager.Instance.AddFont("Segoe UI", 20F, FontStyle.Bold, "Segoe_UI_15_Bold");
     FontManager.Instance.AddFont("Segoe UI", 12F, FontStyle.Regular, "Segoe_UI_9_Regular");
 }
示例#32
0
 private void InitializeResources()
 {
     // Resource - [buttonStyle] Style
     var r_0_s_bo = this[typeof(Button)];
     Style r_0_s = new Style(typeof(Button), r_0_s_bo as Style);
     Setter r_0_s_S_0 = new Setter(Button.BackgroundProperty, new SolidColorBrush(new ColorW(255, 140, 0, 255)));
     r_0_s.Setters.Add(r_0_s_S_0);
     this.Add("buttonStyle", r_0_s);
     // Resource - [Image] BitmapImage
     BitmapImage r_1_bm = new BitmapImage();
     r_1_bm.TextureAsset = "Images/MonoGameLogo";
     this.Add("Image", r_1_bm);
     // Resource - [TetrisWindowBackground] SolidColorBrush
     this.Add("TetrisWindowBackground", new SolidColorBrush(new ColorW(0, 0, 0, 255)));
     // Resource - [TetrisForeground] SolidColorBrush
     this.Add("TetrisForeground", new SolidColorBrush(new ColorW(255, 255, 255, 255)));
     // Resource - [TitleResource] String
     this.Add("TitleResource", "Basic UI Example");
     // Resource - [TetrisBorderStyle] Style
     Style r_5_s = new Style(typeof(Border));
     Setter r_5_s_S_0 = new Setter(Border.SnapsToDevicePixelsProperty, true);
     r_5_s.Setters.Add(r_5_s_S_0);
     Setter r_5_s_S_1 = new Setter(Border.BackgroundProperty, new ResourceReferenceExpression("TetrisWindowBackground"));
     r_5_s.Setters.Add(r_5_s_S_1);
     Setter r_5_s_S_2 = new Setter(Border.BorderBrushProperty, new ResourceReferenceExpression("TetrisBorderBrush"));
     r_5_s.Setters.Add(r_5_s_S_2);
     Setter r_5_s_S_3 = new Setter(Border.BorderThicknessProperty, new Thickness(1F));
     r_5_s.Setters.Add(r_5_s_S_3);
     Setter r_5_s_S_4 = new Setter(Border.OpacityProperty, 0.9F);
     r_5_s.Setters.Add(r_5_s_S_4);
     this.Add("TetrisBorderStyle", r_5_s);
     // Resource - [DataTemplateKey(GameData.TestTreeDataItem)] DataTemplate
     Func<UIElement, UIElement> r_6_dtFunc = r_6_dtMethod;
     this.Add(typeof(GameData.TestTreeDataItem), new DataTemplate(typeof(GameData.TestTreeDataItem), r_6_dtFunc));
     // Resource - [CustomWindowTemplate] ControlTemplate
     Func<UIElement, UIElement> r_7_ctFunc = r_7_ctMethod;
     ControlTemplate r_7_ct = new ControlTemplate(r_7_ctFunc);
     this.Add("CustomWindowTemplate", r_7_ct);
     // Resource - [buttonAnimStyle] Style
     var r_8_s_bo = this[typeof(Button)];
     Style r_8_s = new Style(typeof(Button), r_8_s_bo as Style);
     Setter r_8_s_S_0 = new Setter(Button.WidthProperty, 200F);
     r_8_s.Setters.Add(r_8_s_S_0);
     Setter r_8_s_S_1 = new Setter(Button.MarginProperty, new Thickness(0F, 1F, 0F, 1F));
     r_8_s.Setters.Add(r_8_s_S_1);
     Setter r_8_s_S_2 = new Setter(Button.SnapsToDevicePixelsProperty, false);
     r_8_s.Setters.Add(r_8_s_S_2);
     EventTrigger r_8_s_ET_0 = new EventTrigger(Button.MouseEnterEvent);
     r_8_s.Triggers.Add(r_8_s_ET_0);
     BeginStoryboard r_8_s_ET_0_AC_0 = new BeginStoryboard();
     r_8_s_ET_0_AC_0.Name = "r_8_s_ET_0_AC_0";
     r_8_s_ET_0.AddAction(r_8_s_ET_0_AC_0);
     Storyboard r_8_s_ET_0_AC_0_SB = new Storyboard();
     r_8_s_ET_0_AC_0.Storyboard = r_8_s_ET_0_AC_0_SB;
     r_8_s_ET_0_AC_0_SB.Name = "r_8_s_ET_0_AC_0_SB";
     ThicknessAnimation r_8_s_ET_0_AC_0_SB_TL_0 = new ThicknessAnimation();
     r_8_s_ET_0_AC_0_SB_TL_0.Name = "r_8_s_ET_0_AC_0_SB_TL_0";
     r_8_s_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_8_s_ET_0_AC_0_SB_TL_0.From = new Thickness(0F, 1F, 0F, 1F);
     r_8_s_ET_0_AC_0_SB_TL_0.To = new Thickness(0F, 5F, 0F, 5F);
     SineEase r_8_s_ET_0_AC_0_SB_TL_0_EA = new SineEase();
     r_8_s_ET_0_AC_0_SB_TL_0.EasingFunction = r_8_s_ET_0_AC_0_SB_TL_0_EA;
     Storyboard.SetTargetProperty(r_8_s_ET_0_AC_0_SB_TL_0, Button.MarginProperty);
     r_8_s_ET_0_AC_0_SB.Children.Add(r_8_s_ET_0_AC_0_SB_TL_0);
     FloatAnimation r_8_s_ET_0_AC_0_SB_TL_1 = new FloatAnimation();
     r_8_s_ET_0_AC_0_SB_TL_1.Name = "r_8_s_ET_0_AC_0_SB_TL_1";
     r_8_s_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_8_s_ET_0_AC_0_SB_TL_1.To = 220F;
     SineEase r_8_s_ET_0_AC_0_SB_TL_1_EA = new SineEase();
     r_8_s_ET_0_AC_0_SB_TL_1.EasingFunction = r_8_s_ET_0_AC_0_SB_TL_1_EA;
     Storyboard.SetTargetProperty(r_8_s_ET_0_AC_0_SB_TL_1, Button.WidthProperty);
     r_8_s_ET_0_AC_0_SB.Children.Add(r_8_s_ET_0_AC_0_SB_TL_1);
     EventTrigger r_8_s_ET_1 = new EventTrigger(Button.MouseLeaveEvent);
     r_8_s.Triggers.Add(r_8_s_ET_1);
     BeginStoryboard r_8_s_ET_1_AC_0 = new BeginStoryboard();
     r_8_s_ET_1_AC_0.Name = "r_8_s_ET_1_AC_0";
     r_8_s_ET_1.AddAction(r_8_s_ET_1_AC_0);
     Storyboard r_8_s_ET_1_AC_0_SB = new Storyboard();
     r_8_s_ET_1_AC_0.Storyboard = r_8_s_ET_1_AC_0_SB;
     r_8_s_ET_1_AC_0_SB.Name = "r_8_s_ET_1_AC_0_SB";
     ThicknessAnimation r_8_s_ET_1_AC_0_SB_TL_0 = new ThicknessAnimation();
     r_8_s_ET_1_AC_0_SB_TL_0.Name = "r_8_s_ET_1_AC_0_SB_TL_0";
     r_8_s_ET_1_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_8_s_ET_1_AC_0_SB_TL_0.From = new Thickness(0F, 5F, 0F, 5F);
     r_8_s_ET_1_AC_0_SB_TL_0.To = new Thickness(0F, 1F, 0F, 1F);
     SineEase r_8_s_ET_1_AC_0_SB_TL_0_EA = new SineEase();
     r_8_s_ET_1_AC_0_SB_TL_0.EasingFunction = r_8_s_ET_1_AC_0_SB_TL_0_EA;
     Storyboard.SetTargetProperty(r_8_s_ET_1_AC_0_SB_TL_0, Button.MarginProperty);
     r_8_s_ET_1_AC_0_SB.Children.Add(r_8_s_ET_1_AC_0_SB_TL_0);
     FloatAnimation r_8_s_ET_1_AC_0_SB_TL_1 = new FloatAnimation();
     r_8_s_ET_1_AC_0_SB_TL_1.Name = "r_8_s_ET_1_AC_0_SB_TL_1";
     r_8_s_ET_1_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_8_s_ET_1_AC_0_SB_TL_1.To = 200F;
     SineEase r_8_s_ET_1_AC_0_SB_TL_1_EA = new SineEase();
     r_8_s_ET_1_AC_0_SB_TL_1.EasingFunction = r_8_s_ET_1_AC_0_SB_TL_1_EA;
     Storyboard.SetTargetProperty(r_8_s_ET_1_AC_0_SB_TL_1, Button.WidthProperty);
     r_8_s_ET_1_AC_0_SB.Children.Add(r_8_s_ET_1_AC_0_SB_TL_1);
     this.Add("buttonAnimStyle", r_8_s);
     // Resource - [Sounds] SoundSourceCollection
     var r_9_sounds = new SoundSourceCollection();
     r_9_sounds.Add(new SoundSource { SoundType = SoundType.ButtonsClick, SoundAsset = "Click" });
     SoundManager.Instance.AddSound("Click");
     r_9_sounds.Add(new SoundSource { SoundType = SoundType.TextBoxKeyPress, SoundAsset = "KeyPress" });
     SoundManager.Instance.AddSound("KeyPress");
     r_9_sounds.Add(new SoundSource { SoundType = SoundType.TabControlMove, SoundAsset = "Move" });
     SoundManager.Instance.AddSound("Move");
     r_9_sounds.Add(new SoundSource { SoundType = SoundType.TabControlSelect, SoundAsset = "Select" });
     SoundManager.Instance.AddSound("Select");
     this.Add("Sounds", r_9_sounds);
     // Resource - [TetrisBorderBrush] SolidColorBrush
     this.Add("TetrisBorderBrush", new SolidColorBrush(new ColorW(114, 176, 218, 255)));
     // Resource - [DataTemplateKey(GameData.CustomWindow)] DataTemplate
     Func<UIElement, UIElement> r_11_dtFunc = r_11_dtMethod;
     this.Add(typeof(GameData.CustomWindow), new DataTemplate(typeof(GameData.CustomWindow), r_11_dtFunc));
     ImageManager.Instance.AddImage("Images/MonoGameLogo");
     FontManager.Instance.AddFont("Segoe UI", 12F, FontStyle.Regular, "Segoe_UI_9_Regular");
     FontManager.Instance.AddFont("Segoe UI", 20F, FontStyle.Bold, "Segoe_UI_15_Bold");
 }
示例#33
0
 private void InitializeResources() {
     // Resource - [HydrogenIcon] BitmapImage
     BitmapImage r_0_bm = new BitmapImage();
     r_0_bm.TextureAsset = "ImagesUI/hydrogen_res";
     this.Add("HydrogenIcon", r_0_bm);
     // Resource - [BiomassIcon] BitmapImage
     BitmapImage r_1_bm = new BitmapImage();
     r_1_bm.TextureAsset = "ImagesUI/biomass_res";
     this.Add("BiomassIcon", r_1_bm);
     // Resource - [CopperIcon] BitmapImage
     BitmapImage r_2_bm = new BitmapImage();
     r_2_bm.TextureAsset = "ImagesUI/copper_res";
     this.Add("CopperIcon", r_2_bm);
     // Resource - [LeadIcon] BitmapImage
     BitmapImage r_3_bm = new BitmapImage();
     r_3_bm.TextureAsset = "ImagesUI/lead_res";
     this.Add("LeadIcon", r_3_bm);
     // Resource - [AluminiumIcon] BitmapImage
     BitmapImage r_4_bm = new BitmapImage();
     r_4_bm.TextureAsset = "ImagesUI/aluminium_res";
     this.Add("AluminiumIcon", r_4_bm);
     // Resource - [NaturalGasIcon] BitmapImage
     BitmapImage r_5_bm = new BitmapImage();
     r_5_bm.TextureAsset = "ImagesUI/gas_res";
     this.Add("NaturalGasIcon", r_5_bm);
     // Resource - [PropaneIcon] BitmapImage
     BitmapImage r_6_bm = new BitmapImage();
     r_6_bm.TextureAsset = "ImagesUI/propane_res";
     this.Add("PropaneIcon", r_6_bm);
     // Resource - [DiamondIcon] BitmapImage
     BitmapImage r_7_bm = new BitmapImage();
     r_7_bm.TextureAsset = "ImagesUI/diamond_res";
     this.Add("DiamondIcon", r_7_bm);
     // Resource - [MonoGameLogo] BitmapImage
     BitmapImage r_8_bm = new BitmapImage();
     r_8_bm.TextureAsset = "Images/MonogameLogo";
     this.Add("MonoGameLogo", r_8_bm);
     // Resource - [MiningIcon] BitmapImage
     BitmapImage r_9_bm = new BitmapImage();
     r_9_bm.TextureAsset = "ImagesUI/mine_build";
     this.Add("MiningIcon", r_9_bm);
     // Resource - [TimberIcon] BitmapImage
     BitmapImage r_10_bm = new BitmapImage();
     r_10_bm.TextureAsset = "ImagesUI/timber_res";
     this.Add("TimberIcon", r_10_bm);
     // Resource - [TitaniumIcon] BitmapImage
     BitmapImage r_11_bm = new BitmapImage();
     r_11_bm.TextureAsset = "ImagesUI/titanium_res";
     this.Add("TitaniumIcon", r_11_bm);
     // Resource - [Building2] BitmapImage
     BitmapImage r_12_bm = new BitmapImage();
     r_12_bm.TextureAsset = "ImagesUI/building2";
     this.Add("Building2", r_12_bm);
     // Resource - [Building1] BitmapImage
     BitmapImage r_13_bm = new BitmapImage();
     r_13_bm.TextureAsset = "ImagesUI/building1";
     this.Add("Building1", r_13_bm);
     // Resource - [Sounds] SoundSourceCollection
     var r_14_sounds = new SoundSourceCollection();
     r_14_sounds.Add(new SoundSource { SoundType = SoundType.ButtonsClick, SoundAsset = "Click" });
     SoundManager.Instance.AddSound("Click");
     r_14_sounds.Add(new SoundSource { SoundType = SoundType.TextBoxKeyPress, SoundAsset = "KeyPress" });
     SoundManager.Instance.AddSound("KeyPress");
     r_14_sounds.Add(new SoundSource { SoundType = SoundType.TabControlMove, SoundAsset = "Move" });
     SoundManager.Instance.AddSound("Move");
     r_14_sounds.Add(new SoundSource { SoundType = SoundType.TabControlSelect, SoundAsset = "Select" });
     SoundManager.Instance.AddSound("Select");
     this.Add("Sounds", r_14_sounds);
     // Resource - [buttonAnimStyle] Style
     var r_15_s_bo = this[typeof(Button)];
     Style r_15_s = new Style(typeof(Button), r_15_s_bo as Style);
     Setter r_15_s_S_0 = new Setter(Button.WidthProperty, 200F);
     r_15_s.Setters.Add(r_15_s_S_0);
     Setter r_15_s_S_1 = new Setter(Button.MarginProperty, new Thickness(0F, 1F, 0F, 1F));
     r_15_s.Setters.Add(r_15_s_S_1);
     Setter r_15_s_S_2 = new Setter(Button.SnapsToDevicePixelsProperty, false);
     r_15_s.Setters.Add(r_15_s_S_2);
     EventTrigger r_15_s_ET_0 = new EventTrigger(Button.MouseEnterEvent);
     r_15_s.Triggers.Add(r_15_s_ET_0);
     BeginStoryboard r_15_s_ET_0_AC_0 = new BeginStoryboard();
     r_15_s_ET_0_AC_0.Name = "r_15_s_ET_0_AC_0";
     r_15_s_ET_0.AddAction(r_15_s_ET_0_AC_0);
     Storyboard r_15_s_ET_0_AC_0_SB = new Storyboard();
     r_15_s_ET_0_AC_0.Storyboard = r_15_s_ET_0_AC_0_SB;
     r_15_s_ET_0_AC_0_SB.Name = "r_15_s_ET_0_AC_0_SB";
     ThicknessAnimation r_15_s_ET_0_AC_0_SB_TL_0 = new ThicknessAnimation();
     r_15_s_ET_0_AC_0_SB_TL_0.Name = "r_15_s_ET_0_AC_0_SB_TL_0";
     r_15_s_ET_0_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_15_s_ET_0_AC_0_SB_TL_0.From = new Thickness(0F, 1F, 0F, 1F);
     r_15_s_ET_0_AC_0_SB_TL_0.To = new Thickness(0F, 5F, 0F, 5F);
     SineEase r_15_s_ET_0_AC_0_SB_TL_0_EA = new SineEase();
     r_15_s_ET_0_AC_0_SB_TL_0.EasingFunction = r_15_s_ET_0_AC_0_SB_TL_0_EA;
     Storyboard.SetTargetProperty(r_15_s_ET_0_AC_0_SB_TL_0, Button.MarginProperty);
     r_15_s_ET_0_AC_0_SB.Children.Add(r_15_s_ET_0_AC_0_SB_TL_0);
     FloatAnimation r_15_s_ET_0_AC_0_SB_TL_1 = new FloatAnimation();
     r_15_s_ET_0_AC_0_SB_TL_1.Name = "r_15_s_ET_0_AC_0_SB_TL_1";
     r_15_s_ET_0_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_15_s_ET_0_AC_0_SB_TL_1.To = 220F;
     SineEase r_15_s_ET_0_AC_0_SB_TL_1_EA = new SineEase();
     r_15_s_ET_0_AC_0_SB_TL_1.EasingFunction = r_15_s_ET_0_AC_0_SB_TL_1_EA;
     Storyboard.SetTargetProperty(r_15_s_ET_0_AC_0_SB_TL_1, Button.WidthProperty);
     r_15_s_ET_0_AC_0_SB.Children.Add(r_15_s_ET_0_AC_0_SB_TL_1);
     EventTrigger r_15_s_ET_1 = new EventTrigger(Button.MouseLeaveEvent);
     r_15_s.Triggers.Add(r_15_s_ET_1);
     BeginStoryboard r_15_s_ET_1_AC_0 = new BeginStoryboard();
     r_15_s_ET_1_AC_0.Name = "r_15_s_ET_1_AC_0";
     r_15_s_ET_1.AddAction(r_15_s_ET_1_AC_0);
     Storyboard r_15_s_ET_1_AC_0_SB = new Storyboard();
     r_15_s_ET_1_AC_0.Storyboard = r_15_s_ET_1_AC_0_SB;
     r_15_s_ET_1_AC_0_SB.Name = "r_15_s_ET_1_AC_0_SB";
     ThicknessAnimation r_15_s_ET_1_AC_0_SB_TL_0 = new ThicknessAnimation();
     r_15_s_ET_1_AC_0_SB_TL_0.Name = "r_15_s_ET_1_AC_0_SB_TL_0";
     r_15_s_ET_1_AC_0_SB_TL_0.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_15_s_ET_1_AC_0_SB_TL_0.From = new Thickness(0F, 5F, 0F, 5F);
     r_15_s_ET_1_AC_0_SB_TL_0.To = new Thickness(0F, 1F, 0F, 1F);
     SineEase r_15_s_ET_1_AC_0_SB_TL_0_EA = new SineEase();
     r_15_s_ET_1_AC_0_SB_TL_0.EasingFunction = r_15_s_ET_1_AC_0_SB_TL_0_EA;
     Storyboard.SetTargetProperty(r_15_s_ET_1_AC_0_SB_TL_0, Button.MarginProperty);
     r_15_s_ET_1_AC_0_SB.Children.Add(r_15_s_ET_1_AC_0_SB_TL_0);
     FloatAnimation r_15_s_ET_1_AC_0_SB_TL_1 = new FloatAnimation();
     r_15_s_ET_1_AC_0_SB_TL_1.Name = "r_15_s_ET_1_AC_0_SB_TL_1";
     r_15_s_ET_1_AC_0_SB_TL_1.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 500));
     r_15_s_ET_1_AC_0_SB_TL_1.To = 200F;
     SineEase r_15_s_ET_1_AC_0_SB_TL_1_EA = new SineEase();
     r_15_s_ET_1_AC_0_SB_TL_1.EasingFunction = r_15_s_ET_1_AC_0_SB_TL_1_EA;
     Storyboard.SetTargetProperty(r_15_s_ET_1_AC_0_SB_TL_1, Button.WidthProperty);
     r_15_s_ET_1_AC_0_SB.Children.Add(r_15_s_ET_1_AC_0_SB_TL_1);
     this.Add("buttonAnimStyle", r_15_s);
     // Resource - [ZincIcon] BitmapImage
     BitmapImage r_16_bm = new BitmapImage();
     r_16_bm.TextureAsset = "ImagesUI/zinc_res";
     this.Add("ZincIcon", r_16_bm);
     // Resource - [SunBurnLogo] BitmapImage
     BitmapImage r_17_bm = new BitmapImage();
     r_17_bm.TextureAsset = "Images/SunBurn";
     this.Add("SunBurnLogo", r_17_bm);
     // Resource - [buttonStyle] Style
     var r_18_s_bo = this[typeof(Button)];
     Style r_18_s = new Style(typeof(Button), r_18_s_bo as Style);
     Setter r_18_s_S_0 = new Setter(Button.BackgroundProperty, new SolidColorBrush(new ColorW(255, 140, 0, 255)));
     r_18_s.Setters.Add(r_18_s_S_0);
     this.Add("buttonStyle", r_18_s);
     // Resource - [GoldIcon] BitmapImage
     BitmapImage r_19_bm = new BitmapImage();
     r_19_bm.TextureAsset = "ImagesUI/gold_res";
     this.Add("GoldIcon", r_19_bm);
     // Resource - [IronIcon] BitmapImage
     BitmapImage r_20_bm = new BitmapImage();
     r_20_bm.TextureAsset = "ImagesUI/iron_res";
     this.Add("IronIcon", r_20_bm);
     // Resource - [CoalIcon] BitmapImage
     BitmapImage r_21_bm = new BitmapImage();
     r_21_bm.TextureAsset = "ImagesUI/coal_res";
     this.Add("CoalIcon", r_21_bm);
     // Resource - [OilIcon] BitmapImage
     BitmapImage r_22_bm = new BitmapImage();
     r_22_bm.TextureAsset = "ImagesUI/oil_res";
     this.Add("OilIcon", r_22_bm);
     // Resource - [ThoriumIcon] BitmapImage
     BitmapImage r_23_bm = new BitmapImage();
     r_23_bm.TextureAsset = "ImagesUI/thorium_res";
     this.Add("ThoriumIcon", r_23_bm);
     // Resource - [UraniumIcon] BitmapImage
     BitmapImage r_24_bm = new BitmapImage();
     r_24_bm.TextureAsset = "ImagesUI/uranium_res";
     this.Add("UraniumIcon", r_24_bm);
     // Resource - [SilverIcon] BitmapImage
     BitmapImage r_25_bm = new BitmapImage();
     r_25_bm.TextureAsset = "ImagesUI/silver_res";
     this.Add("SilverIcon", r_25_bm);
     // Resource - [MagnesiumIcon] BitmapImage
     BitmapImage r_26_bm = new BitmapImage();
     r_26_bm.TextureAsset = "ImagesUI/magnesium_res";
     this.Add("MagnesiumIcon", r_26_bm);
     // Resource - [LivestockIcon] BitmapImage
     BitmapImage r_27_bm = new BitmapImage();
     r_27_bm.TextureAsset = "ImagesUI/livestock_res";
     this.Add("LivestockIcon", r_27_bm);
     // Resource - [WaterIcon] BitmapImage
     BitmapImage r_28_bm = new BitmapImage();
     r_28_bm.TextureAsset = "ImagesUI/water_res";
     this.Add("WaterIcon", r_28_bm);
     // Resource - [PlatinumIcon] BitmapImage
     BitmapImage r_29_bm = new BitmapImage();
     r_29_bm.TextureAsset = "ImagesUI/platinum_res";
     this.Add("PlatinumIcon", r_29_bm);
     ImageManager.Instance.AddImage("ImagesUI/hydrogen_res");
     ImageManager.Instance.AddImage("ImagesUI/biomass_res");
     ImageManager.Instance.AddImage("ImagesUI/copper_res");
     ImageManager.Instance.AddImage("ImagesUI/lead_res");
     ImageManager.Instance.AddImage("ImagesUI/aluminium_res");
     ImageManager.Instance.AddImage("ImagesUI/gas_res");
     ImageManager.Instance.AddImage("ImagesUI/propane_res");
     ImageManager.Instance.AddImage("ImagesUI/diamond_res");
     ImageManager.Instance.AddImage("Images/MonogameLogo");
     ImageManager.Instance.AddImage("ImagesUI/mine_build");
     ImageManager.Instance.AddImage("ImagesUI/timber_res");
     ImageManager.Instance.AddImage("ImagesUI/titanium_res");
     ImageManager.Instance.AddImage("ImagesUI/building2");
     ImageManager.Instance.AddImage("ImagesUI/building1");
     ImageManager.Instance.AddImage("ImagesUI/zinc_res");
     ImageManager.Instance.AddImage("Images/SunBurn");
     ImageManager.Instance.AddImage("ImagesUI/gold_res");
     ImageManager.Instance.AddImage("ImagesUI/iron_res");
     ImageManager.Instance.AddImage("ImagesUI/coal_res");
     ImageManager.Instance.AddImage("ImagesUI/oil_res");
     ImageManager.Instance.AddImage("ImagesUI/thorium_res");
     ImageManager.Instance.AddImage("ImagesUI/uranium_res");
     ImageManager.Instance.AddImage("ImagesUI/silver_res");
     ImageManager.Instance.AddImage("ImagesUI/magnesium_res");
     ImageManager.Instance.AddImage("ImagesUI/livestock_res");
     ImageManager.Instance.AddImage("ImagesUI/water_res");
     ImageManager.Instance.AddImage("ImagesUI/platinum_res");
 }