Skip to content

Commit

Permalink
Obsolete CubicBezierEasing (#13137)
Browse files Browse the repository at this point in the history
#Conflicts:
#	src/Avalonia.Base/Animation/Easings/CubicBezierEasing.cs
  • Loading branch information
MrJul authored and maxkatz6 committed Dec 5, 2023
1 parent 36d17f5 commit 8d748f2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 322 deletions.
306 changes: 0 additions & 306 deletions src/Avalonia.Base/Animation/Easings/CubicBezier.cs

This file was deleted.

20 changes: 5 additions & 15 deletions src/Avalonia.Base/Animation/Easings/CubicBezierEasing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@

namespace Avalonia.Animation.Easings;

public class CubicBezierEasing : IEasing
[Obsolete("Use SplineEasing instead")]
public sealed class CubicBezierEasing : IEasing
{
private CubicBezier _bezier;
//cubic-bezier(0.25, 0.1, 0.25, 1.0)
internal CubicBezierEasing(Point controlPoint1, Point controlPoint2)
private CubicBezierEasing()
{
ControlPoint1 = controlPoint1;
ControlPoint2 = controlPoint2;
if (controlPoint1.X < 0 || controlPoint1.X > 1 || controlPoint2.X < 0 || controlPoint2.X > 1)
throw new ArgumentException();
_bezier = new CubicBezier(controlPoint1.X, controlPoint1.Y, controlPoint2.X, controlPoint2.Y);
}

public Point ControlPoint2 { get; set; }
public Point ControlPoint1 { get; set; }

internal static IEasing Ease { get; } = new CubicBezierEasing(new Point(0.25, 0.1), new Point(0.25, 1));

double IEasing.Ease(double progress)
{
return _bezier.Solve(progress);
}
}
=> throw new NotSupportedException();
}
3 changes: 2 additions & 1 deletion src/Avalonia.Base/Rendering/Composition/Compositor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Avalonia.Animation;
using Avalonia.Animation.Easings;
using Avalonia.Media;
using Avalonia.Metadata;
Expand Down Expand Up @@ -85,7 +86,7 @@ internal Compositor(IRenderLoop loop, IPlatformGraphics? gpu,
_server = new ServerCompositor(loop, gpu, _batchObjectPool, _batchMemoryPool);
_triggerCommitRequested = () => scheduler.CommitRequested(this);

DefaultEasing = new CubicBezierEasing(new Point(0.25f, 0.1f), new Point(0.25f, 1f));
DefaultEasing = new SplineEasing(new KeySpline(0.25, 0.1, 0.25, 1.0));
}

/// <summary>
Expand Down

0 comments on commit 8d748f2

Please sign in to comment.