/// <summary> /// Start and add a Vector2 tween /// </summary> /// <param name="obj">Game object</param> /// <param name="key">Key</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>Vector2Tween</returns> public static Vector2Tween Tween(this GameObject obj, object key, Vector2 start, Vector2 end, float duration, Func <float, float> scaleFunc, System.Action <ITween <Vector2> > progress, System.Action <ITween <Vector2> > completion = null) { Vector2Tween t = TweenFactory.Tween(key, start, end, duration, progress, completion, scaleFunc); t.GameObject = obj; t.Renderer = obj.GetComponent <Renderer>(); return(t); }
/// <summary> /// Start and add a Vector2 tween /// </summary> /// <param name="key">Key</param> /// <param name="start">Start value</param> /// <param name="end">End value</param> /// <param name="duration">Duration in seconds</param> /// <param name="ease">Scale function</param> /// <param name="progress">Progress handler</param> /// <param name="completion">Completion handler</param> /// <returns>Vector2Tween</returns> public static Vector2Tween Tween(object key, Vector2 start, Vector2 end, float duration, System.Action <ITween <Vector2> > progress, System.Action <ITween <Vector2> > completion = null, Func <float, float> ease = null) { if (ease == null) { ease = TweenScaleFunctions.Linear; } Vector2Tween t = new Vector2Tween(); t.Key = key; t.Setup(start, end, duration, ease, progress, completion); t.Start(); AddTween(t); return(t); }