Skip to content

Commit b20b46e

Browse files
committed
draft(animations): draft commit
ive gave up this rebuilding... too hard!
1 parent 0572bf1 commit b20b46e

18 files changed

+317
-341
lines changed

PCL.Neo/Animations/BaseAnimation.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
using Avalonia.Animation;
22
using Avalonia.Animation.Easings;
3-
using Avalonia.Threading;
43
using System;
54
using System.Threading;
65
using System.Threading.Tasks;
76

87
namespace PCL.Neo.Animations
98
{
109
public abstract class BaseAnimation(
11-
WeakReference<Animatable> control,
10+
Animatable control,
1211
double begin,
1312
double end,
1413
Easing easing,
@@ -23,7 +22,7 @@ public abstract class BaseAnimation(
2322
public bool Wait { get; } = wait;
2423

2524
private readonly CancellationTokenSource _cancellationTokenSource = new();
26-
private WeakReference<Animatable> Control { get; } = control;
25+
private Animatable Control { get; } = control;
2726
protected TimeSpan Duration { get; } = duration;
2827
protected double? Begin { get; } = begin;
2928
protected double? End { get; } = end;
@@ -36,11 +35,7 @@ public abstract class BaseAnimation(
3635
/// <inheritdoc />
3736
public async Task RunAsync()
3837
{
39-
Control.TryGetTarget(out var target);
40-
await Dispatcher.UIThread.InvokeAsync(async () =>
41-
{
42-
await AnimationBuilder().RunAsync(target, _cancellationTokenSource.Token);
43-
});
38+
await AnimationBuilder().RunAsync(Control, _cancellationTokenSource.Token);
4439
}
4540

4641
/// <inheritdoc />

PCL.Neo/Animations/MarginAnimation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace PCL.Neo.Animations
1313
/// </summary>
1414
/// <param name="begin">请自行添加 <see cref="GetCurrentMargin"/></param>
1515
public class MarginAnimation(
16-
WeakReference<Animatable> control,
16+
Animatable control,
1717
double begin,
1818
double end,
1919
Easing easing,

PCL.Neo/Animations/OpacityAnimation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace PCL.Neo.Animations
88
{
99
public class OpacityAnimation(
10-
WeakReference<Animatable> control,
10+
Animatable control,
1111
double begin,
1212
double end,
1313
Easing easing,

PCL.Neo/Animations/RotateTransformAngleAnimation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace PCL.Neo.Animations
88
{
99
public class RotateTransformAngleAnimation(
10-
WeakReference<Animatable> control,
10+
Animatable control,
1111
double begin,
1212
double end,
1313
Easing easing,

PCL.Neo/Animations/ScaleTransformScaleAnimation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace PCL.Neo.Animations
99
public record ScaleRate(double X, double Y);
1010

1111
public class ScaleTransformScaleAnimation(
12-
WeakReference<Animatable> control,
12+
Animatable control,
1313
ScaleRate begin,
1414
ScaleRate end,
1515
Easing easing,

PCL.Neo/Animations/ScaleTransformScaleXAnimation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace PCL.Neo.Animations
88
{
99
public class ScaleTransformScaleXAnimation(
10-
WeakReference<Animatable> control,
10+
Animatable control,
1111
double begin,
1212
double end,
1313
Easing easing,

PCL.Neo/Animations/ScaleTransformScaleYAnimation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace PCL.Neo.Animations
88
{
99
public class ScaleTransformScaleYAnimation(
10-
WeakReference<Animatable> control,
10+
Animatable control,
1111
double begin,
1212
double end,
1313
Easing easing,

PCL.Neo/Animations/TranslateTransformAnimation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace PCL.Neo.Animations
99
public record Pos(double X, double Y);
1010

1111
public class TranslateTransformAnimation(
12-
WeakReference<Animatable> control,
12+
Animatable control,
1313
Pos begin,
1414
Pos end,
1515
Easing easing,

PCL.Neo/Animations/TranslateTransformXAnimation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace PCL.Neo.Animations
88
{
99
public class TranslateTransformXAnimation(
10-
WeakReference<Animatable> control,
10+
Animatable control,
1111
double begin,
1212
double end,
1313
Easing easing,

PCL.Neo/Animations/TranslateTransformYAnimation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace PCL.Neo.Animations
88
{
99
public class TranslateTransformYAnimation(
10-
WeakReference<Animatable> control,
10+
Animatable control,
1111
double begin,
1212
double end,
1313
Easing easing,

0 commit comments

Comments
 (0)