check point
This commit is contained in:
53
framework/MaterialSkin.Core/Animations/Animations.cs
Normal file
53
framework/MaterialSkin.Core/Animations/Animations.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
|
||||
namespace MaterialSkin.Animations
|
||||
{
|
||||
enum AnimationType
|
||||
{
|
||||
Linear,
|
||||
EaseInOut,
|
||||
EaseOut,
|
||||
CustomQuadratic
|
||||
}
|
||||
|
||||
static class AnimationLinear
|
||||
{
|
||||
public static double CalculateProgress(double progress)
|
||||
{
|
||||
return progress;
|
||||
}
|
||||
}
|
||||
|
||||
static class AnimationEaseInOut
|
||||
{
|
||||
public static double PI = Math.PI;
|
||||
public static double PI_HALF = Math.PI / 2;
|
||||
|
||||
public static double CalculateProgress(double progress)
|
||||
{
|
||||
return EaseInOut(progress);
|
||||
}
|
||||
|
||||
private static double EaseInOut(double s)
|
||||
{
|
||||
return s - Math.Sin(s * 2 * PI) / (2 * PI);
|
||||
}
|
||||
}
|
||||
|
||||
public static class AnimationEaseOut
|
||||
{
|
||||
public static double CalculateProgress(double progress)
|
||||
{
|
||||
return -1 * progress * (progress - 2);
|
||||
}
|
||||
}
|
||||
|
||||
public static class AnimationCustomQuadratic
|
||||
{
|
||||
public static double CalculateProgress(double progress)
|
||||
{
|
||||
var kickoff = 0.6;
|
||||
return 1 - Math.Cos((Math.Max(progress, kickoff) - kickoff) * Math.PI / (2 - (2 * kickoff)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user