//Parallel Group By List public static XTween ParallelTweensWithList(List <XTween> list) { XTween t = new XTween(list.ToArray()); t.groupType_ = GroupType.Parallel; return(t); }
//Serial Group public static XTween SerialTweens(params XTween[] args) { XTween t = new XTween(args); t.groupType_ = GroupType.Serial; return(t); }
//Parallel Group public static XTween ParallelTweens(params XTween[] args) { XTween t = new XTween(args); t.groupType_ = GroupType.Parallel; return(t); }
//clear current time private void ResetAllChildTime(XTween tween) { if (tween.children_ != null && tween.children_.Length > 0) { foreach (XTween child in tween.children_) { ResetAllChildTime(child); } } tween.isSetCurrentFrom_ = false; tween.isComplete_ = false; tween.currentTime_ = 0; }
private void PlayAnimation1(object sender, TappedRoutedEventArgs e) { Button bt = (Button)sender; bt.IsEnabled = false; double originWidth = Target1.Width; var tween = new XTween(Target1, "Width", originWidth, cellWidth_ - 20, 2, XTween.Easing.EaseExpoInOut); tween.OnCompleted += (sender_, e_) => { Target1.Width = originWidth; bt.IsEnabled = true; }; tween.Play(); }
//All Tween finish flag private bool IsAllChildFinish(XTween tween) { bool isAllFinish = true; if (tween.children_ != null && tween.children_.Length > 0) { foreach (XTween child in tween.children_) { if (!IsAllChildFinish(child)) { isAllFinish = false; break; } } } else { isAllFinish = tween.IsFinish(); } return(isAllFinish); }
//Recursive processing private void TweenAllPlay(XTween tween, double delta) { if (tween.children_ != null && tween.children_.Length > 0) { if (tween.IsFinish()) { for (int i = 0; i < tween.children_.Length; ++i) { XTween child = tween.children_[i]; TweenAllPlay(child, delta); if (!IsAllChildFinish(child) && tween.groupType_ == GroupType.Serial) { break; } } } else { tween.AddTime(delta); } } else { if (!tween.IsFinish()) { tween.AddTime(delta); } } //Check Complete if (!tween.isComplete_ && IsAllChildFinish(tween)) { tween.isComplete_ = true; tween.Stop(); EventHandler handler = tween.onCompleted_; if (handler != null) { handler(this, EventArgs.Empty); } } }
//All Tween finish flag private bool IsAllChildFinish(XTween tween) { bool isAllFinish = true; if (tween.children_ != null && tween.children_.Length > 0) { foreach(XTween child in tween.children_) { if (!IsAllChildFinish(child)) { isAllFinish = false; break; } } } else { isAllFinish = tween.IsFinish(); } return isAllFinish; }
//Serial Group By List public static XTween SerialTweensWithList(List<XTween> list) { XTween t = new XTween(list.ToArray()); t.groupType_ = GroupType.Serial; return t; }
//Serial Group public static XTween SerialTweens(params XTween[] args) { XTween t = new XTween(args); t.groupType_ = GroupType.Serial; return t; }
//Parallel Group public static XTween ParallelTweens(params XTween[] args) { XTween t = new XTween(args); t.groupType_ = GroupType.Parallel; return t; }