Beispiel #1
0
        public static TransformTweening PlayPosition(Transform target, float duration, Transform toTransform)
        {
            var player = TweensPlayer.Get(target.gameObject, duration);
            var result = player.GetOrAddParameter <TransformTweening>(Type.Position);

            result.parameterType = Type.Position;
            result.tweenCurves   = new [] {
                new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f)),
                new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f)),
                new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f)),
                new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f)),
                new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f)),
                new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f)),
                new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f))
            };
            result.target = target;
            result.from   = null;
            result.to     = toTransform;
            player.ResetForForwardPlaying();
            if (duration > 0f)
            {
                player.ResetForForwardPlaying();
                player.PlayForward();
            }
            else
            {
                player.ResetForReversePlaying();
            }
            return(result);
        }
        public static AlphaTweening PlayAlpha(CanvasGroup target, float duration, float toAlpha)
        {
            var player = TweensPlayer.Get(target.gameObject, duration);
            var result = player.GetOrAddParameter <AlphaTweening>(Type.Alpha);

            result.parameterType = Type.Alpha;
            result.tweenCurves   = new [] {
                new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f))
            };
            result.target = target;
            result.from   = target.alpha;
            result.to     = toAlpha;
            if (duration > 0f)
            {
                player.ResetForForwardPlaying();
                player.PlayForward();
            }
            else
            {
                player.ResetForReversePlaying();
            }
            return(result);
        }
Beispiel #3
0
        public static ColorTweening Play(Graphic target, float duration, Color toColor)
        {
            var player = TweensPlayer.Get(target.gameObject, duration);
            var result = player.GetOrAddParameter <ColorTweening>(SUPPORT_TYPES);

            result.parameterType = SUPPORT_TYPES;
            result.tweenCurves   = new [] {
                new AnimationCurve(new Keyframe(0f, 0f, 0f, 1f), new Keyframe(1f, 1f, 1f, 0f))
            };
            result.target = target;
            result.from   = target.color;
            result.to     = toColor;
            if (duration > 0f)
            {
                player.ResetForForwardPlaying();
                player.PlayForward();
            }
            else
            {
                player.ResetForReversePlaying();
            }
            return(result);
        }