[f-spot] missing files



commit 50ac505351f54ac1db18ba83a9bf9fa8af7bb82a
Author: Stephane Delcroix <stephane delcroix org>
Date:   Tue Apr 28 15:08:02 2009 +0200

    missing files
---
 src/Bling/EasedAnimation.cs |   49 +++++++++++++++++++++++++++++++++++++++++++
 src/Bling/EasingFunction.cs |   49 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/src/Bling/EasedAnimation.cs b/src/Bling/EasedAnimation.cs
new file mode 100644
index 0000000..036b567
--- /dev/null
+++ b/src/Bling/EasedAnimation.cs
@@ -0,0 +1,49 @@
+//
+// FSpot.Bling.EasedAnimation,cs
+//
+// Author(s):
+//	Stephane Delcroix  <stephane delcroix org>
+//
+// This is free software. See COPYING for details
+//
+
+using System;
+
+namespace FSpot.Bling
+{
+	public abstract class EasedAnimation<T>: Animation<T>
+	{
+		EasingFunction easingFunction;
+
+		public EasedAnimation () : this (null)
+		{
+		}
+
+		public EasedAnimation (EasingFunction easingFunction) : base ()
+		{
+			this.easingFunction = easingFunction;
+		}
+
+		public EasedAnimation (T from, T to, TimeSpan duration, Action<T> action) : this (from, to, duration, action, null)
+		{
+		}
+
+		public EasedAnimation (T from, T to, TimeSpan duration, Action<T> action, EasingFunction easingFunction) : base (from, to, duration, action)
+		{
+			this.easingFunction = easingFunction;
+		}
+
+		public EasingFunction EasingFunction {
+			get { return easingFunction; }
+			set { easingFunction = value; }
+		}
+
+		protected override double Ease (double normalizedTime)
+		{
+			if (easingFunction == null)
+				return base.Ease (normalizedTime);
+			return easingFunction.Ease (normalizedTime);
+		}
+
+	}
+}
diff --git a/src/Bling/EasingFunction.cs b/src/Bling/EasingFunction.cs
new file mode 100644
index 0000000..a839711
--- /dev/null
+++ b/src/Bling/EasingFunction.cs
@@ -0,0 +1,49 @@
+//
+// FSpot.Bling.EasingFunction.cs
+//
+// Author(s):
+//	Stephane Delcroix  <stephane delcroix org>
+//
+// This is free software. See COPYING for details
+//
+
+using System;
+
+namespace FSpot.Bling
+{
+	public abstract class EasingFunction
+	{
+		EasingMode easingMode;
+
+		public EasingFunction () : this (EasingMode.EaseIn)
+		{
+		}
+
+		public EasingFunction (EasingMode easingMode)
+		{
+			this.easingMode = easingMode;
+		}
+
+		public double Ease (double normalizedTime)
+		{
+			switch (easingMode) {
+			case EasingMode.EaseIn:
+				return EaseInCore (normalizedTime);
+			case EasingMode.EaseOut:
+				return 1.0 - EaseInCore (1 - normalizedTime);
+			case EasingMode.EaseInOut:
+				return (normalizedTime <= 0.5
+					? EaseInCore (normalizedTime * 2) * 0.5
+					: 1.0 - EaseInCore ((1 - normalizedTime) * 2) * 0.5);
+			}
+			throw new InvalidOperationException ("Unknown value for EasingMode");
+		}
+
+		public EasingMode EasingMode {
+			get { return easingMode; }
+			set { easingMode = value; }
+		}
+
+		protected abstract double EaseInCore (double normalizedTime);
+	}
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]