private Storyboard CreateSb(string shinkOneName, string shrinkTwoName, string expandName, string barName, bool isCol, int beginTime) { GridLengthAnimation expandAnim = CreateGridLengthAnim(expandName, 0, 1, isCol, beginTime, EdgeDuration); GridLengthAnimation shrinkAnimOne = CreateGridLengthAnim(shinkOneName, 1, 0, isCol, beginTime, EdgeDuration); GridLengthAnimation shrinkAnimTwo = CreateGridLengthAnim(shrinkTwoName, 1, 0, isCol, beginTime, EdgeDuration); DoubleAnimation fadeOutAnim = CreateFadeOutAnim(barName, EdgeDuration + FadeOutDelay, FadeOutDuration, false); int resetTime = (EdgeDuration + FadeOutDelay) + FadeOutDuration; GridLengthAnimation resetExpandAnim = CreateGridLengthAnim(expandName, 1, 0, isCol, resetTime, 0); GridLengthAnimation resetShrinkAnimOne = CreateGridLengthAnim(shinkOneName, 0, 1, isCol, resetTime, 0); GridLengthAnimation resetShrinkAnimTwo = CreateGridLengthAnim(shrinkTwoName, 0, 1, isCol, resetTime, 0); DoubleAnimation resetFadeOutAnim = CreateFadeOutAnim(barName, resetTime, 0, true); Storyboard sb = new Storyboard(); sb.Children.Add(expandAnim); sb.Children.Add(shrinkAnimOne); sb.Children.Add(shrinkAnimTwo); sb.Children.Add(fadeOutAnim); sb.Children.Add(resetExpandAnim); sb.Children.Add(resetShrinkAnimOne); sb.Children.Add(resetShrinkAnimTwo); sb.Children.Add(resetFadeOutAnim); return(sb); }
public void InitSbs() { GridLengthAnimation startMove = CreateGridLengthAnim("TopStart", 0, 1, true, 0, Duration); GridLengthAnimation endMove = CreateGridLengthAnim("TopEnd", 1, 0, true, 0, Duration); GridLengthAnimation startSubMove = CreateGridLengthAnim("TopSuperStart", 0, 1, true, Duration, Duration); GridLengthAnimation endPenMove = CreateGridLengthAnim("TopPenEnd", 1, 0, true, Duration, Duration); storyboard = new Storyboard(); storyboard.Children.Add(startMove); storyboard.Children.Add(endMove); storyboard.Children.Add(startSubMove); storyboard.Children.Add(endPenMove); storyboard.RepeatBehavior = RepeatBehavior.Forever; }
private GridLengthAnimation CreateGridLengthAnim(string name, double from, double to, bool isCol, int beginTime, int duration) { GridLengthAnimation anim = new GridLengthAnimation(); anim.From = new GridLength(from, GridUnitType.Star); anim.To = new GridLength(to, GridUnitType.Star); anim.Duration = new Duration(new System.TimeSpan(0, 0, 0, 0, duration)); anim.BeginTime = new System.TimeSpan(0, 0, 0, 0, beginTime); Storyboard.SetTargetName(anim, name); if (isCol) { Storyboard.SetTargetProperty(anim, new PropertyPath(ColumnDefinition.WidthProperty)); } else { Storyboard.SetTargetProperty(anim, new PropertyPath(RowDefinition.HeightProperty)); } return(anim); }
private Storyboard CreateSb(string colNameOne, string colNameTwo, string barName, bool isCol, int beginTime) { GridLengthAnimation colOneAnim = CreateGridLengthAnim(colNameOne, 0, 1, isCol, beginTime, EdgeDuration); GridLengthAnimation colTwoAnim = CreateGridLengthAnim(colNameTwo, 1, 0, isCol, beginTime, EdgeDuration); DoubleAnimation fadeOutAnim = CreateFadeOutAnim(barName, EdgeDuration + FadeOutDelay, FadeOutDuration, false); int resetTime = (EdgeDuration + FadeOutDelay) + FadeOutDuration; GridLengthAnimation resetColOneAnim = CreateGridLengthAnim(colNameOne, 1, 0, isCol, resetTime, 0); GridLengthAnimation resetColTwoAnim = CreateGridLengthAnim(colNameTwo, 0, 1, isCol, resetTime, 0); DoubleAnimation resetFadeOutAnim = CreateFadeOutAnim(barName, resetTime, 0, true); Storyboard sb = new Storyboard(); sb.Children.Add(colOneAnim); sb.Children.Add(colTwoAnim); sb.Children.Add(fadeOutAnim); sb.Children.Add(resetColOneAnim); sb.Children.Add(resetColTwoAnim); sb.Children.Add(resetFadeOutAnim); return(sb); }
public void InitSbs() { GridLengthAnimation startMoveT = CreateGridLengthAnim("TopStart", 0, 1, true, 0, Duration); GridLengthAnimation endMoveT = CreateGridLengthAnim("TopEnd", 1, 0, true, 0, Duration); GridLengthAnimation startMoveR = CreateGridLengthAnim("RightStart", 0, 1, false, 0, Duration); GridLengthAnimation endMoveR = CreateGridLengthAnim("RightEnd", 1, 0, false, 0, Duration); GridLengthAnimation startMoveB = CreateGridLengthAnim("BottomSuperStart", 1, 0, true, 0, Duration); GridLengthAnimation endMoveB = CreateGridLengthAnim("BottomPenEnd", 0, 1, true, 0, Duration); GridLengthAnimation startMoveL = CreateGridLengthAnim("LeftSuperStart", 1, 0, false, 0, Duration); GridLengthAnimation endMoveL = CreateGridLengthAnim("LeftPenEnd", 0, 1, false, 0, Duration); GridLengthAnimation startSubMoveT = CreateGridLengthAnim("TopSuperStart", 0, 1, true, Duration, Duration); GridLengthAnimation endPenMoveT = CreateGridLengthAnim("TopPenEnd", 1, 0, true, Duration, Duration); GridLengthAnimation startSubMoveR = CreateGridLengthAnim("RightSuperStart", 0, 1, false, Duration, Duration); GridLengthAnimation endPenMoveR = CreateGridLengthAnim("RightPenEnd", 1, 0, false, Duration, Duration); GridLengthAnimation startSubMoveB = CreateGridLengthAnim("BottomStart", 1, 0, true, Duration, Duration); GridLengthAnimation endPenMoveB = CreateGridLengthAnim("BottomEnd", 0, 1, true, Duration, Duration); GridLengthAnimation startSubMoveL = CreateGridLengthAnim("LeftStart", 1, 0, false, Duration, Duration); GridLengthAnimation endPenMoveL = CreateGridLengthAnim("LeftEnd", 0, 1, false, Duration, Duration); storyboard = new Storyboard(); storyboard.Children.Add(startMoveT); storyboard.Children.Add(endMoveT); storyboard.Children.Add(startMoveR); storyboard.Children.Add(endMoveR); storyboard.Children.Add(startMoveB); storyboard.Children.Add(endMoveB); storyboard.Children.Add(startMoveL); storyboard.Children.Add(endMoveL); storyboard.Children.Add(startSubMoveT); storyboard.Children.Add(endPenMoveT); storyboard.Children.Add(startSubMoveR); storyboard.Children.Add(endPenMoveR); storyboard.Children.Add(startSubMoveB); storyboard.Children.Add(endPenMoveB); storyboard.Children.Add(startSubMoveL); storyboard.Children.Add(endPenMoveL); storyboard.RepeatBehavior = RepeatBehavior.Forever; }