/// <summary> /// Create a TweenSlider Component and start a tween /// </summary> /// <param name="go">GameObject to apply tween to</param> /// <param name="duration">Duration of tween</param> /// <param name="value">The ending value for the tween</param> /// <param name="finished">A optional callback to fire when the tween is done</param> /// <returns>Returns a reference to the new TweenAlpha component</returns> public static TweenSlider Tween(GameObject go, float duration, float value, UnityAction finished = null) { TweenSlider cls = TweenMain.Tween <TweenSlider>(go, duration, finished); cls.from = cls.value; cls.to = value; cls.Start(); return(cls); }
/// <summary> /// Create a TweenSlider Component and start a tween /// </summary> /// <param name="go">GameObject to apply tween to</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>Returns a reference to the new TweenAlpha component</returns> public static TweenSlider Tween(GameObject go, float duration, float fromVal, float toVal, Style style, Method method, UnityAction finished = null) { TweenSlider cls = TweenMain.Tween <TweenSlider>(go, duration, style, method, finished); cls.from = fromVal; cls.to = toVal; cls.Start(); return(cls); }
public override void OnInspectorGUI() { TweenSlider self = (TweenSlider)target; EditorGUILayout.BeginHorizontal(); self.from = EditorGUILayout.Slider("From", self.from, self.Sld.minValue, self.Sld.maxValue); 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, self.Sld.minValue, self.Sld.maxValue); if (GUILayout.Button("\u25C0", GUILayout.Width(24f))) { self.ToCurrentValue(); } EditorGUILayout.EndHorizontal(); self.toOffset = EditorGUILayout.Toggle("Offset", self.toOffset); BaseTweenerProperties(); }