private void GridResortBtnClick(object sender, RoutedEventArgs e)
        {
            var eog = new EaseObjectGroup {
                UseStoppedEvent = false
            };
            var len = Items.Count;

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

                // BOUNCE OFF THE BOTTOM - VIA CUSTOM EASE POINTS
                var eo = ArtefactAnimator.AddEase(Items[i], RoundedSquare.PositionProperty, new Point(Canvas.GetLeft(item), bounds.Height - ((item.Height * item.ScaleY) / 2) - (item.Height / 2)),
                                                  1.3, CustomAnimationTransitions.CreateCustomBezierEase(CustomAnimationTransitions.CustomEasePointsBounce), (len - 1 - i) * .05);

                eog.AddEaseObject(eo);
            }

            // WHEN GROUP ANIMATION IS COMPLETE -> RESORT
            eog.Complete += group =>
            {
                // SORT BY SCALE
                var sorted =
                    from item in Items
                    orderby item.ScaleX, item.ScaleY descending
                select item;

                // RESET LIST
                Items = sorted.ToList();

                // RE-GRID
                OrganizeGrid();
            };
        }
 public static EaseObject AnimateZProps(UIElement element,
                                        double rotationX, double rotationY, double rotationZ,
                                        double localOffsetX, double localOffsetY, double localOffsetZ,
                                        double globalOffsetX, double globalOffsetY, double globalOffsetZ,
                                        double centerOfRotationX, double centerOfRotationY, double centerOfRotationZ,
                                        double time, PercentHandler ease, double delay)
 {
     return(ArtefactAnimator.AddEase(element, UIElement.ProjectionProperty,
                                     new PlaneProjection
     {
         RotationX = rotationX,
         RotationY = rotationY,
         RotationZ = rotationZ,
         LocalOffsetX = localOffsetX,
         LocalOffsetY = localOffsetY,
         LocalOffsetZ = localOffsetZ,
         GlobalOffsetX = globalOffsetX,
         GlobalOffsetY = globalOffsetY,
         GlobalOffsetZ = globalOffsetZ,
         CenterOfRotationX = centerOfRotationX,
         CenterOfRotationY = centerOfRotationY,
         CenterOfRotationZ = centerOfRotationZ,
     },
                                     time, ease, delay));
 }
Example #3
0
        public EaseObject AnimateOpacity(double from, double to)
        {
            Opacity = from;
            var ani = ArtefactAnimator.AddEase(this, new[] { "Opacity" }, new object[] { to }, HBS.AnimationSeconds,
                                               HBS.AnimationEaseIn);

            return(ani);
        }
Example #4
0
        private void BirimAdiAyarla()
        {
            lblBirimAdi.Content = String.Empty;
            ArtefactAnimator.AddEase(birimRectangle, AnimationTypes.X, this.ActualWidth, 1.1, AnimationTransitions.BackEaseIn, 0);
            EaseObject baslikEase = ArtefactAnimator.AddEase(birimRectangle, AnimationTypes.Y, 51, 1.1, AnimationTransitions.BackEaseIn, 0);

            baslikEase.Complete += new EaseObjectHandler(birimBaslikEase_Complete);
        }
Example #5
0
        private void UnvanAdiAyarla()
        {
            lblUnvanAdi.Content = String.Empty;
            ArtefactAnimator.AddEase(unvanRectangle, AnimationTypes.X, this.ActualWidth, 1.1, AnimationTransitions.BackEaseIn, 0);
            EaseObject unvanBaslikEase = ArtefactAnimator.AddEase(unvanRectangle, AnimationTypes.Y, 0, 1.1, AnimationTransitions.BackEaseIn, 0);

            unvanBaslikEase.Complete += new EaseObjectHandler(unvanBaslikEase_Complete);
        }
Example #6
0
 void _MouseLeave(object sender, MouseEventArgs e)
 {
     ArtefactAnimator.AddEase(LayoutRoot, Border.CornerRadiusProperty, new CornerRadius(Width / 2), .5, AnimationTransitions.CubicEaseOut);
     ArtefactAnimator.AddEase(LayoutRoot,
                              new[] { Border.BorderBrushProperty, Border.BackgroundProperty, Border.BorderThicknessProperty },
                              new[] { Application.Current.Resources["AquaSolidBrush"], Application.Current.Resources["BlueGradientBrush"], new Thickness(2) },
                              1, AnimationTransitions.CubicEaseOut);
 }
