public static UniTask ToLocalScale(this IAnimatorWithStartValue <Vector2> animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(gameObject); return(Anime.PlayTo(animator, new LocalScaleTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask ToMaterialPropertyInt(this IAnimatorWithStartValue <int> animator, Renderer renderer, string name, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(renderer); return(Anime.PlayTo(animator, new MaterialPropertyIntTranslator(renderer, name), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask ToAnchoredPositionY(this IAnimator <float> animator, RectTransform rectTransform, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(rectTransform); return(Anime.Play(animator, new AnchoredPositionXTranslator(rectTransform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(rectTransform.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask ToSizeDelta(this IAnimator <Vector2> animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(gameObject); return(Anime.Play(animator, new SizeDeltaTranslator(gameObject.GetComponent <RectTransform>()), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask Delay(float duration, IScheduler scheduler = default, CancellationToken cancellationToken = default, SkipToken skipToken = default) { return(DelayInternal(duration, scheduler, cancellationToken, skipToken)); }
public static UniTask ToBind <T>(this IAnimator <T> animator, Func <T> getter, Action <T> setter, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { return(Anime.Play(animator, new BindTranslator <T>(getter, setter), scheduler, cancellationToken, skipToken)); }
public static UniTask ToColorA(this IAnimatorWithStartValue <float> animator, CanvasGroup canvasGroup, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(canvasGroup); return(Anime.PlayTo(animator, new CanvasGroupTranslator(canvasGroup), scheduler, CancellationTokenSource.CreateLinkedTokenSource(canvasGroup.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask PlayTo <T>(IAnimatorWithStartValue <T> animatorWithStartValue, IValueTranslator <T> translator, IScheduler scheduler = default, CancellationToken cancellationToken = default, SkipToken skipToken = default) { var animator = animatorWithStartValue.Start(translator.Current); return(PlayInternal(animator, translator, scheduler, cancellationToken, skipToken)); }
public static UniTask ToLocalPositionY(this IAnimator <float> animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(gameObject); return(Anime.Play(animator, new LocalPositionXTranslator(gameObject.transform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask ToProgress <T>(this IAnimator <T> animator, IProgress <T> progress, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { return(Anime.Play(animator, new ProgressTranslator <T>(progress), scheduler, cancellationToken, skipToken)); }
public static UniTask ToLocalPositionX(this IAnimatorWithStartValue <float> animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(component); return(Anime.PlayTo(animator, new LocalPositionXTranslator(component.transform, 0), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask ToGlobalRotation(this IAnimatorWithStartValue <Quaternion> animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(component); return(Anime.PlayTo(animator, new GlobalRotationTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask ToGlobalRotation(this IAnimator <Quaternion> animator, GameObject gameObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(gameObject); return(Anime.Play(animator, new GlobalRotationTranslator(gameObject.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(gameObject.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public SkipTokenSource() { IsSkipRequested = false; Token = new SkipToken(this); }
public static UniTask ToText(this IAnimator <float> animator, Text text, string format, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(text); return(Anime.Play(animator, new TextTranslator(text, format), scheduler, CancellationTokenSource.CreateLinkedTokenSource(text.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask Play <T>(IAnimator <T> animator, ITranslator <T> translator, IScheduler scheduler = default, CancellationToken cancellationToken = default, SkipToken skipToken = default) { return(PlayInternal(animator, translator, scheduler, cancellationToken, skipToken)); }
public static UniTask ToColorA(this IAnimator <float> animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(graphic); return(Anime.Play(animator, new ColorXTranslator(graphic, 3), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
private static async UniTask PlayInternal <T>(IAnimator <T> animator, ITranslator <T> translator, IScheduler scheduler, CancellationToken cancellationToken, SkipToken skipToken) { if (scheduler == default) { scheduler = DefaultScheduler; } var startTime = scheduler.Now; var playState = Application.isPlaying; while (!cancellationToken.IsCancellationRequested && !skipToken.IsSkipRequested && playState == Application.isPlaying) { var time = scheduler.Now - startTime; var(t, used) = animator.Update(time); translator.Update(t); if (used < time) { break; } await UniTask.Yield(PlayerLoopTiming.Update, cancellationToken); } cancellationToken.ThrowIfCancellationRequested(); if (skipToken.IsSkipRequested) { var(t, _) = animator.Update(float.MaxValue); translator.Update(t); } }
public static UniTask ToFillAmount(this IAnimatorWithStartValue <float> animator, Image image, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(image); return(Anime.PlayTo(animator, new FillAmountTranslator(image), scheduler, CancellationTokenSource.CreateLinkedTokenSource(image.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
private static async UniTask DelayInternal(float duration, IScheduler scheduler, CancellationToken cancellationToken, SkipToken skipToken) { if (scheduler == default) { scheduler = DefaultScheduler; } var startTime = scheduler.Now; var playState = Application.isPlaying; while (!cancellationToken.IsCancellationRequested && !skipToken.IsSkipRequested && playState == Application.isPlaying) { var time = scheduler.Now - startTime; if (duration < time) { break; } await UniTask.Yield(PlayerLoopTiming.Update, cancellationToken); } cancellationToken.ThrowIfCancellationRequested(); }
private static async UniTask PlayInternal <T>(IAnimator <T> animator, ITranslator <T> translator, IScheduler scheduler, CancellationToken cancellationToken, SkipToken skipToken) { if (scheduler == default) { scheduler = DefaultScheduler; } var time = 0f; var playState = Application.isPlaying; while (!cancellationToken.IsCancellationRequested && !skipToken.IsSkipRequested && translator.Alive && playState == Application.isPlaying) { var(t, used) = animator.Update(time); translator.Update(t); if (used < time) { break; } await UniTask.NextFrame(scheduler.UpdateTiming, cancellationToken); time += scheduler.DeltaTime; } if (!translator.Alive) { throw new OperationCanceledException("!translator.Alive"); } cancellationToken.ThrowIfCancellationRequested(); if (skipToken.IsSkipRequested) { var(t, _) = animator.Update(float.MaxValue); translator.Update(t); } }
public static UniTask ToBind <T>(this IAnimatorWithStartValue <T> animator, Func <T> getter, Action <T> setter, Object unityObject, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { return(Anime.PlayTo(animator, new BindTranslatorWithObject <T>(getter, setter, unityObject), scheduler, cancellationToken, skipToken)); }
private static async UniTask DelayInternal(float duration, IScheduler scheduler, CancellationToken cancellationToken, SkipToken skipToken) { if (scheduler == default) { scheduler = DefaultScheduler; } var time = 0f; var playState = Application.isPlaying; while (!cancellationToken.IsCancellationRequested && !skipToken.IsSkipRequested && playState == Application.isPlaying) { if (duration < time) { break; } await UniTask.NextFrame(scheduler.UpdateTiming, cancellationToken); time += scheduler.DeltaTime; } cancellationToken.ThrowIfCancellationRequested(); }
public static UniTask ToAnchoredPositionY(this IAnimatorWithStartValue <float> animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(graphic); return(Anime.PlayTo(animator, new AnchoredPositionXTranslator(graphic.rectTransform, 1), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask ToMaterialPropertyFloat(this IAnimator <float> animator, Renderer renderer, int nameID, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(renderer); return(Anime.Play(animator, new MaterialPropertyFloatTranslator(renderer, nameID), scheduler, CancellationTokenSource.CreateLinkedTokenSource(renderer.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask ToSizeDelta(this IAnimator <Vector2> animator, Graphic graphic, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(graphic); return(Anime.Play(animator, new SizeDeltaTranslator(graphic.rectTransform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(graphic.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }
public static UniTask ToLocalScale(this IAnimator <Vector2> animator, Component component, CancellationToken cancellationToken = default, SkipToken skipToken = default, IScheduler scheduler = default) { CheckAlive(component); return(Anime.Play(animator, new LocalScaleTranslator(component.transform), scheduler, CancellationTokenSource.CreateLinkedTokenSource(component.GetCancellationTokenOnDestroy(), cancellationToken).Token, skipToken)); }