Пример #1
0
        public static TweenValue Value(Quaternion from, Quaternion to, float duration, Action <Quaternion> action)
        {
            var tween = UTween.Value(0f, 1f, duration, value =>
            {
                var quaternion = Quaternion.LerpUnclamped(from, to, value);
                action(quaternion);
            });

            return(tween);
        }
Пример #2
0
        public static TweenValue Value(Color from, Color to, float duration, Action <Color> action)
        {
            var tween = UTween.Value(0f, 1f, duration, value =>
            {
                var color = UnityEngine.Color.LerpUnclamped(from, to, value);
                action(color);
            });

            return(tween);
        }
Пример #3
0
        public static TweenValue Value(Vector4 from, Vector4 to, float duration, Action <Vector4> action)
        {
            var tween = UTween.Value(0f, 1f, duration, value =>
            {
                var vector = Vector4.LerpUnclamped(from, to, value);
                action(vector);
            });

            return(tween);
        }
Пример #4
0
        public static TweenValue Value(int from, int to, float duration, Action <int> action)
        {
            var tween = UTween.Value(0f, 1f, duration, value =>
            {
                var result = (int)Mathf.LerpUnclamped(from, to, value);
                action(result);
            });

            return(tween);
        }
Пример #5
0
        public static TweenValue Alpha(this Material material, string propertyName, float from, float to, float duration)
        {
            var tween = UTween.Value(from, to, duration, value =>
            {
                var color = material.GetColor(propertyName);
                color.a   = value;
                material.SetColor(propertyName, color);
            });

            return(tween);
        }
Пример #6
0
        public static TweenValue Value(string text, float from, float to, float duration, bool enableRichText, Action <string> action)
        {
            from = Mathf.Clamp01(from);
            to   = Mathf.Clamp01(to);
            var tween = UTween.Value(from, to, duration, value =>
            {
                var str = LerpUtil.Lerp(text, value, enableRichText);
                action(str);
            });

            return(tween);
        }
Пример #7
0
        public static TweenValue Value(Rect from, Rect to, float duration, Action <Rect> action)
        {
            var tween = UTween.Value(0f, 1f, duration, value =>
            {
                var x      = Mathf.LerpUnclamped(from.x, to.x, value);
                var y      = Mathf.LerpUnclamped(from.y, to.y, value);
                var width  = Mathf.LerpUnclamped(from.width, to.width, value);
                var height = Mathf.LerpUnclamped(from.height, to.height, value);
                var rect   = new Rect(x, y, width, height);
                action(rect);
            });

            return(tween);
        }
Пример #8
0
        public static TweenValue Float(this Material material, string propertyName, float from, float to, float duration)
        {
            var tween = UTween.Value(from, to, duration, value => { material.SetFloat(propertyName, value); });

            return(tween);
        }
Пример #9
0
        public static TweenValue Color(this Material material, string propertyName, Color from, Color to, float duration)
        {
            var tween = UTween.Value(from, to, duration, value => { material.SetColor(propertyName, value); });

            return(tween);
        }
Пример #10
0
        public static TweenValue Tilling(this Material material, string textureName, Vector2 from, Vector2 to, float duration)
        {
            var tween = UTween.Value(from, to, duration, value => { material.SetTextureScale(textureName, value); });

            return(tween);
        }