Exemplo n.º 1
0
 public AnimateBy(AnimatedFloat value, float by, float seconds, EaseFunction easing = null)
 {
     _value   = value;
     _by      = by;
     _seconds = seconds;
     _easing  = easing;
 }
Exemplo n.º 2
0
 public AnimateTo(AnimatedFloat value, float to, float seconds, EaseFunction easing = null)
 {
     _value   = value;
     _to      = to;
     _seconds = seconds;
     _easing  = easing;
 }
Exemplo n.º 3
0
        /* ---------------------------------------------------------------------------------------- */

        /// <param name="start">The starting value for the animated float.</param>
        /// <param name="end">The last value for the animated float.</param>
        /// <param name="speed">The speed (in seconds) it takes to go from the start value to the end value.</param>
        /// <param name="cycles">The number of animation cycles to go through. A value of 0 will cycle forever,</param>
        ///   whereas a value of 1 will go from the start position, to the end position, and back to start.
        /// <param name="offset">The number of seconds to offset the animation. Useful for offseting the animation for a series of sine behaviors.</param>
        public Sine(float start, float end, float speed = 1f, float cycles = 0f, float offset = 0f)
        {
            this.start  = start;
            this.end    = end;
            this.cycles = cycles;
            this.speed  = new AnimatedFloat(speed);

            _count    = HALF_PI + offset * (Mathf.PI / speed);          // Start at the start value plus the seconds to offset.
            _distance = (start - end) * .5f;
            _center   = end + _distance;
        }