示例#1
0
        /// <summary>
        /// Stops the tween.
        /// </summary>
        /// <param name="stopBehavior">The behavior to use to handle the stop.</param>
        public void Stop(TweenStopBehavior stopBehavior)
        {
            if (state != TweenState.Stopped)
            {
                state = TweenState.Stopped;
                if (stopBehavior == TweenStopBehavior.Complete)
                {
                    currentTime = duration;
                    UpdateValue();
                    if (completionCallback != null)
                    {
                        completionCallback.Invoke(this);
                        completionCallback = null;
                    }
                    if (continueWith != null)
                    {
                        continueWith.Start();

#if IS_UNITY
                        TweenFactory.AddTween(continueWith);
#else
                        // TODO: Implement your own continueWith handling
#endif

                        continueWith = null;
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// Start and add a Quaternion tween
        /// </summary>
        /// <param name="obj">Game object</param>
        /// <param name="start">Start value</param>
        /// <param name="end">End value</param>
        /// <param name="duration">Duration in seconds</param>
        /// <param name="scaleFunc">Scale function</param>
        /// <param name="progress">Progress handler</param>
        /// <param name="completion">Completion handler</param>
        /// <returns>QuaternionTween</returns>
        public static QuaternionTween Tween(this GameObject obj, object key, Quaternion start, Quaternion end, float duration, Func <float, float> scaleFunc, System.Action <ITween <Quaternion> > progress, System.Action <ITween <Quaternion> > completion = null)
        {
            QuaternionTween t = TweenFactory.Tween(key, start, end, duration, progress, completion, scaleFunc);

            t.GameObject = obj;
            t.Renderer   = obj.GetComponent <Renderer>();
            return(t);
        }