Example #1
0
        public static IEnumerator Scale(this SmoothArgs <RectTransform> args, Vector3 targetScale)
        {
            Transform trans         = args.item.transform;
            Vector3   startingScale = trans.localScale;

            void OnSmooth(float lerp) => trans.localScale = Vector3.Lerp(startingScale, targetScale, lerp);

            return(args.DoSmooth(OnSmooth));
        }
Example #2
0
        public static IEnumerator Move(this SmoothArgs <RectTransform> args, Vector3 to)
        {
            Transform trans         = args.item.transform;
            Vector3   startPosition = trans.position;

            void OnSmooth(float lerp) => Vector3.Lerp(startPosition, to, lerp);

            return(args.DoSmooth(OnSmooth));
        }
Example #3
0
        public static IEnumerator Fade(this SmoothArgs <Image> args, bool toOpaque = true)
        {
            void OnSmooth(float lerp)
            {
                Color color = args.item.color;

                if (!toOpaque)
                {
                    lerp = 1 - lerp;
                }

                color.a         = lerp;
                args.item.color = color;
            }

            return(args.DoSmooth(OnSmooth));
        }