private IEnumerator AnimationHelper(float duration, AnimationDelegate d, YieldInstruction wait){ if(wait != null) yield return wait; float startTime = Time.time; for(float elapsed = 0.0f; elapsed < duration; elapsed = Time.time - startTime){ d(elapsed / duration); yield return null; } d(1.0f); }
public static void RemoveAnimationCallback(AnimationDelegate callback) { lock (Callbacks) { if (Callbacks.Contains(callback)) { Callbacks.Remove(callback); InvalidateThemeTimer(); } } }
public static void AddAnimationCallback(AnimationDelegate callback) { lock (Callbacks) { if (!Callbacks.Contains(callback)) { Callbacks.Add(callback); InvalidateThemeTimer(); } } }
public Animate(AnimationDelegate animation, Size size) { TaskCompletionSource <Renderer> tcs = new TaskCompletionSource <Renderer>(); this.renderer = tcs.Task; void CreateTimerSystem(object sender, EventArgs args) { CompositionTargetSecondsTimerSystem timerSystem = CompositionTargetSecondsTimerSystem.Create(((RenderingEventArgs)args).RenderingTime.TotalSeconds, e => this.Dispatcher.Invoke(() => throw e)); Point extents = new Point(size.Width / 2, size.Height / 2); tcs.SetResult(new Renderer(timerSystem, Transaction.Run(() => Shapes.Translate(animation(timerSystem, extents), Behavior.Constant(extents))), size, this, this.isStarted)); CompositionTarget.Rendering -= CreateTimerSystem; } CompositionTarget.Rendering += CreateTimerSystem; }
public Animate(AnimationDelegate animation, Size size) { TaskCompletionSource<Renderer> tcs = new TaskCompletionSource<Renderer>(); this.renderer = tcs.Task; EventHandler createTimerSystem = null; createTimerSystem = (sender, args) => { CompositionTargetSecondsTimerSystem timerSystem = CompositionTargetSecondsTimerSystem.Create(((RenderingEventArgs)args).RenderingTime.TotalSeconds, e => this.Dispatcher.Invoke(() => { throw e; })); Point extents = new Point(size.Width / 2, size.Height / 2); tcs.SetResult( new Renderer( timerSystem, Transaction.Run(() => Shapes.Translate(animation(timerSystem, extents), Cell.Constant(extents))), size, this, this.isStarted)); CompositionTarget.Rendering -= createTimerSystem; }; CompositionTarget.Rendering += createTimerSystem; }
private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { if (step >= doc.Goal) { timer.Stop(); } else { if (tick >= nexttick) { step++; AnimationDelegate animationMethod = new AnimationDelegate(this.AnimateSolutionThreaded); this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, animationMethod); nexttick += measureBlockLength(step); } tick++; } } catch (TargetInvocationException) { } }
//function used as callback for unity animations public void animationFinished(int animationId) { animating = false; if (DicePlusConnectionManager.Instance != null && DicePlusConnectionManager.Instance.state == DicePlusConnectionManager.State.CONNECTED && animationQueue.Count == 0) { hideConnector(true, 0.25f); return; } if (DicePlusConnectionManager.Instance != null && DicePlusConnectionManager.Instance.state != DicePlusConnectionManager.State.ROLLER && DicePlusConnectionManager.Instance.state != DicePlusConnectionManager.State.NO_BLUETOOTH) { if (animationId == CONNECTED_ANIMATION) { runSearchingMoreAnimation(); } else { if (animationQueue.Count > 0) { AnimationDelegate animDelegate = animationQueue.Dequeue(); animDelegate(); } else { runSearchingAnimation(animationId != SEARCHING_ANIMATION); } } } else { if (animationQueue.Count > 0) { AnimationDelegate animDelegate = animationQueue.Dequeue(); animDelegate(); } } }
IEnumerator ScaleAnimation(Transform target, Vector3 to, float animTime, float delay, Action onComplete, Action onUpdate) { if (delay > 0) { yield return(new WaitForSeconds(delay)); } AnimationDelegate animationDelegate = GetAnimationMethod(); Vector3 from = target.localScale; float timeRemaining = animTime; float t; while (timeRemaining > 0) { timeRemaining -= Time.deltaTime; t = timeRemaining / animTime; target.localScale = new Vector3(animationDelegate(to.x, from.x, t), animationDelegate(to.y, from.y, t), animationDelegate(to.z, from.z, t)); onUpdate.RunAction(); yield return(null); } target.localScale = to; onComplete.RunAction(); }
IEnumerator FadeAnimation(CanvasGroup target, float to, float animTime, float delay, Action onComplete, Action onUpdate) { if (delay > 0) { yield return(new WaitForSeconds(delay)); } AnimationDelegate animationDelegate = GetAnimationMethod(); float from = target.alpha; float timeRemaining = animTime; float t; while (timeRemaining > 0) { timeRemaining -= Time.deltaTime; t = timeRemaining / animTime; target.alpha = animationDelegate(to, from, t); onUpdate.RunAction(); yield return(null); } target.alpha = to; onComplete.RunAction(); }
IEnumerator MoveAnimation(Transform target, Vector3 to, float animTime, float delay, Action onComplete, Action onUpdate, bool isLocal) { if (delay > 0) { yield return(new WaitForSeconds(delay)); } AnimationDelegate animationDelegate = GetAnimationMethod(); Vector3 from = isLocal ? target.localPosition : target.position; float timeRemaining = animTime; float t; while (timeRemaining > 0) { timeRemaining -= Time.deltaTime; t = timeRemaining / animTime; if (isLocal) { target.localPosition = new Vector3(animationDelegate(to.x, from.x, t), animationDelegate(to.y, from.y, t), from.z); } else { target.position = new Vector3(animationDelegate(to.x, from.x, t), animationDelegate(to.y, from.y, t), from.z); } onUpdate.RunAction(); yield return(null); } if (isLocal) { target.localPosition = to; } else { target.position = to; } onComplete.RunAction(); }
public static void RemoveAnimationCallback(AnimationDelegate callback) { lock (Callbacks) { if (!Callbacks.Contains(callback)) return; Callbacks.Remove(callback); InvalidateThemeTimer(); } }
public Coroutine AddAnimation(float duration, AnimationDelegate d, Coroutine wait ){ return StartCoroutine(AnimationHelper(duration, d, wait)); }
public Coroutine AddAnimation(float duration, AnimationDelegate d, float wait ){ return StartCoroutine(AnimationHelper(duration, d, new WaitForSeconds(wait))); }
public Coroutine AddAnimation(float duration, AnimationDelegate d){ return StartCoroutine(AnimationHelper(duration, d, null)); }
public void RemoveListener(AnimationDelegate listener) { m_animListener -= listener; }
public static void AddAnimationCallback(AnimationDelegate callback) { // This item is obfuscated and can not be translated. uint num; uint num2; int num3; int num4; int num5; object callbacks = Callbacks; bool flag = false; try { num = 0xa564a6c7; ×Fi(callbacks, ref flag); Label_001B: num4 = 0x28676d64; Label_0027:; num5 = 0x2ebd3d56; num3 = 0x4d2; switch (((num2 = (uint) (-(~(-num5 * -2129098183) - (0x47da838d + 0x11041334)) + num4)) >> 0x10)) { case 0: goto Label_01BD; case 1: Callbacks.Add(callback); num4 = (int) (num ^ InternalSerializerTypeE.StaticArrayInitTypeSize=392); goto Label_0027; case 2: goto Label_001B; case 3: num3 = 0x4d2; num3 = 0x4d2; num3 = 0x4d2; num3 = 0x4d2; num4 = -909134744; goto Label_0027; } goto Label_0229; CÛÄk(); } finally { num = 0xa564a6c7; if (!flag) { goto Label_02EA; } Label_0244: num4 = 0x1eec634; Label_0250:; num5 = -1847616346; num3 = 0x4d2; switch (((num2 = (uint) (-(~(-num5 * -2129098183) - (0x47da838d + 0x11041334)) + num4)) >> 0x10)) { case 0: goto Label_0244; case 2: »úm(callbacks); num4 = (int) Shit.My.MyApplication.StringSplitOptions[0x146]; goto Label_0250; } goto Label_02EA; } }
public StartControl(SelectedHandler Handler) { InitializeComponent(); this.Handler = Handler; AnimationItem = AnimateItem; }
public static void RemoveAnimationCallback(AnimationDelegate callback) { // This item is obfuscated and can not be translated. uint num; uint num2; int num3; int num4; int num5; object callbacks = Callbacks; bool flag = false; try { num = 0x1bb4612a; ×Fi(callbacks, ref flag); if (Callbacks.Contains(callback)) { goto Label_00CA; } Label_002B: num4 = 0x67ceaf47; Label_0037:; num5 = 0x479b2978; num3 = 0x4d2; switch (((num2 = (uint) ((-((~num5 * 0x3250f71) * 0x2895b6e3) ^ 0x4ef5c2a2) + num4)) >> 0x10)) { case 0: break; case 1: return; case 2: goto Label_002B; default: goto Label_00FE; } Label_00CA: Callbacks.Remove(callback); num4 = (int) (num ^ InternalSerializerTypeE.StaticArrayInitTypeSize=392); goto Label_0037; CÛÄk(); } finally { num = 0x1bb4612a; if (!flag) { goto Label_01B8; } Label_0119: num4 = -710576372; Label_0125:; num5 = 0x74766920; num3 = 0x4d2; switch (((num2 = (uint) ((-((~num5 * 0x3250f71) * 0x2895b6e3) ^ 0x4ef5c2a2) + num4)) % 3)) { case 0: goto Label_0119; case 2: »úm(callbacks); num4 = (int) (num ^ InternalSerializerTypeE.FormatterConverter); goto Label_0125; } goto Label_01B8; } }
public void RegisterListener(AnimationDelegate listener) { m_animListener += listener; }