Beispiel #1
0
        public static TweenOperation Create(Action callback)
        {
            var state = new State()
            {
                callback = callback,
            };

            return(TweenAction <State> .Prepare(state, new TweenOptions(0)));
        }
Beispiel #2
0
        public static TweenOperation Create(TweenFunction function, float duration)
        {
            var state = new State()
            {
                function = function
            };

            return(TweenAction <State> .Prepare(state, new TweenOptions(duration)));
        }
        public static TweenOperation MoveToAsync(this Transform transform, MoveToOptions options)
        {
            var state = new State()
            {
                options = options,
                target  = transform,
            };

            return(TweenAction <State> .Prepare(state, options.tweenOptions));
        }
Beispiel #4
0
            public static TweenOperation Prepare(object target, IPropertyAccesser <TValue> property, TValue delta, TweenOptions options)
            {
                var state = new State()
                {
                    delta    = delta,
                    target   = target,
                    property = property
                };

                return(TweenAction <State> .Prepare(state, options));
            }
Beispiel #5
0
        public static TweenOperation Create(TweenOperation source, int repeatCount)
        {
            source.autoRelease = false;
            source.paused      = true;
            var state = new State()
            {
                source      = source,
                repeatCount = repeatCount
            };

            return(TweenAction <State> .Prepare(state, new TweenOptions(repeatCount *source.duration)));
        }
Beispiel #6
0
        public static TweenOperation Create(TweenOperation source)
        {
            if (source.duration <= 0)
            {
                throw new System.ArgumentException("The duration of the tween must be positive.");
            }
            source.autoRelease = false;
            source.paused      = true;
            var state = new State()
            {
                operation = source
            };

            return(TweenAction <State> .Prepare(state, new TweenOptions(float.MaxValue)));
        }
Beispiel #7
0
        private static TweenOperation CompositeInternal(List <TweenOperation> operations)
        {
            var duration = 0f;

            for (var i = 0; i < operations.Count; i++)
            {
                var op = operations[i];
                duration       = Mathf.Max(duration, op.duration);
                op.paused      = true;
                op.autoRelease = false;
            }
            var state = new State()
            {
                operations = operations
            };
            var tweenOptions = new TweenOptions(duration);

            return(TweenAction <State> .Prepare(state, tweenOptions));
        }
Beispiel #8
0
        /// <summary>
        /// operations必须是从pool中取的
        /// </summary>
        private static TweenOperation CompositeInternal(List <TweenOperation> operations)
        {
            var duration = 0f;

            for (var i = 0; i < operations.Count; i++)
            {
                var op = operations[i];
                duration      += op.duration;
                op.paused      = true;
                op.autoRelease = false;
            }
            if (duration < 0)
            {
                throw new System.InvalidOperationException("duration of tweens out of bounds");
            }
            var state = new State()
            {
                operations = operations,
            };
            var tweenOptions = new TweenOptions(duration);

            return(TweenAction <State> .Prepare(state, tweenOptions));
        }
Beispiel #9
0
        internal static TweenOperation DelayTween(float seconds)
        {
            var state = new DelayState();

            return(TweenAction <DelayState> .Prepare(state, new TweenOptions(seconds)));
        }