コード例 #1
0
        /// <summary>
        /// 延迟多少毫秒后执行一组同时执行的Ay动画
        /// </summary>
        /// <param name="millSeconds">毫秒</param>
        /// <param name="ayAnimate">一组Ay动画</param>
        /// <returns></returns>
        public IAyAnimateTreePad DelayAddSameBegin(int millSeconds, params AyAnimateBase[] ayAnimate)
        {
            ///寻找时长最长的动画
            double        time1            = 0;
            AyAnimateBase maxTimeAyAnimate = null;

            foreach (var item in ayAnimate)
            {
                if (item.AnimateSpeed > time1)
                {
                    maxTimeAyAnimate = item;
                    time1            = item.AnimateSpeed;
                }
            }
            if (RootAnimateTree == null)
            {
                RootAnimateTree = new AyAnimateDelayTreeItem {
                    DelayMillseconds = millSeconds, AyAnimateBases = ayAnimate, LastAyAnimateBase = maxTimeAyAnimate, IsFirst = true, IsEnd = true, Time = time1
                };
                AllPlayTime += RootAnimateTree.Time;
            }
            else
            {
                var _AnimateTree = new AyAnimateDelayTreeItem {
                    DelayMillseconds = millSeconds, AyAnimateBases = ayAnimate, LastAyAnimateBase = maxTimeAyAnimate, Time = time1
                };
                AllPlayTime += _AnimateTree.Time;
                AllPlayTime += _AnimateTree.DelayMillseconds;
                if (RootAnimateTree.NextAnimateTreeItem == null)
                {
                    RootAnimateTree.NextAnimateTreeItem = _AnimateTree;
                    _AnimateTree.LastAnimateTreeItem    = RootAnimateTree;
                    RootAnimateTree.LastAyAnimateBase.NextAyAnimateTreeItem = () =>
                    {
                        _AnimateTree.Begin();
                        CurrentAyAnimate = _AnimateTree;
                    };
                    CurrentLinkAnimateTreeItem = _AnimateTree;
                }
                else
                {
                    CurrentLinkAnimateTreeItem.NextAnimateTreeItem = _AnimateTree;
                    _AnimateTree.LastAnimateTreeItem = CurrentLinkAnimateTreeItem;
                    CurrentLinkAnimateTreeItem.LastAyAnimateBase.NextAyAnimateTreeItem = () =>
                    {
                        _AnimateTree.Begin();
                        CurrentAyAnimate = _AnimateTree;
                    };
                    CurrentLinkAnimateTreeItem = _AnimateTree;
                }
            }
            return(this);
        }
コード例 #2
0
 /// <summary>
 /// 延迟多少毫秒后执行 一个动画
 /// </summary>
 /// <param name="millSeconds">毫秒</param>
 /// <param name="ayAnimate">Ay动画</param>
 /// <returns></returns>
 public IAyAnimateTreePad DelayAdd(int millSeconds, AyAnimateBase ayAnimate)
 {
     if (RootAnimateTree == null)
     {
         RootAnimateTree = new AyAnimateDelayTreeItem {
             DelayMillseconds = millSeconds, AyAnimateBases = new AyAnimateBase[] { ayAnimate }, LastAyAnimateBase = ayAnimate, IsFirst = true, IsEnd = true, Time = ayAnimate.AnimateSpeed
         };
         AllPlayTime += RootAnimateTree.Time;
     }
     else
     {
         var _AnimateTree = new AyAnimateDelayTreeItem {
             DelayMillseconds = millSeconds, AyAnimateBases = new AyAnimateBase[] { ayAnimate }, LastAyAnimateBase = ayAnimate, Time = ayAnimate.AnimateSpeed
         };
         AllPlayTime += _AnimateTree.Time;
         AllPlayTime += _AnimateTree.DelayMillseconds;
         if (RootAnimateTree.NextAnimateTreeItem == null)
         {
             RootAnimateTree.NextAnimateTreeItem = _AnimateTree;
             _AnimateTree.LastAnimateTreeItem    = RootAnimateTree;
             RootAnimateTree.LastAyAnimateBase.NextAyAnimateTreeItem = () =>
             {
                 _AnimateTree.Begin();
                 CurrentAyAnimate = _AnimateTree;
             };
             CurrentLinkAnimateTreeItem = _AnimateTree;
         }
         else
         {
             CurrentLinkAnimateTreeItem.NextAnimateTreeItem = _AnimateTree;
             _AnimateTree.LastAnimateTreeItem = CurrentLinkAnimateTreeItem;
             CurrentLinkAnimateTreeItem.LastAyAnimateBase.NextAyAnimateTreeItem = () =>
             {
                 _AnimateTree.Begin();
                 CurrentAyAnimate = _AnimateTree;
             };
             CurrentLinkAnimateTreeItem = _AnimateTree;
         }
     }
     return(this);
 }