mirror of
https://gitee.com/chinware/atomui.git
synced 2024-12-02 03:47:52 +08:00
Refactor SlideMotionFactory
This commit is contained in:
parent
aae49e757a
commit
4a26c737eb
@ -1,4 +1,5 @@
|
|||||||
using Avalonia;
|
using AtomUI.Controls.Primitives;
|
||||||
|
using Avalonia;
|
||||||
using Avalonia.Animation;
|
using Avalonia.Animation;
|
||||||
using Avalonia.Animation.Easings;
|
using Avalonia.Animation.Easings;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
@ -37,8 +38,8 @@ internal static partial class MotionFactory
|
|||||||
{
|
{
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 1.0
|
Value = BuildScaleXTransform(1.0)
|
||||||
};
|
};
|
||||||
startFrame.Setters.Add(scaleXSetter);
|
startFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
@ -46,8 +47,8 @@ internal static partial class MotionFactory
|
|||||||
{
|
{
|
||||||
var scaleYSetter = new Setter
|
var scaleYSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleYProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 1.0
|
Value = BuildScaleYTransform(1.0)
|
||||||
};
|
};
|
||||||
startFrame.Setters.Add(scaleYSetter);
|
startFrame.Setters.Add(scaleYSetter);
|
||||||
}
|
}
|
||||||
@ -69,8 +70,8 @@ internal static partial class MotionFactory
|
|||||||
{
|
{
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 0.0
|
Value = BuildScaleXTransform(0.0)
|
||||||
};
|
};
|
||||||
endFrame.Setters.Add(scaleXSetter);
|
endFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
@ -78,8 +79,8 @@ internal static partial class MotionFactory
|
|||||||
{
|
{
|
||||||
var scaleYSetter = new Setter
|
var scaleYSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleYProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 0.0
|
Value = BuildScaleYTransform(0.0)
|
||||||
};
|
};
|
||||||
endFrame.Setters.Add(scaleYSetter);
|
endFrame.Setters.Add(scaleYSetter);
|
||||||
}
|
}
|
||||||
@ -135,8 +136,8 @@ internal static partial class MotionFactory
|
|||||||
{
|
{
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 0.0
|
Value = BuildScaleXTransform(0.01)
|
||||||
};
|
};
|
||||||
startFrame.Setters.Add(scaleXSetter);
|
startFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
@ -144,8 +145,8 @@ internal static partial class MotionFactory
|
|||||||
{
|
{
|
||||||
var scaleYSetter = new Setter
|
var scaleYSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleYProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 0.0
|
Value = BuildScaleYTransform(0.01)
|
||||||
};
|
};
|
||||||
startFrame.Setters.Add(scaleYSetter);
|
startFrame.Setters.Add(scaleYSetter);
|
||||||
}
|
}
|
||||||
@ -167,8 +168,8 @@ internal static partial class MotionFactory
|
|||||||
{
|
{
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 1.0
|
Value = BuildScaleXTransform(1.0)
|
||||||
};
|
};
|
||||||
endFrame.Setters.Add(scaleXSetter);
|
endFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
@ -176,8 +177,8 @@ internal static partial class MotionFactory
|
|||||||
{
|
{
|
||||||
var scaleYSetter = new Setter
|
var scaleYSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleYProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 1.0
|
Value = BuildScaleYTransform(1.0)
|
||||||
};
|
};
|
||||||
endFrame.Setters.Add(scaleYSetter);
|
endFrame.Setters.Add(scaleYSetter);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ internal static partial class MotionFactory
|
|||||||
public static MotionConfig BuildSlideDownInMotion(TimeSpan duration, Easing? easing = null,
|
public static MotionConfig BuildSlideDownInMotion(TimeSpan duration, Easing? easing = null,
|
||||||
FillMode fillMode = FillMode.None)
|
FillMode fillMode = FillMode.None)
|
||||||
{
|
{
|
||||||
easing ??= new QuinticEaseOut();
|
easing ??= new CubicEaseOut();
|
||||||
var animations = new List<Animation>();
|
var animations = new List<Animation>();
|
||||||
RelativePoint transformOrigin = default;
|
RelativePoint transformOrigin = default;
|
||||||
var animation = new Animation
|
var animation = new Animation
|
||||||
@ -154,8 +154,8 @@ internal static partial class MotionFactory
|
|||||||
|
|
||||||
var scaleYSetter = new Setter
|
var scaleYSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleYProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 0.1
|
Value = BuildScaleYTransform(0.01)
|
||||||
};
|
};
|
||||||
startFrame.Setters.Add(scaleYSetter);
|
startFrame.Setters.Add(scaleYSetter);
|
||||||
}
|
}
|
||||||
@ -174,8 +174,8 @@ internal static partial class MotionFactory
|
|||||||
endFrame.Setters.Add(opacitySetter);
|
endFrame.Setters.Add(opacitySetter);
|
||||||
var scaleYSetter = new Setter
|
var scaleYSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleYProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 1.0
|
Value = BuildScaleYTransform(1.0)
|
||||||
};
|
};
|
||||||
endFrame.Setters.Add(scaleYSetter);
|
endFrame.Setters.Add(scaleYSetter);
|
||||||
}
|
}
|
||||||
@ -189,7 +189,7 @@ internal static partial class MotionFactory
|
|||||||
public static MotionConfig BuildSlideDownOutMotion(TimeSpan duration, Easing? easing = null,
|
public static MotionConfig BuildSlideDownOutMotion(TimeSpan duration, Easing? easing = null,
|
||||||
FillMode fillMode = FillMode.None)
|
FillMode fillMode = FillMode.None)
|
||||||
{
|
{
|
||||||
easing ??= new QuinticEaseIn();
|
easing ??= new CubicEaseIn();
|
||||||
var animations = new List<Animation>();
|
var animations = new List<Animation>();
|
||||||
RelativePoint transformOrigin = default;
|
RelativePoint transformOrigin = default;
|
||||||
var animation = new Animation
|
var animation = new Animation
|
||||||
@ -213,8 +213,8 @@ internal static partial class MotionFactory
|
|||||||
|
|
||||||
var scaleYSetter = new Setter
|
var scaleYSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleYProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 1.0
|
Value = BuildScaleYTransform(1.0)
|
||||||
};
|
};
|
||||||
startFrame.Setters.Add(scaleYSetter);
|
startFrame.Setters.Add(scaleYSetter);
|
||||||
}
|
}
|
||||||
@ -233,13 +233,13 @@ internal static partial class MotionFactory
|
|||||||
endFrame.Setters.Add(opacitySetter);
|
endFrame.Setters.Add(opacitySetter);
|
||||||
var scaleYSetter = new Setter
|
var scaleYSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleYProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 0.8
|
Value = BuildScaleYTransform(0.0)
|
||||||
};
|
};
|
||||||
endFrame.Setters.Add(scaleYSetter);
|
endFrame.Setters.Add(scaleYSetter);
|
||||||
}
|
}
|
||||||
animation.Children.Add(endFrame);
|
animation.Children.Add(endFrame);
|
||||||
transformOrigin = new RelativePoint(0.5, 1.0, RelativeUnit.Relative);
|
transformOrigin = new RelativePoint(1.0, 1.0, RelativeUnit.Relative);
|
||||||
|
|
||||||
animations.Add(animation);
|
animations.Add(animation);
|
||||||
return new MotionConfig(transformOrigin, animations);
|
return new MotionConfig(transformOrigin, animations);
|
||||||
@ -248,7 +248,7 @@ internal static partial class MotionFactory
|
|||||||
public static MotionConfig BuildSlideLeftInMotion(TimeSpan duration, Easing? easing = null,
|
public static MotionConfig BuildSlideLeftInMotion(TimeSpan duration, Easing? easing = null,
|
||||||
FillMode fillMode = FillMode.None)
|
FillMode fillMode = FillMode.None)
|
||||||
{
|
{
|
||||||
easing ??= new QuinticEaseOut();
|
easing ??= new CubicEaseOut();
|
||||||
var animations = new List<Animation>();
|
var animations = new List<Animation>();
|
||||||
RelativePoint transformOrigin = default;
|
RelativePoint transformOrigin = default;
|
||||||
var animation = new Animation
|
var animation = new Animation
|
||||||
@ -272,8 +272,8 @@ internal static partial class MotionFactory
|
|||||||
|
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 0.8
|
Value = BuildScaleXTransform(0.01)
|
||||||
};
|
};
|
||||||
startFrame.Setters.Add(scaleXSetter);
|
startFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
@ -292,8 +292,8 @@ internal static partial class MotionFactory
|
|||||||
endFrame.Setters.Add(opacitySetter);
|
endFrame.Setters.Add(opacitySetter);
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 1.0
|
Value = BuildScaleXTransform(1.0)
|
||||||
};
|
};
|
||||||
endFrame.Setters.Add(scaleXSetter);
|
endFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ internal static partial class MotionFactory
|
|||||||
public static MotionConfig BuildSlideLeftOutMotion(TimeSpan duration, Easing? easing = null,
|
public static MotionConfig BuildSlideLeftOutMotion(TimeSpan duration, Easing? easing = null,
|
||||||
FillMode fillMode = FillMode.None)
|
FillMode fillMode = FillMode.None)
|
||||||
{
|
{
|
||||||
easing ??= new QuinticEaseIn();
|
easing ??= new CubicEaseIn();
|
||||||
var animations = new List<Animation>();
|
var animations = new List<Animation>();
|
||||||
RelativePoint transformOrigin = default;
|
RelativePoint transformOrigin = default;
|
||||||
var animation = new Animation
|
var animation = new Animation
|
||||||
@ -331,8 +331,8 @@ internal static partial class MotionFactory
|
|||||||
|
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 1.0
|
Value = BuildScaleXTransform(1.0)
|
||||||
};
|
};
|
||||||
startFrame.Setters.Add(scaleXSetter);
|
startFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
@ -351,8 +351,8 @@ internal static partial class MotionFactory
|
|||||||
endFrame.Setters.Add(opacitySetter);
|
endFrame.Setters.Add(opacitySetter);
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 0.8
|
Value = BuildScaleXTransform(0.0)
|
||||||
};
|
};
|
||||||
endFrame.Setters.Add(scaleXSetter);
|
endFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ internal static partial class MotionFactory
|
|||||||
public static MotionConfig BuildSlideRightInMotion(TimeSpan duration, Easing? easing = null,
|
public static MotionConfig BuildSlideRightInMotion(TimeSpan duration, Easing? easing = null,
|
||||||
FillMode fillMode = FillMode.None)
|
FillMode fillMode = FillMode.None)
|
||||||
{
|
{
|
||||||
easing ??= new QuinticEaseOut();
|
easing ??= new CubicEaseOut();
|
||||||
var animations = new List<Animation>();
|
var animations = new List<Animation>();
|
||||||
RelativePoint transformOrigin = default;
|
RelativePoint transformOrigin = default;
|
||||||
var animation = new Animation
|
var animation = new Animation
|
||||||
@ -390,8 +390,8 @@ internal static partial class MotionFactory
|
|||||||
|
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 0.8
|
Value = BuildScaleXTransform(0.01)
|
||||||
};
|
};
|
||||||
startFrame.Setters.Add(scaleXSetter);
|
startFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
@ -410,8 +410,8 @@ internal static partial class MotionFactory
|
|||||||
endFrame.Setters.Add(opacitySetter);
|
endFrame.Setters.Add(opacitySetter);
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 1.0
|
Value = BuildScaleXTransform(1.0)
|
||||||
};
|
};
|
||||||
endFrame.Setters.Add(scaleXSetter);
|
endFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
@ -425,7 +425,7 @@ internal static partial class MotionFactory
|
|||||||
public static MotionConfig BuildSlideRightOutMotion(TimeSpan duration, Easing? easing = null,
|
public static MotionConfig BuildSlideRightOutMotion(TimeSpan duration, Easing? easing = null,
|
||||||
FillMode fillMode = FillMode.None)
|
FillMode fillMode = FillMode.None)
|
||||||
{
|
{
|
||||||
easing ??= new QuinticEaseIn();
|
easing ??= new CubicEaseIn();
|
||||||
var animations = new List<Animation>();
|
var animations = new List<Animation>();
|
||||||
RelativePoint transformOrigin = default;
|
RelativePoint transformOrigin = default;
|
||||||
var animation = new Animation
|
var animation = new Animation
|
||||||
@ -449,8 +449,8 @@ internal static partial class MotionFactory
|
|||||||
|
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 1.0
|
Value = BuildScaleXTransform(1.0)
|
||||||
};
|
};
|
||||||
startFrame.Setters.Add(scaleXSetter);
|
startFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
@ -469,8 +469,8 @@ internal static partial class MotionFactory
|
|||||||
endFrame.Setters.Add(opacitySetter);
|
endFrame.Setters.Add(opacitySetter);
|
||||||
var scaleXSetter = new Setter
|
var scaleXSetter = new Setter
|
||||||
{
|
{
|
||||||
Property = ScaleTransform.ScaleXProperty,
|
Property = MotionActorControl.MotionTransformProperty,
|
||||||
Value = 0.8
|
Value = BuildScaleXTransform(0.0)
|
||||||
};
|
};
|
||||||
endFrame.Setters.Add(scaleXSetter);
|
endFrame.Setters.Add(scaleXSetter);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user