Example #7
0
        private void BirimAdiAyarla()
        {
            lblBirimAdi.Content = String.Empty;
            ArtefactAnimator.AddEase(ball, AnimationTypes.X, 680, .7, AnimationTransitions.BackEaseIn, 0);
            EaseObject baslikEase = ArtefactAnimator.AddEase(ball, AnimationTypes.Y, 10, .7, AnimationTransitions.BackEaseIn, 0);

            baslikEase.Complete += new EaseObjectHandler(baslikEase_Complete);
        }
Example #8
0
        void Deneme_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Point p = e.GetPosition(null);

            // ease
            ArtefactAnimator.AddEase(ball3, AnimationTypes.X, p.X, .8, AnimationTransitions.BackEaseIn, 0);
            ArtefactAnimator.AddEase(ball3, AnimationTypes.Y, p.Y, .8, AnimationTransitions.BackEaseIn, 0);
        }
Example #9
0
 void _MouseEnter(object sender, MouseEventArgs e)
 {
     ArtefactAnimator.AddEase(LayoutRoot, Border.CornerRadiusProperty, new CornerRadius(0), .5, AnimationTransitions.CubicEaseOut);
     ArtefactAnimator.AddEase(LayoutRoot,
                              new[] { Border.BorderBrushProperty, Border.BackgroundProperty, Border.BorderThicknessProperty },
                              new[] { new SolidColorBrush(Colors.White), Application.Current.Resources["OrangeGradientBrush"], new Thickness(5) },
                              1, AnimationTransitions.CubicEaseOut);
 }
Example #10
0
        public void Flash()
        {
            ArtefactAnimator.AddEase(LayoutRoot,
                                     new[] { Border.BorderBrushProperty, Border.BorderThicknessProperty },
                                     new object[] { new SolidColorBrush(Colors.White), new Thickness(3) }, .3, AnimationTransitions.CubicEaseOut).OnComplete((eo, p) =>

                                                                                                                                                             ArtefactAnimator.AddEase(LayoutRoot, new[] { Border.BorderBrushProperty, Border.BorderThicknessProperty },
                                                                                                                                                                                      new[] { Application.Current.Resources["AquaSolidBrush"], new Thickness(2) }, .3, AnimationTransitions.CubicEaseIn));
        }
        private void BtnClick(object sender, System.Windows.RoutedEventArgs e)
        {
            EaseObjectGroup eog = new EaseObjectGroup();

            for (int i = 0; i < 4; i++)
            {
                double star = .3 + (_rnd.NextDouble() * 2.7);

                EaseObject eo = ArtefactAnimator.AddEase(col, new[] { AnimationTypes.ColumWidthStar }, new object[] { star }, 1, AnimationTransitions.ElasticEaseOut, i * .5);

                eog.AddEaseObject(eo);
            }
        }
        private void BtnClick(object sender, RoutedEventArgs e)
        {
            var eog = new EaseObjectGroup();

            eog.Complete += g => Debug.WriteLine("COMPLETE");

            for (var i = 0; i < 4; i++)
            {
                var width = .3 + (_rnd.NextDouble() * 2.7);
                var eo    = ArtefactAnimator.AddEase(col, new[] { AnimationTypes.ColumWidthStar }, new object[] { width }, 1, AnimationTransitions.ElasticEaseOut, i * .5);

                eog.AddEaseObject(eo);
            }
        }
Example #13
0
 private void ToggleItemsFilledOpacityAnimation(bool visible)
 {
     if (opacityAnimation != null)
     {
         opacityAnimation.Stop();
     }
     if (visible)
     {
         Opacity = 0;
     }
     else
     {
         Opacity = 1;
     }
     opacityAnimation = ArtefactAnimator.AddEase(this, "Opacity", visible ? 1 : 0, 0.5);
 }
Example #14
0
 public void AnimateToDropShadow()
 {
     if (DropShadowAnimation != null)
     {
         DropShadowAnimation.Stop();
     }
     if (DropShadowOpacity < 1)
     {
         Events.OnIdleOnce(
             () =>
         {
             DropShadowAnimation = ArtefactAnimator.AddEase(this, new[] { "DropShadowOpacity" },
                                                            new object[] { 1.0 }, 0.25d);
         });
     }
 }
        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());
            }
        }
Example #16
0
 protected void UpdateOpacity(bool visibility)
 {
     if (activeOpacityAnimation != null)
     {
         activeOpacityAnimation.Stop();
     }
     if (visibility == false)
     {
         Opacity = 0;
     }
     else
     {
         var seconds = 0.5;
         activeOpacityAnimation           = ArtefactAnimator.AddEase(this, new[] { "Opacity" }, new object[] { 1 }, seconds);
         activeOpacityAnimation.Complete += (easeObj, percent) => { activeOpacityAnimation = null; };
     }
 }
        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());
            }
        }
        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());
                }
            };
        }
