Example #1
0
		static Easing ()
		{
			BounceOut = new Easing (p => {
				if (p < (1 / 2.75f))
				{
					return 7.5625f * p * p;
				}
				else if (p < (2 / 2.75f))
				{
					p -= (1.5f / 2.75f);
					
					return 7.5625f * p * p + .75f;
				}
				else if (p < (2.5f / 2.75f))
				{
					p -= (2.25f / 2.75f);
					
					return 7.5625f * p * p + .9375f;
				}
				else
				{
					p -= (2.625f / 2.75f);
					
					return 7.5625f * p * p + .984375f;
				}
			});
			
			BounceIn = new Easing (p => 1.0f - BounceOut.Func (p));
		}
Example #2
0
		public Animation (Action<double> callback, double start = 0.0f, double end = 1.0f, Easing easing = null, Action finished = null)
		{
			children = new List<Animation> ();
			this.easing = easing ?? Easing.Linear;
			this.finished = finished;
			
			var transform = AnimationExtensions.Interpolate (start, end);
			step = f => callback (transform (f));
		}
Example #3
0
		public Animation AddConcurrent (Action<double> callback, double start = 0.0f, double end = 1.0f, Easing easing = null, double beginAt = 0.0f, double finishAt = 1.0f)
		{
			if (beginAt < 0 || beginAt > 1)
				throw new ArgumentOutOfRangeException ("beginAt");

			if (finishAt < 0 || finishAt > 1)
				throw new ArgumentOutOfRangeException ("finishAt");

			if (finishAt <= beginAt)
				throw new ArgumentException ("finishAt must be greater than beginAt");

			Animation child = new Animation (callback, start, end, easing);
			child.beginAt = beginAt;
			child.finishAt = finishAt;
			children.Add (child);
			return this;
		}
Example #4
0
		public void Commit (IAnimatable owner, string name, uint rate = 16, uint length = 250, 
		                    Easing easing = null, Action<double, bool> finished = null, Func<bool> repeat = null)
		{
			owner.Animate (name, this, rate, length, easing, finished, repeat);
		}
Example #5
0
		public Animation ()
		{
			children = new List<Animation> ();
			easing = Easing.Linear;
			step = f => {};
		}
Example #6
0
        public Animation AddConcurrent(Action <double> callback, double start = 0.0f, double end = 1.0f, Easing easing = null, double beginAt = 0.0f, double finishAt = 1.0f)
        {
            if (beginAt < 0 || beginAt > 1)
            {
                throw new ArgumentOutOfRangeException("beginAt");
            }

            if (finishAt < 0 || finishAt > 1)
            {
                throw new ArgumentOutOfRangeException("finishAt");
            }

            if (finishAt <= beginAt)
            {
                throw new ArgumentException("finishAt must be greater than beginAt");
            }

            Animation child = new Animation(callback, start, end, easing);

            child.beginAt  = beginAt;
            child.finishAt = finishAt;
            children.Add(child);
            return(this);
        }
Example #7
0
 public void Commit(IAnimatable owner, string name, uint rate = 16, uint length = 250,
                    Easing easing = null, Action <double, bool> finished        = null, Func <bool> repeat = null)
 {
     owner.Animate(name, this, rate, length, easing, finished, repeat);
 }
Example #8
0
        public Animation(Action <double> callback, double start = 0.0f, double end = 1.0f, Easing easing = null, Action finished = null)
        {
            children      = new List <Animation> ();
            this.easing   = easing ?? Easing.Linear;
            this.finished = finished;

            var transform = AnimationExtensions.Interpolate(start, end);

            step = f => callback(transform(f));
        }
Example #9
0
 public Animation()
 {
     children = new List <Animation> ();
     easing   = Easing.Linear;
     step     = f => {};
 }