示例#1
0
        /// <summary>
        /// Create a TweenCGAlpha Component and start a tween
        /// </summary>
        /// <param name="go">GameObject to apply tween too</param>
        /// <param name="duration">Duration of tween</param>
        /// <param name="alpha">The ending value for the tween</param>
        /// <param name="finished">A optional Callback to fire when the tween is done</param>
        /// <returns>Return reference to the new TweenCGAlpha component</returns>
        public static TweenCGAlpha Tween(GameObject go, float duration, float alpha, UnityAction finished = null)
        {
            TweenCGAlpha cls = TweenMain.Tween <TweenCGAlpha>(go, duration, finished);

            cls.from = cls.value;
            cls.to   = alpha;
            cls.Start();
            return(cls);
        }
示例#2
0
        /// <summary>
        /// Create a TweenCGAlpha Componet and start the tween.
        /// </summary>
        /// <param name="go">GameObject to Apply the tween too</param>
        /// <param name="duration">How long the tween will take</param>
        /// <param name="alpha">The final Value at the end of the tween</param>
        /// <param name="method">The tweening method</parm>
        /// <param name="finished">The method execute at the end of the tween</param>
        /// <returns>Reference to the TweenCGAlpha component</returns>
        public static TweenCGAlpha Tween(GameObject go, float duration, float alpha,
                                         Style style = Style.Once, Method method = Method.Linear, UnityAction finished = null)
        {
            TweenCGAlpha cls = TweenMain.Tween <TweenCGAlpha>(go, duration, style, method, finished);

            cls.from = cls.value;
            cls.to   = alpha;
            cls.Start();
            return(cls);
        }
示例#3
0
        /// <summary>
        /// Create a TweenCGAlpha Component and start a tween
        /// </summary>
        /// <param name="go">GameObject to apply tween too</param>
        /// <param name="duration">Duration of tween</param>
        /// <param name="fromVal">The starting value for the tween</param>
        /// <param name="toVal">The ending value for the tween</param>
        /// <param name="style">The style of tween (Once, Looped, PingPong)</param>
        /// <param name="method">The Interpolation method of the tween</param>
        /// <param name="finished">A optional Callback to fire when the tween is done</param>
        /// <returns>Return reference to the new TweenCGAlpha component</returns>
        public static TweenCGAlpha Tween(GameObject go, float duration, float fromVal, float toVal,
                                         Style style, Method method, UnityAction finished = null)
        {
            TweenCGAlpha cls = TweenMain.Tween <TweenCGAlpha>(go, duration, style, method, finished);

            cls.from = fromVal;
            cls.to   = toVal;
            cls.Start();
            return(cls);
        }
        public override void OnInspectorGUI()
        {
            TweenCGAlpha self = (TweenCGAlpha)target;

            EditorGUILayout.BeginHorizontal();
            self.from = EditorGUILayout.Slider("From", self.from, 0f, 1f);
            if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
            {
                self.FromCurrentValue();
            }
            EditorGUILayout.EndHorizontal();
            self.fromOffset = EditorGUILayout.Toggle("Offset", self.fromOffset);

            EditorGUILayout.BeginHorizontal();
            self.to = EditorGUILayout.Slider("To", self.to, 0f, 1f);
            if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
            {
                self.ToCurrentValue();
            }
            EditorGUILayout.EndHorizontal();
            self.toOffset = EditorGUILayout.Toggle("Offset", self.toOffset);

            BaseTweenerProperties();
        }