Example #19
0
        void baslikEase_Complete(EaseObject easeObject, double percent)
        {
            if (birimBazindaAtananKisiListeleri.Count == birimIndex)
            {
                lblBirimAdi.Content = String.Empty;
                lbSonuclar.Items.Clear();
                birimIndex = 0;
                return;
            }

            lblBirimAdi.Content = ((DataRow[])birimBazindaAtananKisiListeleri[birimIndex])[0][3].ToString();

            ArtefactAnimator.AddEase(ball, AnimationTypes.X, 20, .7, AnimationTransitions.BackEaseOut, 0);
            ArtefactAnimator.AddEase(ball, AnimationTypes.Y, 10, .7, AnimationTransitions.BackEaseOut, .9);

            lbSonuclar.Items.Clear();
            ListeyeElemanEkle();
        }
Example #20
0
        void unvanBaslikEase_Complete(EaseObject easeObject, double percent)
        {
            if (unvanBazindaAtananKisiListeleri.Count == unvanIndex)
            {
                lblUnvanAdi.Content = String.Empty;
                unvanIndex          = 0;
                MessageBox.Show("Atama işlemi başarı ile tamamlandı.", "Başarı", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            lblUnvanAdi.Content = unvanBazindaAtananKisiListeleri[unvanIndex].Rows[0]["UNVAN"].ToString();

            ArtefactAnimator.AddEase(unvanRectangle, AnimationTypes.X, 1, .7, AnimationTransitions.BackEaseOut, 0);
            ArtefactAnimator.AddEase(unvanRectangle, AnimationTypes.Y, 0, .7, AnimationTransitions.BackEaseOut, .9);

            BirimlereGoreVerileriAyir();
            BirimAdiAyarla();
        }
Example #21
0
        private EaseObject FinishSwipeWithAnimation(IMatrix m, double opacity, bool discardOnFinish = true)
        {
            var vm           = GetTransformed();
            var startOpacity = vm.Opacity;
            var ease         = AnimationTransitions.CircEaseOut;
            var easeObject   = ArtefactAnimator.AddEase(vm, new[] { "TransformMatrix" }, new object[] { m }, 0.5, ease);

            easeObject.Update +=
                (s, progress) =>
            {
                vm.Opacity = (double)Interpolation.Double.Interpolate(startOpacity, opacity, progress);
            };
            if (discardOnFinish)
            {
                easeObject.Complete += (a, p) => { FVCM.VisualState = FilterContainerVisualStates.DISCARDED; }
            }
            ;
            return(easeObject);
        }
Example #22
0
        void birimBaslikEase_Complete(EaseObject easeObject, double percent)
        {
            if (birimBazindaAtananKisiListeleri.Count == birimIndex)
            {
                lblBirimAdi.Content = String.Empty;
                lbSonuclar.Items.Clear();
                birimIndex = 0;
                unvanIndex++;
                UnvanAdiAyarla();
                return;
            }

            lblBirimAdi.Content = ((DataRow[])birimBazindaAtananKisiListeleri[birimIndex])[0]["BIRIM_ADI"].ToString();

            ArtefactAnimator.AddEase(birimRectangle, AnimationTypes.X, 1, .7, AnimationTransitions.BackEaseOut, 0);
            ArtefactAnimator.AddEase(birimRectangle, AnimationTypes.Y, 51, .7, AnimationTransitions.BackEaseOut, .9);

            lbSonuclar.Items.Clear();
            ListeyeElemanEkle();
        }
Example #23
0
        private void ListeyeElemanEkle()
        {
            if (birimBazindaAtananKisiListeleri.Count == birimIndex)
            {
                return;
            }

            birimeAtananKisiler = birimBazindaAtananKisiListeleri[birimIndex];

            var lbi = new ListBoxItem
            {
                Content         = birimeAtananKisiler[index][0].ToString() + "\t" + birimeAtananKisiler[index][1].ToString() + "\t" + birimeAtananKisiler[index][2].ToString(),
                RenderTransform = new TranslateTransform(-lbSonuclar.Width, 0)
            };

            lbSonuclar.Items.Add(lbi);

            // Animasyon
            EaseObject obj = ArtefactAnimator.AddEase(lbi.RenderTransform, TranslateTransform.XProperty, 0, 1, AnimationTransitions.BackEaseOut, .2);

            obj.Complete += new EaseObjectHandler(obj_Complete);
        }
        private void PileNav(RoundedSquare selectedItem)
        {
            var selectedProjection = selectedItem.Projection as PlaneProjection;
            var selectedPos        = selectedItem.Position;

            if (selectedProjection == null)
            {
                return;
            }


            foreach (var item in Items)
            {
                var currentProjection = Helper.Copy(item.Projection as PlaneProjection);
                currentProjection.LocalOffsetZ -= selectedProjection.LocalOffsetZ;
                currentProjection.LocalOffsetX -= selectedProjection.LocalOffsetX;
                currentProjection.LocalOffsetY -= selectedProjection.LocalOffsetY;

                var newPos = new Point(item.Position.X - selectedPos.X + CenterX, item.Position.Y - selectedPos.Y + CenterY);

                ArtefactAnimator.AddEase(item, RoundedSquare.PositionProperty, newPos, .6, AnimationTransitions.CubicEaseOut, 0);
                ArtefactAnimator.AddEase(item, ProjectionProperty, currentProjection, 1, AnimationTransitions.CubicEaseIn, 0).Update += (eo, p) =>
                {
                    var target = (FrameworkElement)eo.Target;
                    var pp     = target.Projection as PlaneProjection;

                    // set blur based on z-depth
                    if (pp == null)
                    {
                        return;
                    }

                    target.Effect = new BlurEffect {
                        Radius = -pp.LocalOffsetZ / 50
                    };
                    target.Opacity = pp.LocalOffsetZ < 200 ? 1 : 1 - (Math.Min(pp.LocalOffsetZ - 200, 500) / 500);
                };
            }
        }
        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());
            }
        }
        private void UpdatePosition(MouseEventArgs e)
        {
            double x = e.GetPosition(this).X - (30 / 2);
            double y = e.GetPosition(this).Y - (30 / 2);

            for (int n = 0; n < Items.Length; n++)
            {
                UIElement ball = Items[n];

                double size  = 20 + (_rnd.NextDouble() * 150);
                double delay = (n * .01) + 0;

                //  DEPENDENCY PROPERTY
                //  ArtefactAnimator.AddEase(ball, new[] { Canvas.LeftProperty, Canvas.TopProperty }, new[] { x, y }, 2, AnimationTransitions.ElasticEaseOut, delay);

                //  STRINGS
                ball.DimensionsTo(size, size, 3, AnimationTransitions.ElasticEaseOut, 0);
                EaseObject eo = ball.SlideTo(x + (size / 2), y + (size / 2), 1, AnimationTransitions.CubicEaseOut, delay);
                ArtefactAnimator.AddEase(ball, RenderTransformProperty, new CompositeTransform {
                    Rotation = _rnd.NextDouble() * 360
                }, 4, AnimationTransitions.ElasticEaseOut, 0);
            }
        }
