Beispiel #1
0
 public static Coroutine BackgroundColorTo(this Camera camera, Color to, float duration, EaseMethod ease)
 {
     return(Greasy.To(camera.backgroundColor, to, duration, ease, x => camera.backgroundColor = x));
 }
Beispiel #2
0
 public static EaseMethod EaseInOut(EaseMethod easeIn, EaseMethod easeOut, float midPoint = 0.5f)
 {
     return(t => ((t < midPoint) ?
                  (midPoint * easeIn(t / midPoint)) :
                  ((1 - midPoint) * easeOut((t - midPoint) / (1 - midPoint)) + midPoint)));
 }
Beispiel #3
0
 public static Coroutine To(this int from, int to, float duration, EaseMethod ease)
 => Greasy.To(from, to, duration, ease, setter: (x => from = x));
 public static Coroutine ScaleTo(this Transform transform, Vector3 to, float duration, EaseMethod ease)
 {
     return(Greasy.To(transform.localScale, to, duration, ease, x => transform.localScale = x));
 }
        public static Coroutine FloatTo(this AudioMixer audioMixer, string name, float to, float duration, EaseMethod ease)
        {
            var from = 0f;

            if (!audioMixer.GetFloat(name, out from))
            {
                throw new System.Exception($"Audio Mixer doesn't have a float called '{name} or is currently being edited.'");
            }
            return(Coroutween.To(from, to, duration, ease, x => audioMixer.SetFloat(name, x)));
        }
 public static Coroutine To(int from, int to, float duration, EaseMethod ease, Setter <int> setter)
 => CreateInterpolater(duration, ease, t => setter((int)(t * Mathf.Abs(to - from) + from)));
 public static Coroutine LocalRotationTo(this Transform transform, Quaternion to, float duration, EaseMethod ease)
 {
     return(Greasy.To(transform.localRotation, to, duration, ease, x => transform.localRotation = x));
 }
Beispiel #8
0
 public static EaseMethod EaseInOut(EaseMethod easeIn, EaseMethod easeOut)
 {
     return(t => ((t < 0.5f) ? (0.5f * easeIn(2 * t)) : (0.5f * easeOut(2 * t - 1) + 0.5f)));
 }
 public static Coroutine VolumeTo(this AudioSource source, float to, float duration, EaseMethod ease)
 {
     return(Coroutween.To(source.volume, to, duration, ease, x => source.volume = x));
 }
Beispiel #10
0
 public static Coroutine To(Vector3Int from, Vector3Int to, float duration, EaseMethod ease, Setter <Vector3Int> setter)
 {
     return(CreateInterpolater(duration, ease, t => setter(CGMath.LerpUnclamped(from, to, t))));
 }
Beispiel #11
0
        public static Coroutine FloatTo(this Material material, string name, float to, float duration, EaseMethod ease)
        {
            float from = material.GetFloat(name);

            return(Greasy.To(from, to, duration, ease, setter: (x => from = x)));
        }
Beispiel #12
0
 public static Coroutine PivotTo(this RectTransform transform, Vector2 to, float duration, EaseMethod ease)
 {
     return(Greasy.To(transform.pivot, to, duration, ease, x => transform.pivot = x));
 }
Beispiel #13
0
 public static Coroutine RotationTo(this RectTransform transform, Quaternion to, float duration, EaseMethod ease)
 {
     return(Greasy.To(transform.rotation, to, duration, ease, setter: (x => transform.rotation = x)));
 }
Beispiel #14
0
 public static Coroutine FieldOfViewTo(this Camera camera, float to, float duration, EaseMethod ease)
 {
     return(Greasy.To(camera.fieldOfView, to, duration, ease, x => camera.fieldOfView = x));
 }
Beispiel #15
0
 public static Coroutine CreateInterpolater(float duration, EaseMethod easeMethod, Action <float> onProgressChanged)
 => Tweener.StartCoroutine(Lerper(duration, easeMethod, onProgressChanged));
 public static Coroutine PitchTo(this AudioSource source, float to, float duration, EaseMethod ease)
 {
     return(Coroutween.To(source.pitch, to, duration, ease, x => source.pitch = x));
 }
Beispiel #17
0
 private static IEnumerator Lerper(float duration, EaseMethod ease, Action <float> onProgressChanged)
 {
     return(To(duration, time => onProgressChanged(ease(time))));
 }
Beispiel #18
0
 public static Coroutine ColorTo(this Light light, Color to, float duration, EaseMethod ease)
 {
     return(Coroutween.To(light.color, to, duration, ease, x => light.color = x));
 }
 public static Coroutine LocalPositionTo(this Transform transform, Vector3 to, float duration, EaseMethod ease)
 => Greasy.To(transform.localPosition, to, duration, ease, setter: (x => transform.localPosition = x));
Beispiel #20
0
 public static Coroutine IntensityTo(this Light light, float to, float duration, EaseMethod ease)
 {
     return(Coroutween.To(light.intensity, to, duration, ease, x => light.intensity = x));
 }
 public static Coroutine LookTo(this Transform transform, Vector3 to, Vector3 up, float duration, EaseMethod ease)
 {
     return(Greasy.To(transform.rotation, Quaternion.LookRotation(to - transform.position, up), duration, ease, x => transform.localRotation = x));
 }
Beispiel #22
0
 public static Coroutine ShadowStrengthTo(this Light light, float to, float duration, EaseMethod ease)
 {
     return(Coroutween.To(light.shadowStrength, to, duration, ease, x => light.shadowStrength = x));
 }
Beispiel #23
0
 public static Coroutine To(float from, float to, float duration, EaseMethod ease, Setter <float> setter)
 {
     return(CreateInterpolater(duration, ease, t => setter(Mathf.LerpUnclamped(from, to, t))));
 }
 public static Coroutine To(Color from, Color to, float duration, EaseMethod ease, Setter <Color> setter)
 {
     return(CreateInterpolater(duration, ease, t => setter(Color.LerpUnclamped(from, to, t))));
 }
Beispiel #25
0
 public static EaseMethod EaseInvert(EaseMethod ease)
 {
     return(t => 1 - ease(1 - t));
 }
Beispiel #26
0
 private static Coroutine CreateInterpolater(float duration, EaseMethod easeMethod, ProgressChanged onProgress)
 => Tweener.StartCoroutine(Lerper(duration, easeMethod, onProgress));
 public static Coroutine To(Quaternion from, Quaternion to, float duration, EaseMethod ease, Setter <Quaternion> setter)
 => CreateInterpolater(duration, ease, t => setter(Quaternion.SlerpUnclamped(from, to, t)));
Beispiel #28
0
 private static IEnumerator Lerper(float duration, EaseMethod ease, ProgressChanged onProgress)
 {
     return(To(duration, t => onProgress(ease(t))));
 }
 public static Coroutine To(Vector3 from, Vector3 to, float duration, EaseMethod ease, Setter <Vector3> setter)
 => CreateInterpolater(duration, ease, t => setter(Vector3.LerpUnclamped(from, to, t)));
 public static Coroutine RotationTo(this Transform transform, Quaternion to, float duration, EaseMethod ease)
 {
     return(Coroutween.To(transform.rotation, to, duration, ease, x => transform.rotation = x));
 }