//Add a Animated Method for Animate Enum static void Animate(AnimateDirection direction) { switch (direction) { case AnimateDirection.Right: Console.WriteLine("Animating in Right...."); break; case AnimateDirection.Left: Console.WriteLine("Animating in Left...."); break; case AnimateDirection.Up: Console.WriteLine("Animating in Up..."); break; case AnimateDirection.Down: Console.WriteLine("Animating in Down..."); break; default: Console.WriteLine("I don't know what kinds of animating this is!..."); break; } }
void Reset() { state = AnimateState.None; indexDirection = direction; timeElapsed = 0f; loops = 0; delayElapsed = 0f; delay = UnityEngine.Random.Range(delayMIN, delayMAX); setSpriteIndexOnPlay = false; }
public static async Task SlideIn(this FrameworkElement element, AnimateDirection direction, bool firstLoad, float seconds = 0.3F) { var sb = new Storyboard(); switch (direction) { case AnimateDirection.Left: sb.AddSlideFromLeft(seconds, element.ActualWidth); break; case AnimateDirection.Up: sb.AddSlideDown(seconds, element.ActualHeight); break; } sb.Begin(element); if (firstLoad) { element.Visibility = Visibility.Visible; } await Task.Delay((int)seconds * 1000); }
void PlayAnimationFinished() { loops++; switch (type) { case AnimateType.PlayOnce: if (playOnceRepeated) { indexDirection = direction; timeElapsed = 0f; loops = 0; delayElapsed = 0f; delay = UnityEngine.Random.Range(delayMIN, delayMAX); setSpriteIndexOnPlay = true; _state = AnimateState.Playing; } else { state = AnimateState.Completed; } break; case AnimateType.PingPongOnce: if (loops >= 2) { if (playOnceRepeated) { indexDirection = direction; timeElapsed = 0f; loops = 0; delayElapsed = 0f; delay = UnityEngine.Random.Range(delayMIN, delayMAX); setSpriteIndexOnPlay = false; _state = AnimateState.Playing; } else { state = AnimateState.Completed; } } else { switch (indexDirection) { case AnimateDirection.Forward: indexDirection = AnimateDirection.Backward; index--; SetSprite(); break; case AnimateDirection.Backward: indexDirection = AnimateDirection.Forward; index++; SetSprite(); break; } } break; case AnimateType.Loop: switch (direction) { case AnimateDirection.Forward: index = 0; SetSprite(); break; case AnimateDirection.Backward: index = sprites.Length - 1; SetSprite(); break; } break; case AnimateType.PingPong: switch (indexDirection) { case AnimateDirection.Forward: indexDirection = AnimateDirection.Backward; index--; SetSprite(); break; case AnimateDirection.Backward: indexDirection = AnimateDirection.Forward; index++; SetSprite(); break; } break; } }
private void CommonConstruction() { this.InitializeComponent(); this.m_eventClosed = new AutoResetEvent(false); this.m_eventNotifyClosed = new ManualResetEvent(false); this.m_direction = AnimateDirection.BottomToTop; this.m_iSpeed = 40; this.m_colorStart = Color.FromArgb(0xff, 0xa8, 0xa8, 0xff); this.m_colorEnd = SystemColors.Window; this.m_bgMode = SkyMap.Net.Gui.BackgroundMode.GradientVertical; this.m_iDelay = 0x1388; this.m_bCloseRequested = false; this.m_iInterval = 10; this.InitCenterLocation(); this.m_startLocation = base.Location; this.m_bSavedBounds = false; this.m_bActivated = false; this.m_borderStyle = SkyMap.Net.Gui.BorderStyle.None; this.m_iBorderWidth = 0; this.m_wndMover = new WndMover(this.DoMove); this.m_bAutoDispose = false; }