Example #27
0
        private void ListeyeElemanEkle()
        {
            if (birimBazindaAtananKisiListeleri.Count == birimIndex)
            {
                return;
            }

            birimeAtananKisiler = birimBazindaAtananKisiListeleri[birimIndex];

            var lbi = new ListBoxItem
            {
                Content             = birimeAtananKisiler[index]["AD"].ToString() + " " + birimeAtananKisiler[index]["SOYAD"].ToString(),
                RenderTransform     = new TranslateTransform(-lbSonuclar.ActualWidth, 0),
                HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
            };

            lbSonuclar.Items.Add(lbi);

            // Animasyon
            ArtefactAnimator.AddEase(this, ListBoxScrollOffsetProperty, scrollViewer.ScrollableHeight + 3, 1, AnimationTransitions.BackEaseOut, 0);
            EaseObject obj = ArtefactAnimator.AddEase(lbi.RenderTransform, TranslateTransform.XProperty, 0, 1, AnimationTransitions.BackEaseOut, .2);

            obj.Complete += new EaseObjectHandler(obj_Complete);
        }
Example #28
0
 private void button2_Click(object sender, RoutedEventArgs e)
 {
     ArtefactAnimator.AddEase(ball, AnimationTypes.X, 20, .7, AnimationTransitions.BackEaseOut, 0);
     ArtefactAnimator.AddEase(ball, AnimationTypes.Y, 10, .7, AnimationTransitions.BackEaseOut, 0);
 }
        void _KeyDown(object sender, KeyEventArgs e)
        {
            // REMOVE ALL EASING FOR ITEMS
            for (var i = 0; i < Items.Length; i++)
            {
                UIElement ball = Items[i];

                //// MOVEMENT

                if (e.Key == Key.R)
                {
                    double x = _rnd.NextDouble() * LayoutRoot.ActualWidth;
                    double y = _rnd.NextDouble() * LayoutRoot.ActualHeight;

                    double         delay = i * .02;
                    double         time  = .6;
                    PercentHandler ease  = AnimationTransitions.CubicEaseOut;

                    ball.SlideTo(x, y, time, ease, delay);
                }

                //// EFFECTS

                else if (e.Key == Key.D)
                {
                    var effect = (DropShadowEffect)ball.Effect;
                    if (effect == null)
                    {
                        effect      = new DropShadowEffect();
                        ball.Effect = effect;
                    }
                    DropShadowEffect effectClone = effect.Copy();
                    effectClone.BlurRadius  = _rnd.NextDouble() * 20;
                    effectClone.Opacity     = .7 + (_rnd.NextDouble() * .3);
                    effectClone.ShadowDepth = _rnd.NextDouble() * 20;

                    ArtefactAnimator.AddEase(ball, UIElement.EffectProperty, effectClone, .8, AnimationTransitions.CubicEaseOut, 0);
                }
                else if (e.Key == Key.C)
                {
                    var effect = (DropShadowEffect)ball.Effect;
                    if (effect == null)
                    {
                        continue;
                    }
                    ArtefactAnimator.AddEase(effect, DropShadowEffect.ColorProperty, new Color()
                    {
                        A = 1,
                        R = (byte)(_rnd.NextDouble() * 255),
                        G = (byte)(_rnd.NextDouble() * 255),
                        B = (byte)(_rnd.NextDouble() * 255)
                    }
                                             , 1, AnimationTransitions.CubicEaseOut, 0);
                }

                //// REMOVE EFFECT

                else if (e.Key == Key.X)
                {
                    ball.Effect = null;
                }

                //// 3D

                else if (e.Key == Key.Z)
                {
                    Canvas.SetLeft(ball, Canvas.GetLeft(ball) + 2);

                    var pp = (PlaneProjection)ball.Projection ??
                             new PlaneProjection {
                        RotationX = 0D, RotationY = 0D, RotationZ = 0D
                    };

                    ball.Projection = pp;

                    EaseObject easeObject = ArtefactAnimator.AddEase(pp,
                                                                     new [] {
                        Animation3DEffects.RotationX,
                        Animation3DEffects.RotationY,
                        Animation3DEffects.RotationZ
                    },
                                                                     new [] {
                        RandomDouble(-75, 75),
                        RandomDouble(-75, 75),
                        RandomDouble(-75, 75)
                    },
                                                                     2, AnimationTransitions.ElasticEaseOut, 0);

                    easeObject.Update += (eo, per) =>
                    {
                        (eo.Data as UIElement).Projection = eo.Target as PlaneProjection;
                    };
                    easeObject.Data = ball;
                }
            }
        }
        void _KeyDown(object sender, KeyEventArgs e)
        {
            // REMOVE ALL EASING FOR ITEMS
            for (var i = 0; i < Items.Length; i++)
            {
                UIElement ball = Items[i];

                //// MOVEMENT

                if (e.Key == Key.R)
                {
                    double x = _rnd.NextDouble() * LayoutRoot.ActualWidth;
                    double y = _rnd.NextDouble() * LayoutRoot.ActualHeight;

                    double         delay = i * .02;
                    double         time  = .6;
                    PercentHandler ease  = AnimationTransitions.CubicEaseOut;

                    ball.SlideTo(x, y, time, ease, delay);
                }

                //// EFFECTS

                else if (e.Key == Key.D)
                {
                    var effect = (DropShadowEffect)ball.Effect;
                    if (effect == null)
                    {
                        effect      = new DropShadowEffect();
                        ball.Effect = effect;
                    }
                    DropShadowEffect effectClone = effect.Copy();
                    effectClone.BlurRadius  = _rnd.NextDouble() * 20;
                    effectClone.Opacity     = .7 + (_rnd.NextDouble() * .3);
                    effectClone.ShadowDepth = _rnd.NextDouble() * 20;

                    ArtefactAnimator.AddEase(ball, UIElement.EffectProperty, effectClone, 2, AnimationTransitions.CubicEaseOut, 0);
                }
                else if (e.Key == Key.C)
                {
                    var effect = (DropShadowEffect)Items[i].Effect;
                    if (effect == null)
                    {
                        continue;
                    }

                    ArtefactAnimator.AddEase(effect, DropShadowEffect.ColorProperty, new Color()
                    {
                        A = 1,
                        R = (byte)(_rnd.NextDouble() * 255),
                        G = (byte)(_rnd.NextDouble() * 255),
                        B = (byte)(_rnd.NextDouble() * 255)
                    }
                                             , 1, AnimationTransitions.CubicEaseOut, 0);
                }

                //// REMOVE EFFECT

                else if (e.Key == Key.X)
                {
                    Items[i].Effect = null;
                }
            }
        }