mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-29 07:16:33 +08:00
Refactor motion definitions
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<PackageVersion Include="AtomUI.Controls.DataGrid" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="Avalonia.Win32" Version="$(AvaloniaVersion)"/>
|
||||
|
||||
<PackageVersion Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="AtomUI" Version="$(AtomUIVersion)"/>
|
||||
|
||||
<!-- TODO 版本是否跟随 AvaloniaVersion?-->
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using Avalonia.Animation;
|
||||
|
||||
namespace AtomUI.Animations;
|
||||
|
||||
public class TransitionCompletedEventArgs : EventArgs
|
||||
@@ -10,7 +12,7 @@ public class TransitionCompletedEventArgs : EventArgs
|
||||
}
|
||||
}
|
||||
|
||||
internal interface INotifyTransitionCompleted
|
||||
public interface INotifyTransitionCompleted : ITransition
|
||||
{
|
||||
public IObservable<bool> CompletedObservable { get; }
|
||||
public event EventHandler<TransitionCompletedEventArgs>? TransitionCompleted;
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Immutable;
|
||||
|
||||
namespace AtomUI.Animations;
|
||||
|
||||
public class SolidColorBrushTransition : InterpolatingTransitionBase<ISolidColorBrush?>
|
||||
public class SolidColorBrushTransition : InterpolatingTransitionBase<IBrush?>
|
||||
{
|
||||
protected override ISolidColorBrush? Interpolate(double progress, ISolidColorBrush? from, ISolidColorBrush? to)
|
||||
protected override IBrush? Interpolate(double progress, IBrush? from, IBrush? to)
|
||||
{
|
||||
return InterpolateUtils.SolidColorBrushInterpolate(progress, from, to);
|
||||
if (from is ISolidColorBrush fromBrush && to is ISolidColorBrush toBrush)
|
||||
{
|
||||
return InterpolateUtils.SolidColorBrushInterpolate(progress, fromBrush, toBrush);
|
||||
}
|
||||
return InterpolateUtils.BrushInterpolate(progress, from, to);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia"/>
|
||||
<PackageReference Include="Avalonia.ReactiveUI"/>
|
||||
<PackageReference Include="System.Reactive"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using Avalonia;
|
||||
using System.Reactive.Linq;
|
||||
using AtomUI.Animations;
|
||||
using Avalonia;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Animation.Easings;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media.Transformation;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.Threading;
|
||||
|
||||
namespace AtomUI.MotionScene;
|
||||
@@ -11,6 +14,7 @@ public class AbstractMotion : IMotion
|
||||
{
|
||||
public RelativePoint RenderTransformOrigin { get; protected set; }
|
||||
public IList<Animation> Animations { get; }
|
||||
public IList<INotifyTransitionCompleted> Transitions { get; }
|
||||
public TimeSpan Duration { get; }
|
||||
public Easing Easing { get; }
|
||||
public FillMode PropertyValueFillMode { get; }
|
||||
@@ -21,6 +25,7 @@ public class AbstractMotion : IMotion
|
||||
Duration = duration;
|
||||
Easing = easing ?? new LinearEasing();
|
||||
PropertyValueFillMode = fillMode;
|
||||
Transitions = new List<INotifyTransitionCompleted>();
|
||||
}
|
||||
|
||||
public async Task RunAsync(MotionActorControl actor,
|
||||
@@ -48,11 +53,76 @@ public class AbstractMotion : IMotion
|
||||
completedAction?.Invoke();
|
||||
});
|
||||
}
|
||||
|
||||
internal void RunTransitions(MotionActorControl actor,
|
||||
Action? aboutToStart = null,
|
||||
Action? completedAction = null)
|
||||
{
|
||||
ConfigureTransitions();
|
||||
using var originRestore = new RenderTransformOriginRestore(actor);
|
||||
actor.NotifyMotionPreStart();
|
||||
NotifyPreStart();
|
||||
aboutToStart?.Invoke();
|
||||
|
||||
actor.RenderTransformOrigin = RenderTransformOrigin;
|
||||
var observables = new List<IObservable<bool>>();
|
||||
|
||||
// 暂时先不保存 actor 原有的 transitions
|
||||
actor.Transitions ??= new Transitions();
|
||||
actor.Transitions.Clear();
|
||||
foreach (var transition in Transitions)
|
||||
{
|
||||
observables.Add(transition.CompletedObservable);
|
||||
actor.Transitions.Add(transition);
|
||||
}
|
||||
|
||||
actor.DisableTransitions();
|
||||
ConfigureMotionStartValue(actor);
|
||||
actor.EnableTransitions();
|
||||
ConfigureMotionEndValue(actor);
|
||||
|
||||
observables.Zip()
|
||||
.LastAsync()
|
||||
.ObserveOn(AvaloniaScheduler.Instance)
|
||||
.Subscribe((v) =>
|
||||
{
|
||||
actor.NotifyMotionCompleted();
|
||||
NotifyCompleted();
|
||||
completedAction?.Invoke();
|
||||
});
|
||||
}
|
||||
|
||||
protected virtual void Configure()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void ConfigureTransitions()
|
||||
{
|
||||
var opacityTransition = new NotifiableDoubleTransition()
|
||||
{
|
||||
Duration = Duration,
|
||||
Easing = Easing,
|
||||
Property = MotionActorControl.OpacityProperty,
|
||||
};
|
||||
Transitions.Add(opacityTransition);
|
||||
|
||||
var transformOperationsTransition = new NotifiableTransformOperationsTransition()
|
||||
{
|
||||
Duration = Duration,
|
||||
Easing = Easing,
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
};
|
||||
Transitions.Add(transformOperationsTransition);
|
||||
}
|
||||
|
||||
protected virtual void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void NotifyPreStart()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -18,75 +18,9 @@ public class CollapseMotion : AbstractMotion
|
||||
Direction = direction;
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var isHorizontal = Direction == Direction.Left || Direction == Direction.Right;
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
if (isHorizontal)
|
||||
{
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
else
|
||||
{
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
if (isHorizontal)
|
||||
{
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(0.0)
|
||||
};
|
||||
endFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
else
|
||||
{
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(0.0)
|
||||
};
|
||||
endFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
|
||||
base.ConfigureTransitions();
|
||||
if (Direction == Direction.Left)
|
||||
{
|
||||
RenderTransformOrigin = new RelativePoint(1, 0.5, RelativeUnit.Relative);
|
||||
@@ -103,8 +37,34 @@ public class CollapseMotion : AbstractMotion
|
||||
{
|
||||
RenderTransformOrigin = new RelativePoint(0.5, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
var isHorizontal = Direction == Direction.Left || Direction == Direction.Right;
|
||||
actor.Opacity = 1.0;
|
||||
if (isHorizontal)
|
||||
{
|
||||
actor.MotionTransform = BuildScaleXTransform(1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
actor.MotionTransform = BuildScaleYTransform(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
var isHorizontal = Direction == Direction.Left || Direction == Direction.Right;
|
||||
actor.Opacity = 0.0;
|
||||
if (isHorizontal)
|
||||
{
|
||||
actor.MotionTransform = BuildScaleXTransform(0.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
actor.MotionTransform = BuildScaleYTransform(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,76 +80,10 @@ public class ExpandMotion : AbstractMotion
|
||||
{
|
||||
Direction = direction;
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var isHorizontal = Direction == Direction.Left || Direction == Direction.Right;
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
if (isHorizontal)
|
||||
{
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(0.01)
|
||||
};
|
||||
startFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
else
|
||||
{
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(0.01)
|
||||
};
|
||||
startFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
if (isHorizontal)
|
||||
{
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
else
|
||||
{
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
}
|
||||
|
||||
animation.Children.Add(endFrame);
|
||||
|
||||
base.ConfigureTransitions();
|
||||
if (Direction == Direction.Left)
|
||||
{
|
||||
RenderTransformOrigin = new RelativePoint(1.0, 0.5, RelativeUnit.Relative);
|
||||
@@ -207,6 +101,33 @@ public class ExpandMotion : AbstractMotion
|
||||
RenderTransformOrigin = new RelativePoint(0.5, 1.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
var isHorizontal = Direction == Direction.Left || Direction == Direction.Right;
|
||||
actor.Opacity = 0.0;
|
||||
if (isHorizontal)
|
||||
{
|
||||
actor.MotionTransform = BuildScaleXTransform(0.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
actor.MotionTransform = BuildScaleYTransform(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
var isHorizontal = Direction == Direction.Left || Direction == Direction.Right;
|
||||
actor.Opacity = 1.0;
|
||||
if (isHorizontal)
|
||||
{
|
||||
actor.MotionTransform = BuildScaleXTransform(1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
actor.MotionTransform = BuildScaleYTransform(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,40 +13,21 @@ public class FadeInMotion : AbstractMotion
|
||||
: base(duration, easing ?? new LinearEasing(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,39 +39,20 @@ public class FadeOutMotion : AbstractMotion
|
||||
: base(duration, easing ?? new LinearEasing(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Avalonia;
|
||||
using AtomUI.Animations;
|
||||
using Avalonia;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Animation.Easings;
|
||||
|
||||
@@ -8,6 +9,7 @@ internal interface IMotion
|
||||
{
|
||||
public RelativePoint RenderTransformOrigin { get; }
|
||||
public IList<Animation> Animations { get; }
|
||||
public IList<INotifyTransitionCompleted> Transitions { get; }
|
||||
public TimeSpan Duration { get; }
|
||||
public Easing Easing { get; }
|
||||
public FillMode PropertyValueFillMode { get; }
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Transformation;
|
||||
|
||||
namespace AtomUI.MotionScene;
|
||||
|
||||
@@ -10,13 +9,13 @@ public class MotionActorControl : Decorator
|
||||
{
|
||||
#region 公共属性定义
|
||||
|
||||
public static readonly StyledProperty<TransformOperations?> MotionTransformProperty =
|
||||
AvaloniaProperty.Register<MotionActorControl, TransformOperations?>(nameof(MotionTransform));
|
||||
public static readonly StyledProperty<ITransform?> MotionTransformProperty =
|
||||
AvaloniaProperty.Register<MotionActorControl, ITransform?>(nameof(MotionTransform));
|
||||
|
||||
public static readonly StyledProperty<bool> UseRenderTransformProperty =
|
||||
AvaloniaProperty.Register<MotionActorControl, bool>(nameof(UseRenderTransform));
|
||||
|
||||
public TransformOperations? MotionTransform
|
||||
public ITransform? MotionTransform
|
||||
{
|
||||
get => GetValue(MotionTransformProperty);
|
||||
set => SetValue(MotionTransformProperty, value);
|
||||
|
||||
@@ -8,20 +8,15 @@ internal static class MotionInvoker
|
||||
public static void Invoke(MotionActorControl actor,
|
||||
AbstractMotion motion,
|
||||
Action? aboutToStart = null,
|
||||
Action? completedAction = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
Action? completedAction = null)
|
||||
{
|
||||
Dispatcher.UIThread.Invoke(async () =>
|
||||
{
|
||||
await motion.RunAsync(actor, aboutToStart, completedAction, cancellationToken);
|
||||
});
|
||||
motion.RunTransitions(actor, aboutToStart, completedAction);
|
||||
}
|
||||
|
||||
public static void DispatchInMotionSceneLayer(SceneMotionActorControl actor,
|
||||
public static void DispatchMotionInSceneLayer(SceneMotionActorControl actor,
|
||||
AbstractMotion motion,
|
||||
Action? aboutToStart = null,
|
||||
Action? completedAction = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
Action? completedAction = null)
|
||||
{
|
||||
var sceneLayer = PrepareSceneLayer(motion, actor);
|
||||
var compositeDisposable = new CompositeDisposable();
|
||||
@@ -38,60 +33,11 @@ internal static class MotionInvoker
|
||||
actor.NotifySceneShowed();
|
||||
aboutToStart?.Invoke();
|
||||
// 等待一个事件循环,让动画窗口置顶
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
motion.RunTransitions(actor, null, () =>
|
||||
{
|
||||
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
await motion.RunAsync(actor, () =>
|
||||
{
|
||||
actor.IsVisible = true;
|
||||
}, () =>
|
||||
{
|
||||
completedAction?.Invoke();
|
||||
Dispatcher.UIThread.Post(() => actor.Opacity = 0d);
|
||||
}, cancellationToken);
|
||||
DispatcherTimer.RunOnce(() =>
|
||||
{
|
||||
compositeDisposable.Dispose();
|
||||
compositeDisposable = null;
|
||||
}, TimeSpan.FromMilliseconds(600));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static void DispatchOutMotionSceneLayer(SceneMotionActorControl actor,
|
||||
AbstractMotion motion,
|
||||
Action? aboutToStart = null,
|
||||
Action? completedAction = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var sceneLayer = PrepareSceneLayer(motion, actor);
|
||||
var compositeDisposable = new CompositeDisposable();
|
||||
compositeDisposable.Add(Disposable.Create(sceneLayer, (state) =>
|
||||
{
|
||||
sceneLayer.Hide();
|
||||
sceneLayer.Dispose();
|
||||
}));
|
||||
sceneLayer.SetMotionActor(actor);
|
||||
actor.NotifyMotionTargetAddedToScene();
|
||||
sceneLayer.Topmost = true;
|
||||
sceneLayer.Show();
|
||||
actor.NotifySceneShowed();
|
||||
aboutToStart?.Invoke();
|
||||
// 等待一个事件循环,让动画窗口置顶
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
// 主要等待正常窗体显示出来再隐藏对话层,不然感觉会闪屏
|
||||
await motion.RunAsync(actor, null, () =>
|
||||
{
|
||||
completedAction?.Invoke();
|
||||
Dispatcher.UIThread.Post(() => actor.IsVisible = false);
|
||||
}, cancellationToken);
|
||||
compositeDisposable.Dispose();
|
||||
compositeDisposable = null;
|
||||
});
|
||||
completedAction?.Invoke();
|
||||
compositeDisposable.Dispose();
|
||||
compositeDisposable = null;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -17,75 +17,23 @@ public class MoveDownInMotion : AbstractMotion
|
||||
{
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, Offset)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var middleFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.8)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
middleFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, Offset / 4)
|
||||
};
|
||||
middleFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(middleFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, Offset);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
internal override Size CalculateSceneSize(Size actorSize)
|
||||
@@ -111,76 +59,23 @@ public class MoveDownOutMotion : AbstractMotion
|
||||
{
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0)
|
||||
};
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var middleFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.8)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
middleFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, Offset / 4)
|
||||
};
|
||||
middleFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(middleFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, Offset)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
RenderTransformOrigin = new RelativePoint(0, 0, RelativeUnit.Relative);
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, Offset);
|
||||
}
|
||||
|
||||
internal override Size CalculateSceneSize(Size actorSize)
|
||||
@@ -201,75 +96,23 @@ public class MoveUpInMotion : AbstractMotion
|
||||
{
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 0.01, 0.0, -Offset)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var middleFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.8)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
middleFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, -Offset / 4)
|
||||
};
|
||||
middleFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(middleFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 0.01, 0.0, -Offset);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
internal override Size CalculateSceneSize(Size actorSize)
|
||||
@@ -295,78 +138,23 @@ public class MoveUpOutMotion : AbstractMotion
|
||||
{
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0)
|
||||
};
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var middleFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.8)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
middleFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, -Offset / 4)
|
||||
};
|
||||
|
||||
middleFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(middleFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, -Offset)
|
||||
};
|
||||
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
RenderTransformOrigin = new RelativePoint(0, 0, RelativeUnit.Relative);
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, -Offset);
|
||||
}
|
||||
|
||||
internal override Size CalculateSceneSize(Size actorSize)
|
||||
@@ -387,78 +175,23 @@ public class MoveLeftInMotion : AbstractMotion
|
||||
{
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, -Offset, 0.0)
|
||||
};
|
||||
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var middleFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.8)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
middleFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, -Offset / 2, 0.0)
|
||||
};
|
||||
|
||||
middleFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(middleFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0)
|
||||
};
|
||||
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, -Offset, 0.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
internal override Size CalculateSceneSize(Size actorSize)
|
||||
@@ -485,75 +218,24 @@ public class MoveLeftOutMotion : AbstractMotion
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var middleFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.8)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
middleFrame.Setters.Add(opacitySetter);
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, -Offset / 2, 0.0)
|
||||
};
|
||||
middleFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(middleFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, -Offset, 0.0)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
RenderTransformOrigin = new RelativePoint(0, 0, RelativeUnit.Relative);
|
||||
|
||||
Animations.Add(animation);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, -Offset, 0.0);
|
||||
}
|
||||
|
||||
internal override Size CalculateSceneSize(Size actorSize)
|
||||
{
|
||||
return actorSize.WithHeight(actorSize.Width * 2);
|
||||
@@ -572,76 +254,23 @@ public class MoveRightInMotion : AbstractMotion
|
||||
{
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, Offset, 0.0)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var middleFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.8)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
middleFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, Offset / 2, 0.0)
|
||||
};
|
||||
middleFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(middleFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, Offset, 0.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
internal override Size CalculateSceneSize(Size actorSize)
|
||||
@@ -667,75 +296,23 @@ public class MoveRightOutMotion : AbstractMotion
|
||||
{
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
var middleFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.8)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
middleFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, Offset / 2, 0.0)
|
||||
};
|
||||
middleFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(middleFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildTranslateScaleAndTransform(1.0, 1.0, Offset, 0.0)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
RenderTransformOrigin = new RelativePoint(0, 0, RelativeUnit.Relative);
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildTranslateScaleAndTransform(1.0, 1.0, Offset, 0.0);
|
||||
}
|
||||
|
||||
internal override Size CalculateSceneSize(Size actorSize)
|
||||
|
||||
@@ -14,51 +14,22 @@ public class SlideUpInMotion : AbstractMotion
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(0.01) // 不知道为啥设置成 0.0, 子元素渲染不正常
|
||||
};
|
||||
startFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleYTransform(0.8); // 不知道为啥设置成 0.0, 子元素渲染不正常;
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleYTransform(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,52 +42,22 @@ public class SlideUpOutMotion : AbstractMotion
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(0.0)
|
||||
};
|
||||
endFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleYTransform(1.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleYTransform(0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,52 +70,22 @@ public class SlideDownInMotion : AbstractMotion
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(0.01)
|
||||
};
|
||||
startFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(1.0, 1.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleYTransform(0.8);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleYTransform(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,52 +98,22 @@ public class SlideDownOutMotion : AbstractMotion
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
var scaleYSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleYTransform(0.8)
|
||||
};
|
||||
endFrame.Setters.Add(scaleYSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(1.0, 1.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleYTransform(1.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleYTransform(0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,53 +125,23 @@ public class SlideLeftInMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CubicEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(0.01)
|
||||
};
|
||||
startFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleXTransform(0.8);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleXTransform(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,52 +154,22 @@ public class SlideLeftOutMotion : AbstractMotion
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(0.8)
|
||||
};
|
||||
endFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleXTransform(1.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleXTransform(0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,52 +182,22 @@ public class SlideRightInMotion : AbstractMotion
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(0.01)
|
||||
};
|
||||
startFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(1.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleXTransform(0.8);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleXTransform(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,51 +210,21 @@ public class SlideRightOutMotion : AbstractMotion
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
var scaleXSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleXTransform(0.8)
|
||||
};
|
||||
endFrame.Setters.Add(scaleXSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(1.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleXTransform(1.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleXTransform(0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,54 +13,23 @@ internal class ZoomInMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CircularEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.01)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.2);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,54 +41,23 @@ public class ZoomOutMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CircularEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.01)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,53 +70,22 @@ public class ZoomBigInMotion : AbstractMotion
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.85);
|
||||
}
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.85)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
RenderTransformOrigin = new RelativePoint(1.0, 1.0, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,54 +97,23 @@ public class ZoomBigOutMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CircularEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.0, RelativeUnit.Relative);
|
||||
}
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.85)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
RenderTransformOrigin = new RelativePoint(1.0, 1.0, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.85);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,54 +125,23 @@ public class ZoomUpInMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CircularEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.01)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.5, 0.0, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.8);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,54 +153,23 @@ public class ZoomUpOutMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CircularEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.01)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.5, 0.0, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,54 +181,23 @@ public class ZoomLeftInMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CircularEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.01)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.5, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.8);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,54 +209,23 @@ public class ZoomLeftOutMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CircularEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.01)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.0, 0.5, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,54 +237,23 @@ public class ZoomRightInMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CircularEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.01)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(1.0, 0.5, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.8);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,54 +265,23 @@ public class ZoomRightOutMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CircularEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.01)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(1.0, 0.5, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -603,54 +293,23 @@ public class ZoomDownInMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CircularEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.1
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.01)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.5, 1.0, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.8);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -662,53 +321,22 @@ public class ZoomDownOutMotion : AbstractMotion
|
||||
: base(duration, easing ?? new CircularEaseOut(), fillMode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure()
|
||||
|
||||
protected override void ConfigureTransitions()
|
||||
{
|
||||
var animation = CreateAnimation();
|
||||
|
||||
var startFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(0.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 1.0
|
||||
};
|
||||
startFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(1.0)
|
||||
};
|
||||
startFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(startFrame);
|
||||
|
||||
var endFrame = new KeyFrame
|
||||
{
|
||||
Cue = new Cue(1.0)
|
||||
};
|
||||
{
|
||||
var opacitySetter = new Setter
|
||||
{
|
||||
Property = Visual.OpacityProperty,
|
||||
Value = 0.0
|
||||
};
|
||||
endFrame.Setters.Add(opacitySetter);
|
||||
|
||||
var transformSetter = new Setter
|
||||
{
|
||||
Property = MotionActorControl.MotionTransformProperty,
|
||||
Value = BuildScaleTransform(0.01)
|
||||
};
|
||||
endFrame.Setters.Add(transformSetter);
|
||||
}
|
||||
animation.Children.Add(endFrame);
|
||||
base.ConfigureTransitions();
|
||||
RenderTransformOrigin = new RelativePoint(0.5, 1.0, RelativeUnit.Relative);
|
||||
Animations.Add(animation);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionStartValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 1.0;
|
||||
actor.MotionTransform = BuildScaleTransform(1.0);
|
||||
}
|
||||
|
||||
protected override void ConfigureMotionEndValue(MotionActorControl actor)
|
||||
{
|
||||
actor.Opacity = 0.0;
|
||||
actor.MotionTransform = BuildScaleTransform(0.8);
|
||||
}
|
||||
}
|
||||
@@ -249,8 +249,7 @@ internal class CountBadgeAdorner : TemplatedControl
|
||||
{
|
||||
_indicatorMotionActor.IsVisible = false;
|
||||
var motion = new BadgeZoomBadgeInMotion(MotionDuration);
|
||||
MotionInvoker.Invoke(_indicatorMotionActor, motion, () => { _indicatorMotionActor.IsVisible = true; }, null,
|
||||
_motionCancellationTokenSource!.Token);
|
||||
MotionInvoker.Invoke(_indicatorMotionActor, motion, () => { _indicatorMotionActor.IsVisible = true; });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,8 +261,7 @@ internal class CountBadgeAdorner : TemplatedControl
|
||||
_motionCancellationTokenSource?.Cancel();
|
||||
_motionCancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
MotionInvoker.Invoke(_indicatorMotionActor, motion, null, () => completedAction(),
|
||||
_motionCancellationTokenSource.Token);
|
||||
MotionInvoker.Invoke(_indicatorMotionActor, motion, null, () => completedAction());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -122,8 +122,7 @@ internal class DotBadgeAdorner : TemplatedControl
|
||||
_motionCancellationTokenSource?.Cancel();
|
||||
_motionCancellationTokenSource = new CancellationTokenSource();
|
||||
var motion = new BadgeZoomBadgeInMotion(MotionDuration, null, FillMode.Forward);
|
||||
MotionInvoker.Invoke(_indicatorMotionActor, motion, () => _indicatorMotionActor.IsVisible = true,
|
||||
null, _motionCancellationTokenSource.Token);
|
||||
MotionInvoker.Invoke(_indicatorMotionActor, motion, () => _indicatorMotionActor.IsVisible = true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,8 +133,7 @@ internal class DotBadgeAdorner : TemplatedControl
|
||||
_motionCancellationTokenSource?.Cancel();
|
||||
_motionCancellationTokenSource = new CancellationTokenSource();
|
||||
var motion = new BadgeZoomBadgeOutMotion(MotionDuration, null, FillMode.Forward);
|
||||
MotionInvoker.Invoke(_indicatorMotionActor, motion, null, () => completedAction(),
|
||||
_motionCancellationTokenSource.Token);
|
||||
MotionInvoker.Invoke(_indicatorMotionActor, motion, null, () => completedAction());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@ internal interface IPopupBuddyLayer
|
||||
void Attach();
|
||||
void Detach();
|
||||
void AttachWithMotion(Action? aboutToStart = null,
|
||||
Action? completedAction = null,
|
||||
CancellationToken cancellationToken = default);
|
||||
Action? completedAction = null);
|
||||
void DetachWithMotion(Action? aboutToStart = null,
|
||||
Action? completedAction = null,
|
||||
CancellationToken cancellationToken = default);
|
||||
Action? completedAction = null);
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public class Popup : AvaloniaPopup,
|
||||
this.AddResourceBindingDisposable(
|
||||
TokenResourceBinder.CreateTokenBinding(this, MaskShadowsProperty, SharedTokenKey.BoxShadowsSecondary));
|
||||
this.AddResourceBindingDisposable(TokenResourceBinder.CreateTokenBinding(this, MotionDurationProperty,
|
||||
SharedTokenKey.MotionDurationFast));
|
||||
SharedTokenKey.MotionDurationMid));
|
||||
CreateBuddyLayer();
|
||||
}
|
||||
|
||||
|
||||
@@ -129,8 +129,7 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer
|
||||
}
|
||||
|
||||
public void AttachWithMotion(Action? aboutToStart = null,
|
||||
Action? completedAction = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
Action? completedAction = null)
|
||||
{
|
||||
Show();
|
||||
|
||||
@@ -138,38 +137,25 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer
|
||||
aboutToStart?.Invoke();
|
||||
var motion = new ZoomBigInMotion(MotionDuration);
|
||||
NotifyAboutToRunAttachMotion();
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
motion.RunTransitions(_buddyDecorator, null, () =>
|
||||
{
|
||||
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
await motion.RunAsync(_buddyDecorator, null, () =>
|
||||
{
|
||||
completedAction?.Invoke();
|
||||
NotifyAttachMotionCompleted();
|
||||
}, cancellationToken);
|
||||
});
|
||||
completedAction?.Invoke();
|
||||
NotifyAttachMotionCompleted();
|
||||
});
|
||||
}
|
||||
|
||||
public void DetachWithMotion(Action? aboutToStart = null,
|
||||
Action? completedAction = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
Action? completedAction = null)
|
||||
{
|
||||
|
||||
aboutToStart?.Invoke();
|
||||
var motion = new ZoomBigOutMotion(MotionDuration);
|
||||
NotifyAboutToRunDetachMotion();
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
motion.RunTransitions(_buddyDecorator, null, () =>
|
||||
{
|
||||
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
await motion.RunAsync(_buddyDecorator, null, () =>
|
||||
{
|
||||
Hide();
|
||||
completedAction?.Invoke();
|
||||
NotifyDetachMotionCompleted();
|
||||
}, cancellationToken);
|
||||
});
|
||||
Hide();
|
||||
completedAction?.Invoke();
|
||||
NotifyDetachMotionCompleted();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
using AtomUI.Controls.Primitives;
|
||||
using AtomUI.MotionScene;
|
||||
using Avalonia;
|
||||
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
internal class PopupMotionActor : SceneMotionActorControl
|
||||
{
|
||||
private readonly Point _offset;
|
||||
|
||||
public PopupMotionActor(Point offset, MotionGhostControl motionGhost)
|
||||
: base(motionGhost)
|
||||
{
|
||||
_offset = offset;
|
||||
}
|
||||
|
||||
protected override Point CalculateTopLevelGhostPosition()
|
||||
{
|
||||
return _offset;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user