Пример #1
0
 private void InitializeCanvas()
 {
     if (StackRight.Count == 0)
     {
     }
     else if (StackRight.Count == 1)
     {
         PopCell cellA = StackRight.Pop();
         cellA.TilePosition = ICESetting.Control.PopCell.TilePositionEnum.Center;
         PutToCenter(cellA, Equations.Linear);
         _canvas.Children.Add(cellA);
         cellA.Scale       = 1;
         cellA.Opacity     = 1;
         CenterPopArray[1] = cellA;
     }
     else
     {
         PopCell cellA = StackRight.Pop();
         cellA.TilePosition = ICESetting.Control.PopCell.TilePositionEnum.Center;
         PutToCenter(cellA, Equations.Linear);
         _canvas.Children.Add(cellA);
         PopCell cellB = StackRight.Pop();
         cellB.TilePosition = ICESetting.Control.PopCell.TilePositionEnum.Right;
         PutToRight(cellB, Equations.Linear);
         _canvas.Children.Add(cellB);
         CenterPopArray[0] = null;
         CenterPopArray[1] = cellA;
         CenterPopArray[2] = cellB;//中间列表数组
         cellA.Scale       = 1;
         cellA.Opacity     = 1;
     }
 }
Пример #2
0
 private void PutToCenter(PopCell cell, Equations equation)
 {
     MoveToX(cell, (this.Width - cell.Width) / 2.0, equation);
     MoveToScaleOpacity(cell, 1d, 1d);
     cell.Y = (this.Height - cell.Height) / 2.0;
     cell.IsHitTestVisible = true;
 }
Пример #3
0
        private void MoveToScaleOpacity(PopCell cell, double toScale, double toOpacity)
        {
            DoubleAnimation daScale = new DoubleAnimation()
            {
                To = toScale,
                //Equation=Equations.QuartEaseOut,
                FillBehavior = FillBehavior.Stop,
                Duration     = TimeSpan.FromSeconds(0.7)
            };
            DoubleAnimation daO = new DoubleAnimation()
            {
                To           = toOpacity,
                FillBehavior = FillBehavior.Stop,
                Duration     = TimeSpan.FromSeconds(0.7)
            };

            daO.Completed += delegate
            {
                cell.Opacity = toOpacity;
            };
            daScale.Completed += delegate
            {
                cell.Scale = toScale;
            };
            cell._scale.BeginAnimation(ScaleTransform.ScaleXProperty, daScale);
            cell._scale.BeginAnimation(ScaleTransform.ScaleYProperty, daScale);
            cell.BeginAnimation(OpacityProperty, daO);
        }
Пример #4
0
 private void PutToLeft(PopCell cell, Equations equation)
 {
     MoveToX(cell, -cell.Width + OffsetScreenWidth, equation);
     cell.Y = (this.Height - cell.Height) / 2.0;
     MoveToScaleOpacity(cell, 0.9d, 0.7d);
     cell.IsHitTestVisible = false;;
 }
Пример #5
0
        /// <summary>
        /// 左移动
        /// </summary>
        private void MoveLeft()
        {
            if (!isAnimating)
            {
                ResetStackRight();
                PopCell cellA = CenterPopArray[0];
                PopCell cellB = CenterPopArray[1];
                PopCell cellC = CenterPopArray[2];
                if (cellC != null)
                {
                    if (cellA != null)
                    {
                        DoubleAnimation daX = new DoubleAnimation()
                        {
                            To           = -cellA.Width,
                            FillBehavior = FillBehavior.Stop,
                            Duration     = TimeSpan.FromSeconds(0.2)
                        };
                        daX.Completed += delegate
                        {
                            _canvas.Children.Remove(cellA);
                        };
                        cellA.BeginAnimation(Canvas.LeftProperty, daX);

                        //_canvas.Children.Remove(cellA);
                        cellA.TilePosition = ICESetting.Control.PopCell.TilePositionEnum.Other;
                        StackLeft.Push(cellA);
                    }
                    CenterPopArray[0] = cellB;
                    CenterPopArray[0].TilePosition = ICESetting.Control.PopCell.TilePositionEnum.Left;
                    PutToLeft(CenterPopArray[0], Equations.QuadEaseOut);

                    CenterPopArray[1] = cellC;
                    CenterPopArray[1].TilePosition = ICESetting.Control.PopCell.TilePositionEnum.Center;
                    PutToCenter(CenterPopArray[1], Equations.SineEaseOut);

                    if (StackRight.Count != 0)
                    {
                        CenterPopArray[2] = StackRight.Pop();
                        CenterPopArray[2].TilePosition = ICESetting.Control.PopCell.TilePositionEnum.Right;
                        PutToRight(CenterPopArray[2], Equations.QuadEaseOut);
                        _canvas.Children.Add(CenterPopArray[2]);
                    }
                    else
                    {
                        CenterPopArray[2] = null;
                    }
                }
            }
        }
