diff --git a/samples/RenderTest/Pages/AnimationsPage.xaml b/samples/RenderTest/Pages/AnimationsPage.xaml
index 49ee20a685..38a4258a96 100644
--- a/samples/RenderTest/Pages/AnimationsPage.xaml
+++ b/samples/RenderTest/Pages/AnimationsPage.xaml
@@ -11,14 +11,21 @@
+
-
+
+
@@ -83,15 +90,17 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
@@ -105,7 +114,7 @@
-
+
diff --git a/src/Avalonia.Animation/ColorInterpolationMode.cs b/src/Avalonia.Animation/ColorInterpolationMode.cs
index bfe4e5080e..a9e31bf94f 100644
--- a/src/Avalonia.Animation/ColorInterpolationMode.cs
+++ b/src/Avalonia.Animation/ColorInterpolationMode.cs
@@ -8,7 +8,6 @@ namespace Avalonia.Animation
{
///
/// Premultiply the alpha component and interpolate from RGB color space.
- /// Fast but relatively accurate, perception-wise.
///
PremultipliedRGB,
diff --git a/src/Avalonia.Animation/Transitions/Transition.cs b/src/Avalonia.Animation/Transitions/Transition.cs
index c382118d81..df05c36eef 100644
--- a/src/Avalonia.Animation/Transitions/Transition.cs
+++ b/src/Avalonia.Animation/Transitions/Transition.cs
@@ -45,7 +45,7 @@ namespace Avalonia.Animation.Transitions
}
set
{
- if (!(typeof(T) == value.PropertyType))
+ if (!(value.PropertyType.IsAssignableFrom(typeof(T))))
throw new InvalidCastException
($"Invalid property type \"{typeof(T).Name}\" for this {GetType().Name} transition.");
diff --git a/src/Avalonia.Visuals/Animation/Transitions/ColorTransition.cs b/src/Avalonia.Visuals/Animation/Transitions/ColorTransition.cs
index 118f17a427..4954d4eac9 100644
--- a/src/Avalonia.Visuals/Animation/Transitions/ColorTransition.cs
+++ b/src/Avalonia.Visuals/Animation/Transitions/ColorTransition.cs
@@ -36,11 +36,12 @@ namespace Avalonia.Animation.Transitions
}
private ColorInterpolationMode _interpolationMode;
-
+
public override IObservable DoTransition(IObservable progress, SolidColorBrush oldValue, SolidColorBrush newValue)
{
- var oldColor = new Vector4(oldValue.Color.A, oldValue.Color.R, oldValue.Color.G, oldValue.Color.B);
- var newColor = new Vector4(newValue.Color.A, newValue.Color.R, newValue.Color.G, newValue.Color.B);
+
+ var oldColor = new Vector4(oldValue.Color.R, oldValue.Color.G, oldValue.Color.B, oldValue.Color.A);
+ var newColor = new Vector4(newValue.Color.R, newValue.Color.G, newValue.Color.B, oldValue.Color.A);
oldColor = oldColor / 255f;
newColor = newColor / 255f;
var deltaColor = newColor - oldColor;
@@ -48,10 +49,10 @@ namespace Avalonia.Animation.Transitions
switch (InterpolationMode)
{
case ColorInterpolationMode.PremultipliedRGB:
-
- var premultOV = new Vector4(1, oldColor.W, oldColor.W, oldColor.W);
- var premultNV = new Vector4(1, newColor.W, newColor.W, newColor.W);
-
+
+ var premultOV = new Vector4(oldColor.W, oldColor.W, oldColor.W, 1);
+ var premultNV = new Vector4(newColor.W, newColor.W, newColor.W, 1);
+
oldColor *= premultOV;
newColor *= premultNV;
@@ -72,10 +73,11 @@ namespace Avalonia.Animation.Transitions
return new SolidColorBrush(Color.FromVector4(interpolatedColor, true));
});
default:
- throw new NotImplementedException($"{Enum.GetName(typeof(ColorInterpolationMode), InterpolationMode)} color interpolation is not supported.");
+ throw new NotImplementedException($"'{Enum.GetName(typeof(ColorInterpolationMode), InterpolationMode)}' color interpolation is not supported.");
}
+
}
-
+
}
}