Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 /// <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;
 }
Esempio n. 6
0
        /// <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;
        }
Esempio n. 7
0
 /// <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;
 }
Esempio n. 8
0
 /// <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);
 }
Esempio n. 9
0
 /// <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);
 }
Esempio n. 10
0
 public override void Initialize(object fromValue, object toValue, Lerper.Behavior behavior)
 {
     from  = (Vector2)fromValue;
     to    = (Vector2)toValue;
     range = to - from;
 }