diff --git a/src/Avalonia.Visuals/Animation/CompositeTransition.cs b/src/Avalonia.Visuals/Animation/CompositePageTransition.cs
similarity index 85%
rename from src/Avalonia.Visuals/Animation/CompositeTransition.cs
rename to src/Avalonia.Visuals/Animation/CompositePageTransition.cs
index 62ed9d5bc1..46bbb0bed2 100644
--- a/src/Avalonia.Visuals/Animation/CompositeTransition.cs
+++ b/src/Avalonia.Visuals/Animation/CompositePageTransition.cs
@@ -6,28 +6,28 @@ using Avalonia.Metadata;
namespace Avalonia.Animation
{
///
- /// Defines a composite transition that can be used to combine multiple transitions into one.
+ /// Defines a composite page transition that can be used to combine multiple transitions.
///
///
///
- /// Instantiate the in XAML and initialize the
+ /// Instantiate the in XAML and initialize the
/// property in order to have many animations triggered at once.
/// For example, you can combine and .
///
///
///
- ///
+ ///
///
///
- ///
+ ///
///
///
/// ]]>
///
///
///
- public class CompositeTransition : IPageTransition
+ public class CompositePageTransition : IPageTransition
{
///
/// Gets or sets the transitions to be executed. Can be defined from XAML.
diff --git a/src/Avalonia.Visuals/Animation/CrossFade.cs b/src/Avalonia.Visuals/Animation/CrossFade.cs
index 640f401418..2ba9f6aeba 100644
--- a/src/Avalonia.Visuals/Animation/CrossFade.cs
+++ b/src/Avalonia.Visuals/Animation/CrossFade.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Avalonia.Animation.Easings;
using Avalonia.Styling;
using Avalonia.VisualTree;
@@ -74,14 +75,26 @@ namespace Avalonia.Animation
///
public TimeSpan Duration
{
- get
- {
- return _fadeOutAnimation.Duration;
- }
- set
- {
- _fadeOutAnimation.Duration = _fadeInAnimation.Duration = value;
- }
+ get => _fadeOutAnimation.Duration;
+ set => _fadeOutAnimation.Duration = _fadeInAnimation.Duration = value;
+ }
+
+ ///
+ /// Gets or sets element entrance easing.
+ ///
+ public Easing EntranceEasing
+ {
+ get => _fadeInAnimation.Easing;
+ set => _fadeInAnimation.Easing = value;
+ }
+
+ ///
+ /// Gets or sets element exit easing.
+ ///
+ public Easing ExitEasing
+ {
+ get => _fadeOutAnimation.Easing;
+ set => _fadeOutAnimation.Easing = value;
}
///
diff --git a/src/Avalonia.Visuals/Animation/PageSlide.cs b/src/Avalonia.Visuals/Animation/PageSlide.cs
index 501c8c0ba4..b545385ad6 100644
--- a/src/Avalonia.Visuals/Animation/PageSlide.cs
+++ b/src/Avalonia.Visuals/Animation/PageSlide.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Avalonia.Animation.Easings;
using Avalonia.Media;
using Avalonia.Styling;
using Avalonia.VisualTree;
@@ -48,6 +49,16 @@ namespace Avalonia.Animation
/// Gets the duration of the animation.
///
public SlideAxis Orientation { get; set; }
+
+ ///
+ /// Gets or sets element entrance easing.
+ ///
+ public Easing EntranceEasing { get; set; } = new LinearEasing();
+
+ ///
+ /// Gets or sets element exit easing.
+ ///
+ public Easing ExitEasing { get; set; } = new LinearEasing();
///
/// Starts the animation.
@@ -75,18 +86,12 @@ namespace Avalonia.Animation
{
var animation = new Animation
{
- Children =
+ Easing = ExitEasing,
+ Children =
{
new KeyFrame
{
- Setters =
- {
- new Setter
- {
- Property = translateProperty,
- Value = 0d
- }
- },
+ Setters = { new Setter { Property = translateProperty, Value = 0d } },
Cue = new Cue(0d)
},
new KeyFrame
@@ -100,10 +105,10 @@ namespace Avalonia.Animation
}
},
Cue = new Cue(1d)
- }
- }
+ }
+ },
+ Duration = Duration
};
- animation.Duration = Duration;
tasks.Add(animation.RunAsync(from));
}
@@ -112,9 +117,9 @@ namespace Avalonia.Animation
to.IsVisible = true;
var animation = new Animation
{
+ Easing = EntranceEasing,
Children =
{
-
new KeyFrame
{
Setters =
@@ -129,19 +134,12 @@ namespace Avalonia.Animation
},
new KeyFrame
{
- Setters =
- {
- new Setter
- {
- Property = translateProperty,
- Value = 0d
- }
- },
+ Setters = { new Setter { Property = translateProperty, Value = 0d } },
Cue = new Cue(1d)
}
- }
+ },
+ Duration = Duration
};
- animation.Duration = Duration;
tasks.Add(animation.RunAsync(to));
}