Пример #6
0
        private void TypeEnum_BigScreen_图片(Stack <PopCell> PopCellQueue, ItemInfo itemInfo)
        {
            PopCell cell = new PopCell();

            cell.TilePosition = ICESetting.Control.PopCell.TilePositionEnum.Other;

            cell.CellSource = itemInfo.Source;
            cell.X          = (this.Width - cell.Width) / 2.0;
            cell.Y          = (this.Height - cell.Height) / 2.0;
            cell.ID         = itemInfo.ID;
            cell.UID        = itemInfo.UID;

            PopCellQueue.Push(cell);

            PopCellList.Add(cell);
        }
Пример #7
0
        private void MoveToX(PopCell Cell, double toX, Equations equation)
        {
            isAnimating = true;
            PennerDoubleAnimation daX = new PennerDoubleAnimation()
            {
                To           = toX,
                Equation     = equation,
                FillBehavior = FillBehavior.Stop,
                Duration     = TimeSpan.FromSeconds(0.7)
            };

            if (equation == Equations.QuadEaseOut)
            {
                daX.Duration = TimeSpan.FromSeconds(1);
            }
            daX.Completed += delegate { Cell.X = toX; isAnimating = false; };
            Cell.BeginAnimation(Canvas.LeftProperty, daX);
        }
Пример #8
0
        /// <summary>
        /// 右边栈所有元素重置初始坐标
        /// </summary>
        private void ResetStackRight()
        {
            double  x;
            PopCell cell = CenterPopArray[2];

            if (cell == null)
            {
                x = this.Width;
            }
            else
            {
                x = cell.X + cell.Width;
            }
            foreach (PopCell item in StackRight)
            {
                item.X       = x;
                item.Scale   = 0.9;
                item.Opacity = 0.7d;
            }
        }
Пример #9
0
        /// <summary>
        /// 左边栈所有元素重置初始坐标
        /// </summary>
        private void ResetStackLeft()
        {
            PopCell cell = CenterPopArray[0];

            if (cell == null)
            {
                foreach (PopCell item in StackLeft)
                {
                    item.X       = -item.Width;
                    item.Scale   = 0.9;
                    item.Opacity = 0.7d;
                }
            }
            else
            {
                foreach (PopCell item in StackLeft)
                {
                    item.X       = -item.Width - cell.Width + OffsetScreenWidth;
                    item.Scale   = 0.9;
                    item.Opacity = 0.7d;
                }
            }
        }
Пример #10
0
        private void TypeEnum_BigScreen_图片(Stack<PopCell> PopCellQueue, ItemInfo itemInfo)
        {
            PopCell cell = new PopCell();
            cell.TilePosition = ICESetting.Control.PopCell.TilePositionEnum.Other;

            cell.CellSource = itemInfo.Source;
            cell.X = (this.Width - cell.Width) / 2.0;
            cell.Y = (this.Height - cell.Height) / 2.0;
            cell.ID = itemInfo.ID;
            cell.UID = itemInfo.UID;

            PopCellQueue.Push(cell);

            PopCellList.Add(cell);
        }
Пример #11
0
 private void PutToRight(PopCell cell, Equations equation)
 {
     MoveToX(cell, this.Width - OffsetScreenWidth, equation);
     cell.Y = (this.Height - cell.Height) / 2.0;
     MoveToScaleOpacity(cell, 0.9d, 0.7d);
     cell.IsHitTestVisible = false;
 }
Пример #12
0
 private void PutToCenter(PopCell cell, Equations equation)
 {
     MoveToX(cell, (this.Width - cell.Width) / 2.0, equation);
     MoveToScaleOpacity(cell, 1d, 1d);
     cell.Y = (this.Height - cell.Height) / 2.0;
     cell.IsHitTestVisible = true;
 }
Пример #13
0
 private void MoveToX(PopCell Cell, double toX, Equations equation)
 {
     isAnimating = true;
     PennerDoubleAnimation daX = new PennerDoubleAnimation()
     {
         To = toX,
         Equation = equation,
         FillBehavior = FillBehavior.Stop,
         Duration = TimeSpan.FromSeconds(0.7)
     };
     if (equation == Equations.QuadEaseOut)
     {
         daX.Duration = TimeSpan.FromSeconds(1);
     }
     daX.Completed += delegate { Cell.X = toX; isAnimating = false; };
     Cell.BeginAnimation(Canvas.LeftProperty, daX);
 }
Пример #14
0
        private void MoveToScaleOpacity(PopCell cell, double toScale, double toOpacity)
        {
            DoubleAnimation daScale = new DoubleAnimation()
            {
                To = toScale,
                //Equation=Equations.QuartEaseOut,
                FillBehavior = FillBehavior.Stop,
                Duration = TimeSpan.FromSeconds(0.7)
            };
            DoubleAnimation daO = new DoubleAnimation()
            {
                To = toOpacity,
                FillBehavior = FillBehavior.Stop,
                Duration = TimeSpan.FromSeconds(0.7)
            };
            daO.Completed += delegate
            {
                cell.Opacity = toOpacity;
            };
            daScale.Completed += delegate
            {
                cell.Scale = toScale;

            };
            cell._scale.BeginAnimation(ScaleTransform.ScaleXProperty, daScale);
            cell._scale.BeginAnimation(ScaleTransform.ScaleYProperty, daScale);
            cell.BeginAnimation(OpacityProperty, daO);
        }