mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Add project files.
This commit is contained in:
@@ -0,0 +1,309 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.ActiveSequence
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Render;
|
||||
using Microsoft.Iris.Session;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal class ActiveSequence : DisposableObject
|
||||
{
|
||||
private UISession _session;
|
||||
private IAnimatable _animatableTarget;
|
||||
private Vector<AnimationProxy> _ready;
|
||||
private Vector<AnimationProxy> _playing;
|
||||
private float _lastProgress;
|
||||
private AnimationTemplate _template;
|
||||
private int _playingCount;
|
||||
|
||||
internal ActiveSequence(
|
||||
AnimationTemplate template_,
|
||||
IAnimatable animatableTarget,
|
||||
UISession session)
|
||||
{
|
||||
_animatableTarget = animatableTarget;
|
||||
_session = session;
|
||||
_template = template_;
|
||||
_ready = new Vector<AnimationProxy>();
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
base.OnDispose();
|
||||
Vector<AnimationProxy> animationCollection = GetAnimationCollection();
|
||||
if (animationCollection != null)
|
||||
{
|
||||
foreach (DisposableObject disposableObject in animationCollection)
|
||||
disposableObject.Dispose(this);
|
||||
FireComplete(false);
|
||||
}
|
||||
_session = null;
|
||||
_animatableTarget = null;
|
||||
_template = null;
|
||||
_ready = null;
|
||||
}
|
||||
|
||||
public UISession Session => _session;
|
||||
|
||||
internal IAnimatable Target => _animatableTarget;
|
||||
|
||||
public AnimationTemplate Template => _template;
|
||||
|
||||
public bool Playing => _playing != null;
|
||||
|
||||
internal Vector<AnimationProxy> PendingProxies => _ready;
|
||||
|
||||
public void Play()
|
||||
{
|
||||
Vector<AnimationProxy> ready = _ready;
|
||||
_ready = null;
|
||||
if (ready.Count > 0)
|
||||
{
|
||||
foreach (AnimationProxy animationProxy in ready)
|
||||
animationProxy.Play();
|
||||
_playing = ready;
|
||||
FireStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
FireStart();
|
||||
FireComplete(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop() => Stop(null);
|
||||
|
||||
public void Stop(StopCommandSet stopSetCommand)
|
||||
{
|
||||
if (UIDispatcher.IsUIThread)
|
||||
{
|
||||
StopWorker(stopSetCommand);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Session.IsValid)
|
||||
return;
|
||||
DeferredCall.Post(DispatchPriority.High, new DeferredHandler(DeferredStop), stopSetCommand);
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StopWorker(StopCommandSet stopSetCommand)
|
||||
{
|
||||
if (_playing == null)
|
||||
return;
|
||||
foreach (AnimationProxy animationProxy in _playing)
|
||||
{
|
||||
if (stopSetCommand != null)
|
||||
animationProxy.Stop(stopSetCommand[animationProxy.Type]);
|
||||
else
|
||||
animationProxy.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
private void DeferredStop(object args) => StopWorker((StopCommandSet)args);
|
||||
|
||||
public bool ValidatePlayable()
|
||||
{
|
||||
foreach (AnimationProxy animationProxy in _ready)
|
||||
{
|
||||
if (!animationProxy.ValidatePlayable())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
internal void OnAttachChildAnimation(AnimationProxy child)
|
||||
{
|
||||
child.DeclareOwner(this);
|
||||
_ready.Add(child);
|
||||
}
|
||||
|
||||
private Vector<AnimationProxy> GetAnimationCollection() => _ready ?? _playing;
|
||||
|
||||
internal void OnDetachChildAnimation(AnimationProxy child, float progress)
|
||||
{
|
||||
Vector<AnimationProxy> animationCollection = GetAnimationCollection();
|
||||
if (animationCollection == null)
|
||||
return;
|
||||
animationCollection.Remove(child);
|
||||
child.Dispose(this);
|
||||
if (_lastProgress < (double)progress)
|
||||
_lastProgress = progress;
|
||||
if (animationCollection != _playing || animationCollection.Count != 0)
|
||||
return;
|
||||
FireComplete(true);
|
||||
}
|
||||
|
||||
private void FireStart() => OnStart();
|
||||
|
||||
private void FireComplete(bool notify)
|
||||
{
|
||||
if (_playing != null)
|
||||
_playing = null;
|
||||
OnStop(_lastProgress, notify);
|
||||
}
|
||||
|
||||
public StopCommandSet GetStopCommandSet()
|
||||
{
|
||||
StopCommandSet stopCommandSet = null;
|
||||
foreach (AnimationProxy animation in GetAnimationCollection())
|
||||
{
|
||||
if (animation.HasDynamicKeyframes)
|
||||
{
|
||||
if (stopCommandSet == null)
|
||||
stopCommandSet = new StopCommandSet(StopCommand.MoveToEnd);
|
||||
stopCommandSet[animation.Type] = StopCommand.LeaveCurrent;
|
||||
}
|
||||
}
|
||||
return stopCommandSet;
|
||||
}
|
||||
|
||||
public ActiveTransitions GetActiveTransitions()
|
||||
{
|
||||
Vector<AnimationProxy> animationCollection = GetAnimationCollection();
|
||||
ActiveTransitions activeTransitions = ActiveTransitions.None;
|
||||
foreach (AnimationProxy animationProxy in animationCollection)
|
||||
{
|
||||
ActiveTransitions activeTransition = ConvertToActiveTransition(animationProxy.Type);
|
||||
activeTransitions |= activeTransition;
|
||||
}
|
||||
return activeTransitions;
|
||||
}
|
||||
|
||||
public static ActiveTransitions ConvertToActiveTransition(AnimationType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case AnimationType.Position:
|
||||
return ActiveTransitions.Move;
|
||||
case AnimationType.Size:
|
||||
return ActiveTransitions.Size;
|
||||
case AnimationType.Alpha:
|
||||
return ActiveTransitions.Alpha;
|
||||
case AnimationType.Scale:
|
||||
return ActiveTransitions.Scale;
|
||||
case AnimationType.Rotate:
|
||||
return ActiveTransitions.Rotate;
|
||||
case AnimationType.Orientation:
|
||||
return ActiveTransitions.Orientation;
|
||||
case AnimationType.PositionX:
|
||||
return ActiveTransitions.PositionX;
|
||||
case AnimationType.PositionY:
|
||||
return ActiveTransitions.PositionY;
|
||||
case AnimationType.SizeX:
|
||||
return ActiveTransitions.SizeX;
|
||||
case AnimationType.SizeY:
|
||||
return ActiveTransitions.SizeY;
|
||||
case AnimationType.ScaleX:
|
||||
return ActiveTransitions.ScaleX;
|
||||
case AnimationType.ScaleY:
|
||||
return ActiveTransitions.ScaleY;
|
||||
case AnimationType.Float:
|
||||
case AnimationType.Vector2:
|
||||
case AnimationType.Vector3:
|
||||
return ActiveTransitions.Effect;
|
||||
case AnimationType.CameraEye:
|
||||
return ActiveTransitions.CameraEye;
|
||||
case AnimationType.CameraAt:
|
||||
return ActiveTransitions.CameraAt;
|
||||
case AnimationType.CameraUp:
|
||||
return ActiveTransitions.CameraUp;
|
||||
case AnimationType.CameraZn:
|
||||
return ActiveTransitions.CameraZn;
|
||||
default:
|
||||
return ActiveTransitions.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static ActiveTransitions ConvertToActiveTransition(
|
||||
AnimationEventType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case AnimationEventType.Move:
|
||||
return ActiveTransitions.Move;
|
||||
case AnimationEventType.Size:
|
||||
return ActiveTransitions.Size;
|
||||
case AnimationEventType.Scale:
|
||||
return ActiveTransitions.Scale;
|
||||
case AnimationEventType.Rotate:
|
||||
return ActiveTransitions.Rotate | ActiveTransitions.Orientation;
|
||||
case AnimationEventType.Alpha:
|
||||
return ActiveTransitions.Alpha;
|
||||
default:
|
||||
return ActiveTransitions.None;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.Append("{ActiveSequence Template=\"");
|
||||
if (_template.DebugID != null)
|
||||
{
|
||||
stringBuilder.Append(_template.DebugID);
|
||||
}
|
||||
else
|
||||
{
|
||||
Animation template = _template as Animation;
|
||||
if (template != null)
|
||||
stringBuilder.Append(template.Type);
|
||||
else
|
||||
stringBuilder.Append("<Unknown>");
|
||||
}
|
||||
stringBuilder.Append("\", Target=");
|
||||
stringBuilder.Append(_animatableTarget.GetType().Name);
|
||||
if (_animatableTarget is IVisual)
|
||||
{
|
||||
stringBuilder.Append(", IVisual=");
|
||||
stringBuilder.Append(((IVisual)_animatableTarget).DebugID);
|
||||
}
|
||||
stringBuilder.Append("}");
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
public event EventHandler AnimationStarted;
|
||||
|
||||
public event EventHandler AnimationCompleted;
|
||||
|
||||
public event EventHandler AfterAnimationCompleted;
|
||||
|
||||
internal void OnStart()
|
||||
{
|
||||
++_playingCount;
|
||||
if (_playingCount != 1 || AnimationStarted == null)
|
||||
return;
|
||||
AnimationStarted(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
internal void OnStop(float progress, bool notify)
|
||||
{
|
||||
--_playingCount;
|
||||
if (notify && _playingCount == 0)
|
||||
{
|
||||
EventArgs e = new AnimationCompleteArgs(progress);
|
||||
if (AnimationCompleted != null)
|
||||
AnimationCompleted(this, e);
|
||||
if (AfterAnimationCompleted == null)
|
||||
return;
|
||||
AfterAnimationCompleted(this, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
int playingCount = _playingCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.ActiveTransitions
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
[Flags]
|
||||
internal enum ActiveTransitions
|
||||
{
|
||||
None = 0,
|
||||
Move = 1,
|
||||
Scale = 2,
|
||||
Alpha = 4,
|
||||
Rotate = 8,
|
||||
Size = 16, // 0x00000010
|
||||
Effect = 32, // 0x00000020
|
||||
PositionX = 64, // 0x00000040
|
||||
PositionY = 128, // 0x00000080
|
||||
SizeX = 256, // 0x00000100
|
||||
SizeY = 512, // 0x00000200
|
||||
ScaleX = 1024, // 0x00000400
|
||||
ScaleY = 2048, // 0x00000800
|
||||
Orientation = 4096, // 0x00001000
|
||||
CameraEye = 8192, // 0x00002000
|
||||
CameraAt = 16384, // 0x00004000
|
||||
CameraUp = 32768, // 0x00008000
|
||||
CameraZn = 65536, // 0x00010000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.AlphaKeyframe
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Render;
|
||||
using Microsoft.Iris.UI;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal class AlphaKeyframe : BaseMultiplyFloatKeyframe
|
||||
{
|
||||
public override AnimationType Type => AnimationType.Alpha;
|
||||
|
||||
public override float GetEffectiveValue(
|
||||
IAnimatable targetObject,
|
||||
float baseValue,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
return RelativeTo == RelativeTo.Final ? baseValue * args.NewAlpha : baseValue;
|
||||
}
|
||||
|
||||
public override void Apply(IAnimatableOwner animationTarget, float value) => ((ViewItem)animationTarget).VisualAlpha = value;
|
||||
|
||||
public override void MagnifyValue(float magnifyValue)
|
||||
{
|
||||
float num = Value * magnifyValue;
|
||||
if (num > 1.0)
|
||||
num = 1f;
|
||||
Value = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.Animation
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Drawing;
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Render;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal class Animation : AnimationTemplate, IAnimationProvider
|
||||
{
|
||||
private static readonly DataCookie s_rotationAxisProperty = DataCookie.ReserveSlot();
|
||||
private static readonly DataCookie s_centerPointScaleProperty = DataCookie.ReserveSlot();
|
||||
private static readonly DataCookie s_centerPointOffsetProperty = DataCookie.ReserveSlot();
|
||||
private BitVector32 _bitsBitVector;
|
||||
private AnimationEventType _type;
|
||||
private DynamicData _dataMap;
|
||||
|
||||
public Animation()
|
||||
{
|
||||
_type = AnimationEventType.Idle;
|
||||
_bitsBitVector = new BitVector32();
|
||||
_dataMap = new DynamicData();
|
||||
}
|
||||
|
||||
public override object Clone()
|
||||
{
|
||||
Animation animation = new Animation();
|
||||
CloneWorker(animation);
|
||||
return animation;
|
||||
}
|
||||
|
||||
protected override void CloneWorker(AnimationTemplate rawAnimation)
|
||||
{
|
||||
base.CloneWorker(rawAnimation);
|
||||
Animation animation = (Animation)rawAnimation;
|
||||
animation.Type = Type;
|
||||
if (GetBit(Bits.CenterPointScale))
|
||||
animation.CenterPointPercent = CenterPointPercent;
|
||||
if (GetBit(Bits.RotationAxis))
|
||||
animation.RotationAxis = RotationAxis;
|
||||
animation.DisableMouseInput = DisableMouseInput;
|
||||
}
|
||||
|
||||
private void PrepareToPlay(ref AnimationArgs args)
|
||||
{
|
||||
if (GetBit(Bits.CenterPointScale))
|
||||
args.ViewItem.VisualCenterPoint = CenterPointPercent;
|
||||
if (!GetBit(Bits.RotationAxis))
|
||||
return;
|
||||
Rotation visualRotation = args.ViewItem.VisualRotation;
|
||||
args.ViewItem.VisualRotation = new Rotation(visualRotation.AngleRadians, RotationAxis);
|
||||
}
|
||||
|
||||
public AnimationEventType Type
|
||||
{
|
||||
get => _type;
|
||||
set => _type = value;
|
||||
}
|
||||
|
||||
public Vector3 CenterPointPercent
|
||||
{
|
||||
get => !GetBit(Bits.CenterPointScale) ? Vector3.Zero : (Vector3)GetData(s_centerPointScaleProperty);
|
||||
set
|
||||
{
|
||||
if (!(CenterPointPercent != value))
|
||||
return;
|
||||
SetData(s_centerPointScaleProperty, value);
|
||||
SetBit(Bits.CenterPointScale, true);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 RotationAxis
|
||||
{
|
||||
get => !GetBit(Bits.RotationAxis) ? Rotation.Default.Axis : (Vector3)GetData(s_rotationAxisProperty);
|
||||
set
|
||||
{
|
||||
if (!(RotationAxis != value))
|
||||
return;
|
||||
SetData(s_rotationAxisProperty, value);
|
||||
SetBit(Bits.RotationAxis, true);
|
||||
}
|
||||
}
|
||||
|
||||
public bool DisableMouseInput
|
||||
{
|
||||
get => GetBit(Bits.DisableMouseInput);
|
||||
set => SetBit(Bits.DisableMouseInput, value);
|
||||
}
|
||||
|
||||
AnimationTemplate IAnimationProvider.Build(
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
PrepareToPlay(ref args);
|
||||
return this;
|
||||
}
|
||||
|
||||
public bool CanCache => true;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.Append("{AnimationTemplate ID=");
|
||||
stringBuilder.Append(DebugID);
|
||||
stringBuilder.Append(", Loop=");
|
||||
stringBuilder.Append(Loop);
|
||||
stringBuilder.Append(", KeyframeCount=");
|
||||
stringBuilder.Append(Keyframes.Count);
|
||||
stringBuilder.Append("}");
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
private bool GetBit(Animation.Bits bit) => _bitsBitVector[(int)bit];
|
||||
|
||||
private void SetBit(Animation.Bits bit, bool value) => _bitsBitVector[(int)bit] = value;
|
||||
|
||||
private bool ChangeBit(Animation.Bits bit, bool value)
|
||||
{
|
||||
if (_bitsBitVector[(int)bit] == value)
|
||||
return false;
|
||||
_bitsBitVector[(int)bit] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected object GetData(DataCookie cookie) => _dataMap.GetData(cookie);
|
||||
|
||||
protected void SetData(DataCookie cookie, object value) => _dataMap.SetData(cookie, value);
|
||||
|
||||
protected Delegate GetEventHandler(EventCookie cookie) => _dataMap.GetEventHandler(cookie);
|
||||
|
||||
protected void AddEventHandler(EventCookie cookie, Delegate handlerToAdd) => _dataMap.AddEventHandler(cookie, handlerToAdd);
|
||||
|
||||
protected void RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove) => _dataMap.RemoveEventHandler(cookie, handlerToRemove);
|
||||
|
||||
protected void RemoveEventHandlers(EventCookie cookie) => _dataMap.RemoveEventHandlers(cookie);
|
||||
|
||||
private static uint GetKey(EventCookie cookie) => EventCookie.ToUInt32(cookie);
|
||||
|
||||
private enum Bits
|
||||
{
|
||||
CenterPointScale = 1,
|
||||
RotationAxis = 2,
|
||||
DisableMouseInput = 4,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.AnimationArgs
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Drawing;
|
||||
using Microsoft.Iris.Render;
|
||||
using Microsoft.Iris.UI;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal struct AnimationArgs
|
||||
{
|
||||
public ViewItem ViewItem;
|
||||
public Vector3 OldPosition;
|
||||
public Vector2 OldSize;
|
||||
public Vector3 OldScale;
|
||||
public Rotation OldRotation;
|
||||
public float OldAlpha;
|
||||
public Vector3 NewPosition;
|
||||
public Vector2 NewSize;
|
||||
public Vector3 NewScale;
|
||||
public Rotation NewRotation;
|
||||
public float NewAlpha;
|
||||
public Vector3 OldEye;
|
||||
public Vector3 OldAt;
|
||||
public Vector3 OldUp;
|
||||
public float OldZn;
|
||||
public Vector3 NewEye;
|
||||
public Vector3 NewAt;
|
||||
public Vector3 NewUp;
|
||||
public float NewZn;
|
||||
|
||||
public AnimationArgs(Camera cam)
|
||||
{
|
||||
ViewItem = null;
|
||||
OldPosition = Vector3.Zero;
|
||||
OldSize = Vector2.Zero;
|
||||
OldScale = Vector3.Zero;
|
||||
OldRotation = Rotation.Default;
|
||||
OldAlpha = 0.0f;
|
||||
NewPosition = Vector3.Zero;
|
||||
NewSize = Vector2.Zero;
|
||||
NewScale = Vector3.Zero;
|
||||
NewRotation = Rotation.Default;
|
||||
NewAlpha = 0.0f;
|
||||
OldEye = cam.Eye;
|
||||
NewEye = cam.Eye;
|
||||
OldAt = cam.At;
|
||||
NewAt = cam.At;
|
||||
OldUp = cam.Up;
|
||||
NewUp = cam.Up;
|
||||
OldZn = cam.Zn;
|
||||
NewZn = cam.Zn;
|
||||
}
|
||||
|
||||
public AnimationArgs(
|
||||
ViewItem vi,
|
||||
Vector3 oldPosition,
|
||||
Vector2 oldSize,
|
||||
Vector3 oldScale,
|
||||
Rotation oldRotation,
|
||||
float oldAlpha,
|
||||
Vector3 newPosition,
|
||||
Vector2 newSize,
|
||||
Vector3 newScale,
|
||||
Rotation newRotation,
|
||||
float newAlpha)
|
||||
{
|
||||
ViewItem = vi;
|
||||
OldPosition = oldPosition;
|
||||
OldSize = oldSize;
|
||||
OldScale = oldScale;
|
||||
OldRotation = oldRotation;
|
||||
OldAlpha = oldAlpha;
|
||||
NewPosition = newPosition;
|
||||
NewSize = newSize;
|
||||
NewScale = newScale;
|
||||
NewRotation = newRotation;
|
||||
NewAlpha = newAlpha;
|
||||
OldEye = Vector3.Zero;
|
||||
NewEye = Vector3.Zero;
|
||||
OldAt = Vector3.Zero;
|
||||
NewAt = Vector3.Zero;
|
||||
OldUp = Vector3.Zero;
|
||||
NewUp = Vector3.Zero;
|
||||
OldZn = 0.0f;
|
||||
NewZn = 0.0f;
|
||||
}
|
||||
|
||||
public AnimationArgs(
|
||||
ViewItem vi,
|
||||
Vector3 oldPosition,
|
||||
Vector2 oldSize,
|
||||
Vector3 oldScale,
|
||||
Rotation oldRotation,
|
||||
float oldAlpha)
|
||||
: this(vi, oldPosition, oldSize, oldScale, oldRotation, oldAlpha, oldPosition, oldSize, oldScale, oldRotation, oldAlpha)
|
||||
{
|
||||
}
|
||||
|
||||
public AnimationArgs(ViewItem vi)
|
||||
: this(vi, vi.VisualPosition, vi.VisualSize, vi.VisualScale, vi.VisualRotation, vi.VisualAlpha, vi.VisualPosition, vi.VisualSize, vi.VisualScale, vi.VisualRotation, vi.VisualAlpha)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.AnimationCompleteArgs
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal class AnimationCompleteArgs : EventArgs
|
||||
{
|
||||
private float _progress;
|
||||
|
||||
public AnimationCompleteArgs(float progress) => _progress = progress;
|
||||
|
||||
public float Progress => _progress;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.AnimationEventType
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal enum AnimationEventType
|
||||
{
|
||||
Show,
|
||||
Hide,
|
||||
Move,
|
||||
Size,
|
||||
Scale,
|
||||
Rotate,
|
||||
Alpha,
|
||||
GainFocus,
|
||||
LoseFocus,
|
||||
ContentChangeShow,
|
||||
ContentChangeHide,
|
||||
Idle,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.AnimationHandle
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Markup;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal class AnimationHandle : NotifyObjectBase
|
||||
{
|
||||
private int _playing;
|
||||
|
||||
public event EventHandler Completed;
|
||||
|
||||
public bool Playing => _playing > 0;
|
||||
|
||||
internal void AssociateWithAnimationInstance(ActiveSequence anim)
|
||||
{
|
||||
anim.AnimationCompleted += new EventHandler(OnAnimationCompleted);
|
||||
++_playing;
|
||||
if (_playing != 1)
|
||||
return;
|
||||
FireNotification(NotificationID.Playing);
|
||||
}
|
||||
|
||||
internal void FireCompleted()
|
||||
{
|
||||
if (Completed != null)
|
||||
Completed(this, EventArgs.Empty);
|
||||
FireNotification(NotificationID.Completed);
|
||||
}
|
||||
|
||||
private void OnAnimationCompleted(object sender, EventArgs args)
|
||||
{
|
||||
((ActiveSequence)sender).AnimationCompleted -= new EventHandler(OnAnimationCompleted);
|
||||
--_playing;
|
||||
if (_playing != 0)
|
||||
return;
|
||||
FireNotification(NotificationID.Playing);
|
||||
FireCompleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.AnimationManager
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Render;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal class AnimationManager : IDisposable
|
||||
{
|
||||
private IRenderSession _session;
|
||||
private Vector<OrphanedVisualCollection> _orphans;
|
||||
private bool _shuttingDown;
|
||||
private static ConstantAnimationInput s_defaultPositionInput = new ConstantAnimationInput(Vector3.Zero);
|
||||
private static ConstantAnimationInput s_defaultSizeInput = new ConstantAnimationInput(Vector2.Zero);
|
||||
private static ConstantAnimationInput s_defaultAlphaInput = new ConstantAnimationInput(0.0f);
|
||||
private static ConstantAnimationInput s_defaultScaleInput = new ConstantAnimationInput(Vector3.UnitVector);
|
||||
private static ConstantAnimationInput s_defaultRotationInput = new ConstantAnimationInput(AxisAngle.Identity.ToVector4());
|
||||
private static ConstantAnimationInput s_defaultOrientationInput = new ConstantAnimationInput(AxisAngle.Identity.ToQuaternion());
|
||||
private static ConstantAnimationInput s_defaultFloatInput = new ConstantAnimationInput(0.0f);
|
||||
private static ConstantAnimationInput s_defaultVector2Input = new ConstantAnimationInput(Vector2.Zero);
|
||||
private static ConstantAnimationInput s_defaultVector3Input = new ConstantAnimationInput(Vector3.Zero);
|
||||
private static ConstantAnimationInput s_defaultVector4Input = new ConstantAnimationInput(Vector4.Zero);
|
||||
private static ConstantAnimationInput s_defaultCameraEyeInput = new ConstantAnimationInput(new Vector3(0.0f, 0.0f, -4f));
|
||||
private static ConstantAnimationInput s_defaultCameraAtInput = new ConstantAnimationInput(new Vector3(0.0f, 0.0f, 0.0f));
|
||||
private static ConstantAnimationInput s_defaultCameraUpInput = new ConstantAnimationInput(new Vector3(0.0f, 1f, 0.0f));
|
||||
private static ConstantAnimationInput s_defaultCameraZnInput = new ConstantAnimationInput(2f);
|
||||
|
||||
public AnimationManager(IRenderSession session)
|
||||
{
|
||||
_session = session;
|
||||
_orphans = new Vector<OrphanedVisualCollection>();
|
||||
_session.AnimationSystem.UpdatesPerSecond = session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi ? 0 : 3;
|
||||
_session.AnimationSystem.BackCompat = true;
|
||||
}
|
||||
|
||||
~AnimationManager() => Dispose(false);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool inDisposeFlag)
|
||||
{
|
||||
_shuttingDown = true;
|
||||
if (!inDisposeFlag)
|
||||
return;
|
||||
foreach (DisposableObject orphan in _orphans)
|
||||
orphan.Dispose(this);
|
||||
_orphans.Clear();
|
||||
}
|
||||
|
||||
internal bool ShuttingDown => _shuttingDown;
|
||||
|
||||
public void SetGlobalSpeedAdjustment(float value)
|
||||
{
|
||||
ValidateConnected();
|
||||
_session.AnimationSystem.SpeedAdjustment = value;
|
||||
}
|
||||
|
||||
public void PulseTimeAdvance(int pulseSize)
|
||||
{
|
||||
ValidateConnected();
|
||||
_session.AnimationSystem.PulseTimeAdvance(pulseSize);
|
||||
}
|
||||
|
||||
public void RegisterAnimatedOrphans(OrphanedVisualCollection orphan) => _orphans.Add(orphan);
|
||||
|
||||
public void UnregisterAnimatedOrphans(OrphanedVisualCollection orphan) => _orphans.Remove(orphan);
|
||||
|
||||
public bool CanPlayAnimationType(AnimationType type) => _session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi || type == AnimationType.Position || (type == AnimationType.Size || type == AnimationType.Scale) || type == AnimationType.Alpha;
|
||||
|
||||
private void ValidateConnected()
|
||||
{
|
||||
}
|
||||
|
||||
internal IKeyframeAnimation BuildAnimation(AnimationProxy owner)
|
||||
{
|
||||
ValidateConnected();
|
||||
IKeyframeAnimation keyframeAnimation = null;
|
||||
switch (owner.Type)
|
||||
{
|
||||
case AnimationType.Position:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultPositionInput);
|
||||
break;
|
||||
case AnimationType.Size:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultSizeInput);
|
||||
break;
|
||||
case AnimationType.Alpha:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultAlphaInput);
|
||||
break;
|
||||
case AnimationType.Scale:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultScaleInput);
|
||||
break;
|
||||
case AnimationType.Rotate:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultRotationInput);
|
||||
break;
|
||||
case AnimationType.Orientation:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultOrientationInput);
|
||||
break;
|
||||
case AnimationType.PositionX:
|
||||
case AnimationType.PositionY:
|
||||
case AnimationType.SizeX:
|
||||
case AnimationType.SizeY:
|
||||
case AnimationType.ScaleX:
|
||||
case AnimationType.ScaleY:
|
||||
case AnimationType.Float:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultFloatInput);
|
||||
break;
|
||||
case AnimationType.Vector2:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector2Input);
|
||||
break;
|
||||
case AnimationType.Vector3:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector3Input);
|
||||
break;
|
||||
case AnimationType.Vector4:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector4Input);
|
||||
break;
|
||||
case AnimationType.CameraEye:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraEyeInput);
|
||||
break;
|
||||
case AnimationType.CameraAt:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraAtInput);
|
||||
break;
|
||||
case AnimationType.CameraUp:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraUpInput);
|
||||
break;
|
||||
case AnimationType.CameraZn:
|
||||
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraZnInput);
|
||||
break;
|
||||
}
|
||||
return keyframeAnimation;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,339 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.AnimationProxy
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Drawing;
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Render;
|
||||
using Microsoft.Iris.Session;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal class AnimationProxy : DisposableObject
|
||||
{
|
||||
private ActiveSequence _activeSequence;
|
||||
private IKeyframeAnimation _animation;
|
||||
private int _keyframesValue;
|
||||
private bool _playingFlag;
|
||||
private AnimationType _type;
|
||||
private bool _dynamicFlag;
|
||||
private bool _doNotAutoReleaseFlag;
|
||||
private IAnimatable _animatableTarget;
|
||||
private RendererProperty _rendererProperty;
|
||||
private static DeferredHandler s_deferredCleanupWorker = new DeferredHandler(DeferredCleanupWorker);
|
||||
|
||||
internal AnimationProxy(
|
||||
ActiveSequence activeSequence,
|
||||
IAnimatable animatableTarget,
|
||||
AnimationType createType,
|
||||
RendererProperty rendererProperty,
|
||||
int loopCount,
|
||||
StopCommand stopCmd)
|
||||
{
|
||||
UISession.Validate(activeSequence.Session);
|
||||
AnimationSystem.ValidateAnimationType(createType);
|
||||
_activeSequence = activeSequence;
|
||||
_type = createType;
|
||||
_animatableTarget = animatableTarget;
|
||||
_rendererProperty = rendererProperty;
|
||||
_animation = _activeSequence.Session.AnimationManager.BuildAnimation(this);
|
||||
CommonCreate(loopCount, stopCmd);
|
||||
}
|
||||
|
||||
private void CommonCreate(int loopCount, StopCommand stopCmd)
|
||||
{
|
||||
_animation.RepeatCount = loopCount;
|
||||
_animation.AsyncNotifyEvent += new AsyncNotifyHandler(OnAsyncNotification);
|
||||
_animation.AddStageEvent(AnimationStage.Complete, new AnimationEvent(_animation, "AsyncNotify", 1U));
|
||||
_animation.AddStageEvent(AnimationStage.Reset, new AnimationEvent(_animation, "AsyncNotify", 2U));
|
||||
SetStopCommand(stopCmd);
|
||||
_activeSequence.OnAttachChildAnimation(this);
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
CleanupWorker(0.0f, false);
|
||||
base.OnDispose();
|
||||
}
|
||||
|
||||
public UISession Session => _activeSequence.Session;
|
||||
|
||||
public AnimationType Type => _type;
|
||||
|
||||
public bool HasDynamicKeyframes => _dynamicFlag;
|
||||
|
||||
internal bool DoNotAutoRelease
|
||||
{
|
||||
get => _doNotAutoReleaseFlag;
|
||||
set => _doNotAutoReleaseFlag = value;
|
||||
}
|
||||
|
||||
public void AddFloatKeyframe(BaseKeyframe keyframe, float value)
|
||||
{
|
||||
++_keyframesValue;
|
||||
AnimationInput animationInput1;
|
||||
if (keyframe.IsRelativeToObject)
|
||||
{
|
||||
_dynamicFlag = true;
|
||||
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
|
||||
if (keyframe.Multiply && value != 1.0)
|
||||
{
|
||||
AnimationInput animationInput2 = new ConstantAnimationInput(value);
|
||||
animationInput1 *= animationInput2;
|
||||
}
|
||||
else if (!keyframe.Multiply && value != 0.0)
|
||||
{
|
||||
AnimationInput animationInput2 = new ConstantAnimationInput(value);
|
||||
animationInput1 += animationInput2;
|
||||
}
|
||||
}
|
||||
else
|
||||
animationInput1 = new ConstantAnimationInput(value);
|
||||
_animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
|
||||
}
|
||||
|
||||
public void AddVector2Keyframe(BaseKeyframe keyframe, Vector2 value)
|
||||
{
|
||||
++_keyframesValue;
|
||||
AnimationInput animationInput1;
|
||||
if (keyframe.IsRelativeToObject)
|
||||
{
|
||||
_dynamicFlag = true;
|
||||
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
|
||||
if (keyframe.Multiply && value != Vector2.UnitVector)
|
||||
{
|
||||
AnimationInput animationInput2 = new ConstantAnimationInput(value);
|
||||
animationInput1 *= animationInput2;
|
||||
}
|
||||
else if (!keyframe.Multiply && value != Vector2.Zero)
|
||||
{
|
||||
AnimationInput animationInput2 = new ConstantAnimationInput(value);
|
||||
animationInput1 += animationInput2;
|
||||
}
|
||||
}
|
||||
else
|
||||
animationInput1 = new ConstantAnimationInput(value);
|
||||
_animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
|
||||
}
|
||||
|
||||
public void AddVector3Keyframe(BaseKeyframe keyframe, Vector3 value)
|
||||
{
|
||||
++_keyframesValue;
|
||||
AnimationInput animationInput1;
|
||||
if (keyframe.IsRelativeToObject)
|
||||
{
|
||||
_dynamicFlag = true;
|
||||
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
|
||||
if (keyframe.Multiply && value != Vector3.UnitVector)
|
||||
{
|
||||
AnimationInput animationInput2 = new ConstantAnimationInput(value);
|
||||
animationInput1 *= animationInput2;
|
||||
}
|
||||
else if (!keyframe.Multiply && value != Vector3.Zero)
|
||||
{
|
||||
AnimationInput animationInput2 = new ConstantAnimationInput(value);
|
||||
animationInput1 += animationInput2;
|
||||
}
|
||||
}
|
||||
else
|
||||
animationInput1 = new ConstantAnimationInput(value);
|
||||
_animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
|
||||
}
|
||||
|
||||
public void AddVector4Keyframe(BaseKeyframe keyframe, Vector4 value)
|
||||
{
|
||||
++_keyframesValue;
|
||||
AnimationInput animationInput1;
|
||||
if (keyframe.IsRelativeToObject)
|
||||
{
|
||||
_dynamicFlag = true;
|
||||
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
|
||||
if (keyframe.Multiply && value != Vector4.UnitVector)
|
||||
{
|
||||
AnimationInput animationInput2 = new ConstantAnimationInput(value);
|
||||
animationInput1 *= animationInput2;
|
||||
}
|
||||
else if (!keyframe.Multiply && value != Vector4.Zero)
|
||||
{
|
||||
AnimationInput animationInput2 = new ConstantAnimationInput(value);
|
||||
animationInput1 += animationInput2;
|
||||
}
|
||||
}
|
||||
else
|
||||
animationInput1 = new ConstantAnimationInput(value);
|
||||
_animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
|
||||
}
|
||||
|
||||
public void AddRotationKeyframe(BaseKeyframe keyframe, Rotation value)
|
||||
{
|
||||
if (keyframe.Type != AnimationType.Orientation)
|
||||
{
|
||||
AddVector4Keyframe(keyframe, new Vector4(value.Axis.X, value.Axis.Y, value.Axis.Z, value.AngleRadians));
|
||||
}
|
||||
else
|
||||
{
|
||||
++_keyframesValue;
|
||||
AnimationInput animationInput1;
|
||||
if (keyframe.IsRelativeToObject)
|
||||
{
|
||||
_dynamicFlag = true;
|
||||
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
|
||||
if (value != Rotation.Default)
|
||||
{
|
||||
AnimationInput animationInput2 = new ConstantAnimationInput(new Quaternion(value.Axis, value.AngleRadians));
|
||||
animationInput1 *= animationInput2;
|
||||
}
|
||||
}
|
||||
else
|
||||
animationInput1 = new ConstantAnimationInput(new Quaternion(value.Axis, value.AngleRadians));
|
||||
AnimationInterpolation interpolation = GenerateInterpolation(keyframe.Interpolation);
|
||||
interpolation.UseSphericalCombination = true;
|
||||
_animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, interpolation));
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStopCommand(StopCommand stopCmd)
|
||||
{
|
||||
switch (stopCmd)
|
||||
{
|
||||
case StopCommand.LeaveCurrent:
|
||||
_animation.ResetBehavior = AnimationResetBehavior.LeaveCurrent;
|
||||
break;
|
||||
case StopCommand.MoveToBegin:
|
||||
_animation.ResetBehavior = AnimationResetBehavior.SetInitialValue;
|
||||
break;
|
||||
case StopCommand.MoveToEnd:
|
||||
_animation.ResetBehavior = AnimationResetBehavior.SetFinalValue;
|
||||
break;
|
||||
}
|
||||
_animation.AutoReset = true;
|
||||
}
|
||||
|
||||
public bool ValidatePlayable()
|
||||
{
|
||||
if (_keyframesValue >= 2)
|
||||
return true;
|
||||
ErrorManager.ReportError("Animations must have at least 2 keyframes to play");
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Play()
|
||||
{
|
||||
if (!ValidatePlayable())
|
||||
return;
|
||||
if (!_activeSequence.Session.AnimationManager.CanPlayAnimationType(_type))
|
||||
{
|
||||
Cleanup(0.0f, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_playingFlag || _animation == null || !Session.IsValid)
|
||||
return;
|
||||
_animation.AddTarget(_animatableTarget, _rendererProperty.Property, _rendererProperty.TargetMask);
|
||||
_animation.Play();
|
||||
_playingFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop() => StopWorker(false, StopCommand.MoveToEnd);
|
||||
|
||||
public void Stop(StopCommand stopCommand) => StopWorker(true, stopCommand);
|
||||
|
||||
private void StopWorker(bool stopCommandFlag, StopCommand stopCommand)
|
||||
{
|
||||
if (!_playingFlag)
|
||||
return;
|
||||
_playingFlag = false;
|
||||
if (_animation == null || !Session.IsValid)
|
||||
return;
|
||||
if (stopCommandFlag)
|
||||
SetStopCommand(stopCommand);
|
||||
_animation.Reset();
|
||||
_animation.RemoveAllTargets();
|
||||
}
|
||||
|
||||
private void Cleanup(float progress, bool forceDeferFlag)
|
||||
{
|
||||
if (_animation == null)
|
||||
return;
|
||||
if (UIDispatcher.IsUIThread && !forceDeferFlag)
|
||||
{
|
||||
CleanupWorker(progress, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Session.IsValid)
|
||||
return;
|
||||
DeferredCall.Post(DispatchPriority.Housekeeping, s_deferredCleanupWorker, this);
|
||||
}
|
||||
}
|
||||
|
||||
private void CleanupWorker(float progress, bool withNotifications)
|
||||
{
|
||||
_playingFlag = false;
|
||||
if (_animation != null)
|
||||
{
|
||||
_animation.AsyncNotifyEvent -= new AsyncNotifyHandler(OnAsyncNotification);
|
||||
_animation.UnregisterUsage(this);
|
||||
_animation = null;
|
||||
}
|
||||
_animatableTarget = null;
|
||||
if (!withNotifications)
|
||||
return;
|
||||
_activeSequence.OnDetachChildAnimation(this, progress);
|
||||
}
|
||||
|
||||
private static void DeferredCleanupWorker(object args) => (args as AnimationProxy).CleanupWorker(0.0f, true);
|
||||
|
||||
private static AnimationInterpolation GenerateInterpolation(
|
||||
Interpolation interpolation)
|
||||
{
|
||||
if (interpolation == null)
|
||||
return new LinearInterpolation();
|
||||
switch (interpolation.Type)
|
||||
{
|
||||
case InterpolationType.Linear:
|
||||
return new LinearInterpolation();
|
||||
case InterpolationType.SCurve:
|
||||
return new SCurveInterpolation(interpolation.Weight * 10f);
|
||||
case InterpolationType.Exp:
|
||||
return interpolation.Weight > 0.0 ? new ExponentialInterpolation(interpolation.Weight * 10f) : (AnimationInterpolation)new LinearInterpolation();
|
||||
case InterpolationType.Log:
|
||||
return interpolation.Weight > 0.0 ? new LogarithmicInterpolation(interpolation.Weight * 10f) : (AnimationInterpolation)new LinearInterpolation();
|
||||
case InterpolationType.Sine:
|
||||
return new SineInterpolation();
|
||||
case InterpolationType.Cosine:
|
||||
return new CosineInterpolation();
|
||||
case InterpolationType.Bezier:
|
||||
return new BezierInterpolation(interpolation.BezierHandle1, interpolation.BezierHandle2);
|
||||
case InterpolationType.EaseIn:
|
||||
return new EaseInInterpolation(interpolation.Weight * 10f, interpolation.EasePercent);
|
||||
case InterpolationType.EaseOut:
|
||||
return new EaseOutInterpolation(interpolation.Weight * 10f, interpolation.EasePercent);
|
||||
default:
|
||||
return new LinearInterpolation();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAsyncNotification(int nCookie)
|
||||
{
|
||||
switch (nCookie)
|
||||
{
|
||||
case 1:
|
||||
Cleanup(0.0f, false);
|
||||
break;
|
||||
case 2:
|
||||
Cleanup(0.0f, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private enum AsyncNotifications
|
||||
{
|
||||
OnComplete = 1,
|
||||
OnReset = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.AnimationSystem
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal static class AnimationSystem
|
||||
{
|
||||
private static bool _enabledFlag = true;
|
||||
private static bool _overrideToFalseFlag;
|
||||
private static int _disableAnimationCount;
|
||||
private static Dictionary<string, AnimationTemplate> _sequences = new Dictionary<string, AnimationTemplate>();
|
||||
|
||||
public static void ValidateAnimationType(AnimationType paramType)
|
||||
{
|
||||
}
|
||||
|
||||
public static bool SequenceExists(string id) => _sequences.ContainsKey(id);
|
||||
|
||||
public static AnimationTemplate GetSequenceByID(string id)
|
||||
{
|
||||
if (!Enabled)
|
||||
return null;
|
||||
return SequenceExists(id) ? (AnimationTemplate)_sequences[id].Clone() : null;
|
||||
}
|
||||
|
||||
public static AnimationTemplate GetSequenceByIDAlways(string id) => SequenceExists(id) ? (AnimationTemplate)_sequences[id].Clone() : null;
|
||||
|
||||
public static void AddSequenceByID(string id, AnimationTemplate seq)
|
||||
{
|
||||
if (SequenceExists(id))
|
||||
return;
|
||||
_sequences.Add(id, seq);
|
||||
}
|
||||
|
||||
public static void ClearSequences() => _sequences = new Dictionary<string, AnimationTemplate>();
|
||||
|
||||
public static ICollection GetAllSequences() => _sequences.Values;
|
||||
|
||||
public static bool Enabled => _enabledFlag;
|
||||
|
||||
public static void SetEnableState(bool value) => _enabledFlag = value;
|
||||
|
||||
public static void OverrideAnimationState(bool overrideToFalseFlag)
|
||||
{
|
||||
if (_overrideToFalseFlag == overrideToFalseFlag)
|
||||
return;
|
||||
_overrideToFalseFlag = overrideToFalseFlag;
|
||||
UpdateAnimationState();
|
||||
}
|
||||
|
||||
public static void UpdateAnimationState()
|
||||
{
|
||||
bool flag = true;
|
||||
if (_disableAnimationCount > 0 || _overrideToFalseFlag)
|
||||
flag = false;
|
||||
SetEnableState(flag);
|
||||
}
|
||||
|
||||
public static void PushDisableAnimations()
|
||||
{
|
||||
++_disableAnimationCount;
|
||||
if (_disableAnimationCount != 1)
|
||||
return;
|
||||
UpdateAnimationState();
|
||||
}
|
||||
|
||||
public static void PopDisableAnimations()
|
||||
{
|
||||
--_disableAnimationCount;
|
||||
if (_disableAnimationCount != 0)
|
||||
return;
|
||||
UpdateAnimationState();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.AnimationTemplate
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Render;
|
||||
using Microsoft.Iris.Session;
|
||||
using Microsoft.Iris.UI;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal class AnimationTemplate : ICloneable
|
||||
{
|
||||
private const float k_epsilon = 0.0001f;
|
||||
private const StopCommand k_defaultStopCommand = StopCommand.MoveToEnd;
|
||||
private string _debugIDName;
|
||||
private List<BaseKeyframe> _keyframesList;
|
||||
private int _loopCount;
|
||||
private StopCommandSet _StopCommandSet;
|
||||
|
||||
public AnimationTemplate()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public AnimationTemplate(string debugIDName)
|
||||
{
|
||||
_keyframesList = new List<BaseKeyframe>();
|
||||
DebugID = debugIDName;
|
||||
}
|
||||
|
||||
public string DebugID
|
||||
{
|
||||
get => _debugIDName;
|
||||
set => _debugIDName = value;
|
||||
}
|
||||
|
||||
public int Loop
|
||||
{
|
||||
get => _loopCount;
|
||||
set => _loopCount = value;
|
||||
}
|
||||
|
||||
public List<BaseKeyframe> Keyframes => _keyframesList;
|
||||
|
||||
public ActiveSequence Play(ViewItem vi)
|
||||
{
|
||||
AnimationArgs args = new AnimationArgs(vi);
|
||||
return Play(vi.RendererVisual, ref args, null);
|
||||
}
|
||||
|
||||
public ActiveSequence Play(
|
||||
IVisual visualTarget,
|
||||
ref AnimationArgs args,
|
||||
EventHandler onCompleteHandler)
|
||||
{
|
||||
ActiveSequence instance = CreateInstance(visualTarget, ref args);
|
||||
if (onCompleteHandler != null)
|
||||
instance.AnimationCompleted += onCompleteHandler;
|
||||
instance.Play();
|
||||
return instance;
|
||||
}
|
||||
|
||||
public ActiveSequence CreateInstance(
|
||||
IAnimatable animatableTarget,
|
||||
string property,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
if (_keyframesList.Count == 0)
|
||||
{
|
||||
ErrorManager.ReportError("Animations must have at least 2 keyframes to play");
|
||||
return null;
|
||||
}
|
||||
ActiveSequence aseq = new ActiveSequence(this, animatableTarget, UISession.Default);
|
||||
AnimationProxy[] animationProxyArray = new AnimationProxy[20];
|
||||
int[] numArray = new int[20];
|
||||
bool[] flagArray = new bool[20];
|
||||
foreach (BaseKeyframe keyframes in _keyframesList)
|
||||
{
|
||||
int type = (int)keyframes.Type;
|
||||
keyframes.AddtoAnimation(this, aseq, property, ref args, ref animationProxyArray[type]);
|
||||
++numArray[type];
|
||||
flagArray[type] |= keyframes.Time == 0.0;
|
||||
}
|
||||
for (int index = 0; index <= 19; ++index)
|
||||
{
|
||||
if (animationProxyArray[index] != null)
|
||||
{
|
||||
AnimationType animationType = (AnimationType)index;
|
||||
if (numArray[index] < 2)
|
||||
{
|
||||
ErrorManager.ReportError("Animation must have at least 2 keyframes of each type. Attempted to play an animation that only has {0} keyframe of type '{1}'.", numArray[index], animationType);
|
||||
return null;
|
||||
}
|
||||
if (!flagArray[index])
|
||||
{
|
||||
ErrorManager.ReportError("Animation must have a keyframe at time 0.0 for each type. Attempted to play an animation that has no start keyframe for type '{0}'", animationType);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return !aseq.ValidatePlayable() ? null : aseq;
|
||||
}
|
||||
|
||||
public ActiveSequence CreateInstance(
|
||||
IAnimatable animatableTarget,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
return CreateInstance(animatableTarget, null, ref args);
|
||||
}
|
||||
|
||||
public void AddKeyframe(BaseKeyframe key) => InsertSorted(key);
|
||||
|
||||
public BaseKeyframe GetKeyframe(float time)
|
||||
{
|
||||
int count = _keyframesList.Count;
|
||||
for (int index = 0; index < count; ++index)
|
||||
{
|
||||
BaseKeyframe keyframes = _keyframesList[index];
|
||||
if (IsSameTime(time, keyframes.Time))
|
||||
return keyframes;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void RemoveKeyframe(float time)
|
||||
{
|
||||
BaseKeyframe keyframe = GetKeyframe(time);
|
||||
if (keyframe == null)
|
||||
return;
|
||||
_keyframesList.Remove(keyframe);
|
||||
}
|
||||
|
||||
public StopCommand GetStopCommand(AnimationType paramType)
|
||||
{
|
||||
AnimationSystem.ValidateAnimationType(paramType);
|
||||
StopCommand stopCommand = StopCommand.MoveToEnd;
|
||||
if (_StopCommandSet != null)
|
||||
stopCommand = _StopCommandSet[paramType];
|
||||
return stopCommand;
|
||||
}
|
||||
|
||||
public void SetStopCommand(AnimationType paramType, StopCommand command)
|
||||
{
|
||||
AnimationSystem.ValidateAnimationType(paramType);
|
||||
if (_StopCommandSet == null)
|
||||
_StopCommandSet = new StopCommandSet(StopCommand.MoveToEnd);
|
||||
_StopCommandSet[paramType] = command;
|
||||
}
|
||||
|
||||
object ICloneable.Clone() => Clone();
|
||||
|
||||
public virtual object Clone()
|
||||
{
|
||||
AnimationTemplate anim = new AnimationTemplate(_debugIDName);
|
||||
CloneWorker(anim);
|
||||
return anim;
|
||||
}
|
||||
|
||||
protected virtual void CloneWorker(AnimationTemplate anim)
|
||||
{
|
||||
anim._loopCount = _loopCount;
|
||||
int count = _keyframesList.Count;
|
||||
for (int index = 0; index < count; ++index)
|
||||
anim._keyframesList.Add(_keyframesList[index].Clone());
|
||||
anim._debugIDName = _debugIDName;
|
||||
}
|
||||
|
||||
private void InsertSorted(BaseKeyframe key)
|
||||
{
|
||||
for (int index = _keyframesList.Count - 1; index >= 0; --index)
|
||||
{
|
||||
if (_keyframesList[index].Time < (double)key.Time)
|
||||
{
|
||||
_keyframesList.Insert(index + 1, key);
|
||||
return;
|
||||
}
|
||||
}
|
||||
_keyframesList.Insert(0, key);
|
||||
}
|
||||
|
||||
private static bool IsSameTime(float t1, float t2)
|
||||
{
|
||||
float num = t2 - t1;
|
||||
if (num < 0.0)
|
||||
num *= -1f;
|
||||
return num < 9.99999974737875E-05;
|
||||
}
|
||||
|
||||
internal class AnimationTemplateComparer : IComparer
|
||||
{
|
||||
public int Compare(object objx, object objy)
|
||||
{
|
||||
AnimationTemplate animationTemplate1 = objx as AnimationTemplate;
|
||||
AnimationTemplate animationTemplate2 = objy as AnimationTemplate;
|
||||
if (animationTemplate1 == null && animationTemplate2 == null)
|
||||
return 0;
|
||||
if (animationTemplate1 == null)
|
||||
return -1;
|
||||
return animationTemplate2 == null ? 1 : string.Compare(animationTemplate1.DebugID, animationTemplate2.DebugID, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.AnimationType
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal enum AnimationType
|
||||
{
|
||||
First = 0,
|
||||
Position = 0,
|
||||
Size = 1,
|
||||
Alpha = 2,
|
||||
Scale = 3,
|
||||
Rotate = 4,
|
||||
Orientation = 5,
|
||||
PositionX = 6,
|
||||
PositionY = 7,
|
||||
SizeX = 8,
|
||||
SizeY = 9,
|
||||
ScaleX = 10, // 0x0000000A
|
||||
ScaleY = 11, // 0x0000000B
|
||||
Float = 12, // 0x0000000C
|
||||
Vector2 = 13, // 0x0000000D
|
||||
Vector3 = 14, // 0x0000000E
|
||||
Vector4 = 15, // 0x0000000F
|
||||
CameraEye = 16, // 0x00000010
|
||||
CameraAt = 17, // 0x00000011
|
||||
CameraUp = 18, // 0x00000012
|
||||
CameraZn = 19, // 0x00000013
|
||||
Last = 19, // 0x00000013
|
||||
NumTypes = 20, // 0x00000014
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.BaseFloatKeyframe
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal abstract class BaseFloatKeyframe : BaseKeyframe
|
||||
{
|
||||
private float _value;
|
||||
|
||||
protected override void PopulateAnimationWorker(
|
||||
IAnimatable targetObject,
|
||||
AnimationProxy animation,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
float effectiveValue = GetEffectiveValue(targetObject, _value, ref args);
|
||||
animation.AddFloatKeyframe(this, effectiveValue);
|
||||
}
|
||||
|
||||
public float Value
|
||||
{
|
||||
get => _value;
|
||||
set => _value = value;
|
||||
}
|
||||
|
||||
public override object ObjectValue => Value;
|
||||
|
||||
public virtual float GetEffectiveValue(
|
||||
IAnimatable targetObject,
|
||||
float baseValue,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
return baseValue;
|
||||
}
|
||||
|
||||
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
|
||||
{
|
||||
float effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _value, ref args);
|
||||
Apply(animationTarget, effectiveValue);
|
||||
}
|
||||
|
||||
public abstract void Apply(IAnimatableOwner animationTarget, float value);
|
||||
|
||||
public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.BaseKeyframe
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Render;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal abstract class BaseKeyframe : ICloneable
|
||||
{
|
||||
private Interpolation _interpolation;
|
||||
private RelativeTo _relative;
|
||||
private float _timeValue;
|
||||
private static RendererProperty[] s_propertyMap = new RendererProperty[20];
|
||||
|
||||
static BaseKeyframe()
|
||||
{
|
||||
s_propertyMap[0] = new RendererProperty("Position");
|
||||
s_propertyMap[1] = new RendererProperty("Size");
|
||||
s_propertyMap[2] = new RendererProperty("Alpha");
|
||||
s_propertyMap[3] = new RendererProperty("Scale");
|
||||
s_propertyMap[4] = new RendererProperty("Rotation");
|
||||
s_propertyMap[5] = new RendererProperty("Orientation");
|
||||
s_propertyMap[6] = new RendererProperty("Position", "X", "X00");
|
||||
s_propertyMap[7] = new RendererProperty("Position", "Y", "0X0");
|
||||
s_propertyMap[8] = new RendererProperty("Size", "X", "X0");
|
||||
s_propertyMap[9] = new RendererProperty("Size", "Y", "0X");
|
||||
s_propertyMap[10] = new RendererProperty("Scale", "X", "X00");
|
||||
s_propertyMap[11] = new RendererProperty("Scale", "Y", "0X0");
|
||||
s_propertyMap[16] = new RendererProperty("CameraEye");
|
||||
s_propertyMap[17] = new RendererProperty("CameraAt");
|
||||
s_propertyMap[18] = new RendererProperty("CameraUp");
|
||||
s_propertyMap[19] = new RendererProperty("CameraZn");
|
||||
}
|
||||
|
||||
public BaseKeyframe()
|
||||
: this(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseKeyframe(float timeValue)
|
||||
{
|
||||
_timeValue = timeValue;
|
||||
_relative = RelativeTo.Final;
|
||||
}
|
||||
|
||||
public void AddtoAnimation(
|
||||
AnimationTemplate anim,
|
||||
ActiveSequence aseq,
|
||||
string property,
|
||||
ref AnimationArgs args,
|
||||
ref AnimationProxy animation)
|
||||
{
|
||||
if (animation == null)
|
||||
animation = CreateProxy(anim, aseq, property);
|
||||
PopulateAnimationWorker(aseq.Target, animation, ref args);
|
||||
}
|
||||
|
||||
protected virtual AnimationProxy CreateProxy(
|
||||
AnimationTemplate anim,
|
||||
ActiveSequence aseq,
|
||||
string property)
|
||||
{
|
||||
StopCommand stopCommand = anim.GetStopCommand(Type);
|
||||
RendererProperty rendererProperty = property != null ? new RendererProperty(property) : s_propertyMap[(int)Type];
|
||||
return new AnimationProxy(aseq, aseq.Target, Type, rendererProperty, anim.Loop, stopCommand);
|
||||
}
|
||||
|
||||
public BaseKeyframe Clone() => (BaseKeyframe)MemberwiseClone();
|
||||
|
||||
object ICloneable.Clone() => Clone();
|
||||
|
||||
protected abstract void PopulateAnimationWorker(
|
||||
IAnimatable targetObject,
|
||||
AnimationProxy animation,
|
||||
ref AnimationArgs args);
|
||||
|
||||
public float Time
|
||||
{
|
||||
get => _timeValue;
|
||||
set => _timeValue = value;
|
||||
}
|
||||
|
||||
public RelativeTo RelativeTo
|
||||
{
|
||||
get => _relative == null ? RelativeTo.Absolute : _relative;
|
||||
set => _relative = value;
|
||||
}
|
||||
|
||||
public bool IsRelativeToObject => RelativeTo.IsRelativeToObject;
|
||||
|
||||
public Interpolation Interpolation
|
||||
{
|
||||
get => _interpolation;
|
||||
set => _interpolation = value;
|
||||
}
|
||||
|
||||
public abstract AnimationType Type { get; }
|
||||
|
||||
public abstract object ObjectValue { get; }
|
||||
|
||||
public abstract void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args);
|
||||
|
||||
public abstract void MagnifyValue(float magnifyValue);
|
||||
|
||||
public virtual bool Multiply => false;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.Append("<");
|
||||
stringBuilder.Append(GetType().Name);
|
||||
stringBuilder.Append(" Time=\"");
|
||||
stringBuilder.Append(_timeValue);
|
||||
stringBuilder.Append("\"");
|
||||
if (_interpolation != null)
|
||||
{
|
||||
stringBuilder.Append(" Interpolation=\"");
|
||||
stringBuilder.Append(_interpolation.ToString());
|
||||
stringBuilder.Append("\"");
|
||||
}
|
||||
if (_relative != RelativeTo.Absolute)
|
||||
{
|
||||
stringBuilder.Append(" RelativeTo=\"");
|
||||
stringBuilder.Append(_relative);
|
||||
stringBuilder.Append("\"");
|
||||
}
|
||||
stringBuilder.Append(" Value=\"");
|
||||
stringBuilder.Append(ObjectValue);
|
||||
stringBuilder.Append("\"");
|
||||
stringBuilder.Append("/>");
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.BaseMultiplyFloatKeyframe
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal abstract class BaseMultiplyFloatKeyframe : BaseFloatKeyframe
|
||||
{
|
||||
public BaseMultiplyFloatKeyframe() => Value = 1f;
|
||||
|
||||
public override bool Multiply => true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.BaseMultiplyVector3Keyframe
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal abstract class BaseMultiplyVector3Keyframe : BaseVector3Keyframe
|
||||
{
|
||||
public BaseMultiplyVector3Keyframe() => Value = Vector3.UnitVector;
|
||||
|
||||
public override bool Multiply => true;
|
||||
|
||||
public override Vector3 GetEffectiveValue(
|
||||
IAnimatable targetObject,
|
||||
Vector3 baseValueVector,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
if (RelativeTo == RelativeTo.Final)
|
||||
baseValueVector *= GetRelativeToFinalValue(targetObject, ref args);
|
||||
return baseValueVector;
|
||||
}
|
||||
|
||||
public abstract Vector3 GetRelativeToFinalValue(
|
||||
IAnimatable targetObject,
|
||||
ref AnimationArgs args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.BaseRotationKeyframe
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Drawing;
|
||||
using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal abstract class BaseRotationKeyframe : BaseKeyframe
|
||||
{
|
||||
private Rotation _valueRotation;
|
||||
|
||||
public BaseRotationKeyframe() => _valueRotation = Rotation.Default;
|
||||
|
||||
protected override void PopulateAnimationWorker(
|
||||
IAnimatable targetObject,
|
||||
AnimationProxy animation,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
Rotation effectiveValue = GetEffectiveValue(targetObject, _valueRotation, ref args);
|
||||
animation.AddRotationKeyframe(this, effectiveValue);
|
||||
}
|
||||
|
||||
public Rotation Value
|
||||
{
|
||||
get => _valueRotation;
|
||||
set => _valueRotation = value;
|
||||
}
|
||||
|
||||
public override object ObjectValue => Value;
|
||||
|
||||
public virtual Rotation GetEffectiveValue(
|
||||
IAnimatable targetObject,
|
||||
Rotation baseValueRotation,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
return baseValueRotation;
|
||||
}
|
||||
|
||||
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
|
||||
{
|
||||
Rotation effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _valueRotation, ref args);
|
||||
Apply(animationTarget, effectiveValue);
|
||||
}
|
||||
|
||||
public abstract void Apply(IAnimatableOwner animationTarget, Rotation valueRotation);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.BaseVector2Keyframe
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal abstract class BaseVector2Keyframe : BaseKeyframe
|
||||
{
|
||||
private Vector2 _valueVector;
|
||||
|
||||
protected override void PopulateAnimationWorker(
|
||||
IAnimatable targetObject,
|
||||
AnimationProxy animation,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
Vector2 effectiveValue = GetEffectiveValue(targetObject, _valueVector, ref args);
|
||||
animation.AddVector2Keyframe(this, effectiveValue);
|
||||
}
|
||||
|
||||
public Vector2 Value
|
||||
{
|
||||
get => _valueVector;
|
||||
set => _valueVector = value;
|
||||
}
|
||||
|
||||
public override object ObjectValue => Value;
|
||||
|
||||
public virtual Vector2 GetEffectiveValue(
|
||||
IAnimatable targetObject,
|
||||
Vector2 baseValueVector,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
return baseValueVector;
|
||||
}
|
||||
|
||||
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
|
||||
{
|
||||
Vector2 effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _valueVector, ref args);
|
||||
Apply(animationTarget, effectiveValue);
|
||||
}
|
||||
|
||||
public abstract void Apply(IAnimatableOwner animationTarget, Vector2 valueVector);
|
||||
|
||||
public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Animations.BaseVector3Keyframe
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Render;
|
||||
|
||||
namespace Microsoft.Iris.Animations
|
||||
{
|
||||
internal abstract class BaseVector3Keyframe : BaseKeyframe
|
||||
{
|
||||
private Vector3 _valueVector;
|
||||
|
||||
protected override void PopulateAnimationWorker(
|
||||
IAnimatable targetObject,
|
||||
AnimationProxy animation,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
Vector3 effectiveValue = GetEffectiveValue(targetObject, _valueVector, ref args);
|
||||
animation.AddVector3Keyframe(this, effectiveValue);
|
||||
}
|
||||
|
||||
public Vector3 Value
|
||||
{
|
||||
get => _valueVector;
|
||||
set => _valueVector = value;
|
||||
}
|
||||
|
||||
public override object ObjectValue => Value;
|
||||
|
||||
public virtual Vector3 GetEffectiveValue(
|
||||
IAnimatable targetObject,
|
||||
Vector3 baseValueVector,
|
||||
ref AnimationArgs args)
|
||||
{
|
||||
return baseValueVector;
|
||||
}
|
||||
|
||||
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
|
||||
{
|
||||
Vector3 effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _valueVector, ref args);
|
||||
Apply(animationTarget, effectiveValue);
|
||||
}
|
||||
|
||||
public abstract void Apply(IAnimatableOwner animationTarget, Vector3 valueVector);
|
||||
|
||||
public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user