/// <summary> /// 添加一组同时执行的Ay动画 /// </summary> /// <param name="ayAnimate">Ay动画</param> /// <returns></returns> public IAyAnimateTreePad AddSameBegin(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 AyAnimateTreeItem { AyAnimateBases = ayAnimate, LastAyAnimateBase = maxTimeAyAnimate, IsFirst = true, IsEnd = true, Time = time1 }; AllPlayTime += RootAnimateTree.Time; } else { var _AnimateTree = new AyAnimateTreeItem { AyAnimateBases = ayAnimate, LastAyAnimateBase = maxTimeAyAnimate, Time = time1 }; AllPlayTime += _AnimateTree.Time; 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); }
/// <summary> /// 添加一个动画 /// </summary> /// <param name="ayAnimate">一个动画</param> /// <returns></returns> public IAyAnimateTreePad Add(AyAnimateBase ayAnimate) { if (RootAnimateTree == null) { RootAnimateTree = new AyAnimateTreeItem { AyAnimateBases = new AyAnimateBase[] { ayAnimate }, LastAyAnimateBase = ayAnimate, IsFirst = true, IsEnd = true, Time = ayAnimate.AnimateSpeed }; AllPlayTime += RootAnimateTree.Time; } else { var _AnimateTree = new AyAnimateTreeItem { AyAnimateBases = new AyAnimateBase[] { ayAnimate }, LastAyAnimateBase = ayAnimate, Time = ayAnimate.AnimateSpeed }; AllPlayTime += _AnimateTree.Time; 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); }