-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathScaleTransition.cs
39 lines (34 loc) · 1.05 KB
/
ScaleTransition.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Media;
using Avalonia.Styling;
using SecureFolderFS.AvaloniaUI.Extensions;
namespace SecureFolderFS.AvaloniaUI.Animations.Transitions
{
internal class ScaleTransition : Transition
{
public Point From { get; set; }
public Point To { get; set; }
public ScaleTransition()
{
From = new(1, 1);
To = new(1, 1);
}
protected override Task RunAnimationAsync(Visual target)
{
target.GetTransform<ScaleTransform>();
var animation = GetBaseAnimation();
animation.From = new()
{
new Setter(ScaleTransform.ScaleXProperty, From.X),
new Setter(ScaleTransform.ScaleYProperty, From.Y)
};
animation.To = new()
{
new Setter(ScaleTransform.ScaleXProperty, To.X),
new Setter(ScaleTransform.ScaleYProperty, To.Y)
};
return animation.RunAnimationAsync();
}
}
}