Skip to content

Commit

Permalink
force all tweens to have a duration greater than 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcarriere committed Jun 22, 2015
1 parent 17c4157 commit c7e9971
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions Assets/Plugins/GoKit/GoTween.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,22 @@ public GoEaseType easeType
/// </summary>
public AnimationCurve easeCurve { get; set; }

/// <summary>
/// initializes a new instance and sets up the details according to the config parameter
/// </summary>
public GoTween( object target, float duration, GoTweenConfig config, Action<AbstractGoTween> onComplete = null )
{
// default to removing on complete
autoRemoveOnComplete = true;
/// <summary>
/// initializes a new instance and sets up the details according to the config parameter
/// </summary>
public GoTween( object target, float duration, GoTweenConfig config, Action<AbstractGoTween> onComplete = null )
{
// all tweens must be intialized to have a duration greater than zero. keep in mind that this will ensure
// the tween occurs over two frames: the initialized value, and the final value. if you are looking for a
// tween to reach the end of it's tween immediately, be sure to call complete() on it after creation.
if( duration <= 0 )
{
duration = float.Epsilon;
Debug.LogError( "tween duration must be greater than 0. coerced to float.Epsilon." );
}

// default to removing on complete
autoRemoveOnComplete = true;

// allow events by default
allowEvents = true;
Expand Down

0 comments on commit c7e9971

Please sign in to comment.