public override void OnInspectorGUI() { GUILayout.Space(6f); NGUIEditorTools.SetLabelWidth(120f); TweenEffectColor tw = target as TweenEffectColor; GUI.changed = false; Color from = EditorGUILayout.ColorField("From", tw.from); Color to = EditorGUILayout.ColorField("To", tw.to); if (GUI.changed) { NGUIEditorTools.RegisterUndo("Tween Change", tw); tw.from = from; tw.to = to; if (preview) { tw.Sample(tw.tweenFactor, false); } NGUITools.SetDirty(tw); } DrawCommonProperties(); }
/// <summary> /// Start the tweening operation. /// </summary> static public TweenEffectColor Begin(GameObject go, float duration, Color color) { #if UNITY_EDITOR if (!Application.isPlaying) { return(null); } #endif TweenEffectColor comp = UITweener.Begin <TweenEffectColor>(go, duration); comp.from = comp.value; comp.to = color; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return(comp); }