/// <summary> /// Whether this tween handles rotation. /// </summary> /// <returns>A reference to this.</returns> public Tween Rotation(RotationUnit unit = RotationUnit.Degrees) { behavior |= Lerper.Behavior.Rotation; behavior |= (unit == RotationUnit.Degrees) ? Lerper.Behavior.RotationDegrees : Lerper.Behavior.RotationRadians; return(this); }
public Tween(object target, float duration, float delay, Tweener parent) { Target = target; Duration = duration; Delay = delay; Remover = parent; firstUpdate = true; varHash = new Dictionary <string, int>(); vars = new List <EaseTargetInfo>(); lerpers = new List <Lerper>(); start = new List <object>(); end = new List <object>(); behavior = Lerper.Behavior.None; }
private Tween(object target, float duration, float delay, Tween.TweenerImpl parent) { Target = target; Duration = duration; Delay = delay; Parent = parent; Remover = parent; firstUpdate = true; varHash = new Dictionary<string, int>(); vars = new List<GlideInfo>(); lerpers = new List<Lerper>(); start = new List<object>(); end = new List<object>(); behavior = Lerper.Behavior.None; }
public override object Interpolate(float t, object currentValue, Lerper.Behavior behavior) { var x = from.X + range.X * t; var y = from.Y + range.Y * t; if (behavior.HasFlag(Behavior.Round)) { x = (float)Math.Round(x); y = (float)Math.Round(y); } var current = (Vector2)currentValue; if (range.X != 0) { current.X = x; } if (range.Y != 0) { current.Y = y; } return(current); }
/// <summary> /// Whether tweened values should be rounded to integer values. /// </summary> /// <returns>A reference to this.</returns> public Tween Round() { behavior |= Lerper.Behavior.Round; return this; }
/// <summary> /// Whether this tween handles rotation. /// </summary> /// <returns>A reference to this.</returns> public Tween Rotation(RotationUnit unit = RotationUnit.Degrees) { behavior |= Lerper.Behavior.Rotation; behavior |= (unit == RotationUnit.Degrees) ? Lerper.Behavior.RotationDegrees : Lerper.Behavior.RotationRadians; return this; }
/// <summary> /// Sets the tween to reverse every other time it repeats. Repeating must be enabled for this to have any effect. /// </summary> /// <returns>A reference to this.</returns> public Tween Reflect() { behavior |= Lerper.Behavior.Reflect; return this; }
/// <summary> /// Whether tweened values should be rounded to integer values. /// </summary> /// <returns>A reference to this.</returns> public Tween Round() { behavior |= Lerper.Behavior.Round; return(this); }
/// <summary> /// Sets the tween to reverse every other time it repeats. Repeating must be enabled for this to have any effect. /// </summary> /// <returns>A reference to this.</returns> public Tween Reflect() { behavior |= Lerper.Behavior.Reflect; return(this); }
public override void Initialize(object fromValue, object toValue, Lerper.Behavior behavior) { from = (Vector2)fromValue; to = (Vector2)toValue; range = to - from; }