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());
            }
        }
Exemplo n.º 2
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 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);
            }
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
 }
Exemplo n.º 7
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));
        }
        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;
                }
            }
        }
        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;
                }
            }
        }
Exemplo n.º 10
0
 public EaseObject AnimateBlendTo(double opacity, double seconds, PercentHandler ease)
 {
     return(ArtefactAnimator.AddEase(this, new[] { "Opacity" }, new object[] { opacity }, seconds, ease));
 }