Beispiel #1
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        NGUIEditorTools.SetLabelWidth(120f);

        TweenTweener tw = target as TweenTweener;

        GUI.changed = false;

        float from = EditorGUILayout.Slider("From", tw.from, 0f, 1f);
        float to   = EditorGUILayout.Slider("To", tw.to, 0f, 1f);

        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();
    }
Beispiel #2
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public TweenTweener Begin(GameObject go, float duration, float tweener)
    {
        TweenTweener comp = UITweener.Begin <TweenTweener>(go, duration);

        comp.from = comp.value;
        comp.to   = tweener;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }