コード例 #1
0
        private void OrganizeGrid()
        {
            const double xSpace = 10;
            const double ySpace = 10;
            double       w      = Items[0].Width;
            double       h      = Items[0].Height;

            double cols = Math.Floor(BoundsWidth / w);

            for (var i = 0; i < Items.Count; i++)
            {
                var item = Items[i];

                double row = Math.Floor(i / cols);
                double col = i % cols;

                ArtefactAnimator.StopEase(item, ProjectionProperty,
                                          AnimationTypes.X,
                                          AnimationTypes.Y,
                                          RoundedSquare.PositionProperty);

                // movement
                double x = col * (w + xSpace);
                double y = row * (h + ySpace);

                ArtefactAnimator.AddEase(item, RoundedSquare.PositionProperty,
                                         new Point {
                    X = x, Y = y
                },
                                         .8, AnimationTransitions.CubicEaseOut, 0);

                // 3d
                Helper.AnimateZProps(item, 0, 0, 0, 0, 0, -i, 0, 0, 0, 0, 0, 0,
                                     .6, AnimationTransitions.CubicEaseOut, 0).OnUpdate((eo, p) =>
                {
                    var target = (FrameworkElement)eo.Target;
                    var pp     = target.Projection as PlaneProjection;
                    if (pp != null)
                    {
                        target.Effect = new BlurEffect {
                            Radius = -pp.LocalOffsetZ / 50
                        }
                    }
                    ;
                }).OnComplete((eo, p) => ((RoundedSquare)eo.Target).Flash());
            }
        }
コード例 #2
0
        private void OrganizeStack()
        {
            for (var i = 0; i < Items.Count; i++)
            {
                var item = Items[i];


                ArtefactAnimator.StopEase(item,
                                          Animation3DEffects.Projection,
                                          AnimationTypes.X,
                                          AnimationTypes.Y,
                                          RoundedSquare.PositionProperty);

                // movement
                double x = CenterX - (item.Width / 2);
                double y = CenterY - (item.Height / 2) + (CenterY / 3);

                /*
                 * item.SlideTo(   x, y,
                 *              .8, AnimationTransitions.CubicEaseOut, i * .1);
                 */

                // Instead of using a shortcut - you could also animate a position point.
                ArtefactAnimator.AddEase(item, RoundedSquare.PositionProperty,
                                         new Point {
                    X = x, Y = y
                },
                                         .8, AnimationTransitions.CubicEaseOut, i * .1);

                // 3d
                Helper.AnimateZProps(item, 114, -22, 0, 0, 0, 10 * -i, 0, 0, 0, 0, 0, 0,
                                     .6, AnimationTransitions.CubicEaseOut, i * .1).OnUpdate((eo, p) =>
                {
                    var target = (FrameworkElement)eo.Target;
                    var pp     = target.Projection as PlaneProjection;

                    if (pp != null)
                    {
                        target.Effect = new BlurEffect {
                            Radius = -pp.LocalOffsetZ / 50
                        }
                    }
                    ;
                }).OnComplete((eo, p) => ((RoundedSquare)eo.Target).Flash());
            }
        }
コード例 #3
0
        private void CircleBtnClick(object sender, RoutedEventArgs e)
        {
            var len    = Items.Count;
            var center = Helper.GetApothem(80, len);

            var eog = new EaseObjectGroup {
                UseStoppedEvent = false
            };

            for (var i = 0; i < len; i++)
            {
                var item = Items[i];

                ArtefactAnimator.StopEase(item,
                                          ProjectionProperty,
                                          AnimationTypes.X,
                                          AnimationTypes.Y,
                                          RoundedSquare.PositionProperty);

                // movement
                double x  = CenterX - (item.Width / 2);
                double y  = CenterY - (item.Height / 2);
                var    eo = ArtefactAnimator.AddEase(item, RoundedSquare.PositionProperty,
                                                     new Point {
                    X = x, Y = y
                },
                                                     .6, AnimationTransitions.SineEaseOut, 0);

                Helper.AnimateZProps(item, 0, i * (180 / len), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, .6, AnimationTransitions.CubicEaseOut, 0);

                eog.AddEaseObject(eo);
            }

            eog.Complete += group =>
            {
                for (var i = 0; i < len; i++)
                {
                    var item = Items[i];

                    // 3d
                    Helper.AnimateZProps(item, 0, ((double)i / len) * 360, 45, 0, 0, 0, 0, 0, 0, 0, 0, center,
                                         2, AnimationTransitions.ElasticEaseOut, (len - i) * .1).OnComplete((o, p) => ((RoundedSquare)o.Target).Flash());
                }
            };
        }
コード例 #4
0
        private void OrganizePile()
        {
            for (var i = 0; i < Items.Count; i++)
            {
                var item = Items[i];
                ArtefactAnimator.StopEase(item,
                                          ProjectionProperty,
                                          AnimationTypes.X,
                                          AnimationTypes.Y,
                                          RoundedSquare.PositionProperty);
                // movement
                double x = Helper.RandomRange(20, BoundsWidth - item.Width - 20);
                double y = Helper.RandomRange(60, BoundsHeight - item.Height - 60);

                ArtefactAnimator.AddEase(item, RoundedSquare.PositionProperty,
                                         new Point {
                    X = x, Y = y
                },
                                         .8, AnimationTransitions.CubicEaseOut, i * .05);

                // 3d
                double depth = (Helper.Rnd.NextDouble() * -2000.0) + 400;

                Helper.AnimateZProps(item, 10, 0, 0, 0, 0, depth, 0, 0, 0, 0, 0, 0,
                                     .6, AnimationTransitions.CubicEaseOut, i * .05).OnUpdate((eo, p) =>
                {
                    var target = (FrameworkElement)eo.Target;
                    var pp     = target.Projection as PlaneProjection;

                    if (pp != null)
                    {
                        target.Effect = new BlurEffect {
                            Radius = -pp.LocalOffsetZ / 50
                        }
                    }
                    ;
                }).OnComplete((eo, p) => ((RoundedSquare)eo.Target).Flash());
            }
        }