Simplified usages in UIX project

This commit is contained in:
Joshua Askharoun
2021-04-02 19:10:51 -05:00
parent 2b20ca46ad
commit c07b53bb0b
464 changed files with 14054 additions and 14064 deletions
+57 -57
View File
@@ -27,71 +27,71 @@ namespace Microsoft.Iris.Animations
IAnimatable animatableTarget,
UISession session)
{
this._animatableTarget = animatableTarget;
this._session = session;
this._template = template_;
this._ready = new Vector<AnimationProxy>();
_animatableTarget = animatableTarget;
_session = session;
_template = template_;
_ready = new Vector<AnimationProxy>();
}
protected override void OnDispose()
{
base.OnDispose();
Vector<AnimationProxy> animationCollection = this.GetAnimationCollection();
Vector<AnimationProxy> animationCollection = GetAnimationCollection();
if (animationCollection != null)
{
foreach (DisposableObject disposableObject in animationCollection)
disposableObject.Dispose(this);
this.FireComplete(false);
FireComplete(false);
}
this._session = null;
this._animatableTarget = null;
this._template = null;
this._ready = null;
_session = null;
_animatableTarget = null;
_template = null;
_ready = null;
}
public UISession Session => this._session;
public UISession Session => _session;
internal IAnimatable Target => this._animatableTarget;
internal IAnimatable Target => _animatableTarget;
public AnimationTemplate Template => this._template;
public AnimationTemplate Template => _template;
public bool Playing => this._playing != null;
public bool Playing => _playing != null;
internal Vector<AnimationProxy> PendingProxies => this._ready;
internal Vector<AnimationProxy> PendingProxies => _ready;
public void Play()
{
Vector<AnimationProxy> ready = this._ready;
this._ready = null;
Vector<AnimationProxy> ready = _ready;
_ready = null;
if (ready.Count > 0)
{
foreach (AnimationProxy animationProxy in ready)
animationProxy.Play();
this._playing = ready;
this.FireStart();
_playing = ready;
FireStart();
}
else
{
this.FireStart();
this.FireComplete(true);
FireStart();
FireComplete(true);
}
}
public void Stop() => this.Stop(null);
public void Stop() => Stop(null);
public void Stop(StopCommandSet stopSetCommand)
{
if (UIDispatcher.IsUIThread)
{
this.StopWorker(stopSetCommand);
StopWorker(stopSetCommand);
}
else
{
try
{
if (!this.Session.IsValid)
if (!Session.IsValid)
return;
DeferredCall.Post(DispatchPriority.High, new DeferredHandler(this.DeferredStop), stopSetCommand);
DeferredCall.Post(DispatchPriority.High, new DeferredHandler(DeferredStop), stopSetCommand);
}
catch (InvalidOperationException ex)
{
@@ -101,9 +101,9 @@ namespace Microsoft.Iris.Animations
private void StopWorker(StopCommandSet stopSetCommand)
{
if (this._playing == null)
if (_playing == null)
return;
foreach (AnimationProxy animationProxy in this._playing)
foreach (AnimationProxy animationProxy in _playing)
{
if (stopSetCommand != null)
animationProxy.Stop(stopSetCommand[animationProxy.Type]);
@@ -112,11 +112,11 @@ namespace Microsoft.Iris.Animations
}
}
private void DeferredStop(object args) => this.StopWorker((StopCommandSet)args);
private void DeferredStop(object args) => StopWorker((StopCommandSet)args);
public bool ValidatePlayable()
{
foreach (AnimationProxy animationProxy in this._ready)
foreach (AnimationProxy animationProxy in _ready)
{
if (!animationProxy.ValidatePlayable())
return false;
@@ -127,38 +127,38 @@ namespace Microsoft.Iris.Animations
internal void OnAttachChildAnimation(AnimationProxy child)
{
child.DeclareOwner(this);
this._ready.Add(child);
_ready.Add(child);
}
private Vector<AnimationProxy> GetAnimationCollection() => this._ready ?? this._playing;
private Vector<AnimationProxy> GetAnimationCollection() => _ready ?? _playing;
internal void OnDetachChildAnimation(AnimationProxy child, float progress)
{
Vector<AnimationProxy> animationCollection = this.GetAnimationCollection();
Vector<AnimationProxy> animationCollection = GetAnimationCollection();
if (animationCollection == null)
return;
animationCollection.Remove(child);
child.Dispose(this);
if (_lastProgress < (double)progress)
this._lastProgress = progress;
if (animationCollection != this._playing || animationCollection.Count != 0)
_lastProgress = progress;
if (animationCollection != _playing || animationCollection.Count != 0)
return;
this.FireComplete(true);
FireComplete(true);
}
private void FireStart() => this.OnStart();
private void FireStart() => OnStart();
private void FireComplete(bool notify)
{
if (this._playing != null)
this._playing = null;
this.OnStop(this._lastProgress, notify);
if (_playing != null)
_playing = null;
OnStop(_lastProgress, notify);
}
public StopCommandSet GetStopCommandSet()
{
StopCommandSet stopCommandSet = null;
foreach (AnimationProxy animation in this.GetAnimationCollection())
foreach (AnimationProxy animation in GetAnimationCollection())
{
if (animation.HasDynamicKeyframes)
{
@@ -172,7 +172,7 @@ namespace Microsoft.Iris.Animations
public ActiveTransitions GetActiveTransitions()
{
Vector<AnimationProxy> animationCollection = this.GetAnimationCollection();
Vector<AnimationProxy> animationCollection = GetAnimationCollection();
ActiveTransitions activeTransitions = ActiveTransitions.None;
foreach (AnimationProxy animationProxy in animationCollection)
{
@@ -251,24 +251,24 @@ namespace Microsoft.Iris.Animations
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("{ActiveSequence Template=\"");
if (this._template.DebugID != null)
if (_template.DebugID != null)
{
stringBuilder.Append(this._template.DebugID);
stringBuilder.Append(_template.DebugID);
}
else
{
Animation template = this._template as Animation;
Animation template = _template as Animation;
if (template != null)
stringBuilder.Append(template.Type);
else
stringBuilder.Append("<Unknown>");
}
stringBuilder.Append("\", Target=");
stringBuilder.Append(this._animatableTarget.GetType().Name);
if (this._animatableTarget is IVisual)
stringBuilder.Append(_animatableTarget.GetType().Name);
if (_animatableTarget is IVisual)
{
stringBuilder.Append(", IVisual=");
stringBuilder.Append(((IVisual)this._animatableTarget).DebugID);
stringBuilder.Append(((IVisual)_animatableTarget).DebugID);
}
stringBuilder.Append("}");
return stringBuilder.ToString();
@@ -282,27 +282,27 @@ namespace Microsoft.Iris.Animations
internal void OnStart()
{
++this._playingCount;
if (this._playingCount != 1 || this.AnimationStarted == null)
++_playingCount;
if (_playingCount != 1 || AnimationStarted == null)
return;
this.AnimationStarted(this, EventArgs.Empty);
AnimationStarted(this, EventArgs.Empty);
}
internal void OnStop(float progress, bool notify)
{
--this._playingCount;
if (notify && this._playingCount == 0)
--_playingCount;
if (notify && _playingCount == 0)
{
EventArgs e = new AnimationCompleteArgs(progress);
if (this.AnimationCompleted != null)
this.AnimationCompleted(this, e);
if (this.AfterAnimationCompleted == null)
if (AnimationCompleted != null)
AnimationCompleted(this, e);
if (AfterAnimationCompleted == null)
return;
this.AfterAnimationCompleted(this, e);
AfterAnimationCompleted(this, e);
}
else
{
int playingCount = this._playingCount;
int playingCount = _playingCount;
}
}
}
@@ -18,17 +18,17 @@ namespace Microsoft.Iris.Animations
float baseValue,
ref AnimationArgs args)
{
return this.RelativeTo == RelativeTo.Final ? baseValue * args.NewAlpha : baseValue;
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 = this.Value * magnifyValue;
float num = Value * magnifyValue;
if (num > 1.0)
num = 1f;
this.Value = num;
Value = num;
}
}
}
+40 -40
View File
@@ -24,15 +24,15 @@ namespace Microsoft.Iris.Animations
public Animation()
{
this._type = AnimationEventType.Idle;
this._bitsBitVector = new BitVector32();
this._dataMap = new DynamicData();
_type = AnimationEventType.Idle;
_bitsBitVector = new BitVector32();
_dataMap = new DynamicData();
}
public override object Clone()
{
Animation animation = new Animation();
this.CloneWorker(animation);
CloneWorker(animation);
return animation;
}
@@ -40,64 +40,64 @@ namespace Microsoft.Iris.Animations
{
base.CloneWorker(rawAnimation);
Animation animation = (Animation)rawAnimation;
animation.Type = this.Type;
if (this.GetBit(Bits.CenterPointScale))
animation.CenterPointPercent = this.CenterPointPercent;
if (this.GetBit(Bits.RotationAxis))
animation.RotationAxis = this.RotationAxis;
animation.DisableMouseInput = this.DisableMouseInput;
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 (this.GetBit(Bits.CenterPointScale))
args.ViewItem.VisualCenterPoint = this.CenterPointPercent;
if (!this.GetBit(Bits.RotationAxis))
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, this.RotationAxis);
args.ViewItem.VisualRotation = new Rotation(visualRotation.AngleRadians, RotationAxis);
}
public AnimationEventType Type
{
get => this._type;
set => this._type = value;
get => _type;
set => _type = value;
}
public Vector3 CenterPointPercent
{
get => !this.GetBit(Bits.CenterPointScale) ? Vector3.Zero : (Vector3)this.GetData(s_centerPointScaleProperty);
get => !GetBit(Bits.CenterPointScale) ? Vector3.Zero : (Vector3)GetData(s_centerPointScaleProperty);
set
{
if (!(this.CenterPointPercent != value))
if (!(CenterPointPercent != value))
return;
this.SetData(s_centerPointScaleProperty, value);
this.SetBit(Bits.CenterPointScale, true);
SetData(s_centerPointScaleProperty, value);
SetBit(Bits.CenterPointScale, true);
}
}
public Vector3 RotationAxis
{
get => !this.GetBit(Bits.RotationAxis) ? Rotation.Default.Axis : (Vector3)this.GetData(s_rotationAxisProperty);
get => !GetBit(Bits.RotationAxis) ? Rotation.Default.Axis : (Vector3)GetData(s_rotationAxisProperty);
set
{
if (!(this.RotationAxis != value))
if (!(RotationAxis != value))
return;
this.SetData(s_rotationAxisProperty, value);
this.SetBit(Bits.RotationAxis, true);
SetData(s_rotationAxisProperty, value);
SetBit(Bits.RotationAxis, true);
}
}
public bool DisableMouseInput
{
get => this.GetBit(Bits.DisableMouseInput);
set => this.SetBit(Bits.DisableMouseInput, value);
get => GetBit(Bits.DisableMouseInput);
set => SetBit(Bits.DisableMouseInput, value);
}
AnimationTemplate IAnimationProvider.Build(
ref AnimationArgs args)
{
this.PrepareToPlay(ref args);
PrepareToPlay(ref args);
return this;
}
@@ -107,38 +107,38 @@ namespace Microsoft.Iris.Animations
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("{AnimationTemplate ID=");
stringBuilder.Append(this.DebugID);
stringBuilder.Append(DebugID);
stringBuilder.Append(", Loop=");
stringBuilder.Append(this.Loop);
stringBuilder.Append(Loop);
stringBuilder.Append(", KeyframeCount=");
stringBuilder.Append(this.Keyframes.Count);
stringBuilder.Append(Keyframes.Count);
stringBuilder.Append("}");
return stringBuilder.ToString();
}
private bool GetBit(Animation.Bits bit) => this._bitsBitVector[(int)bit];
private bool GetBit(Animation.Bits bit) => _bitsBitVector[(int)bit];
private void SetBit(Animation.Bits bit, bool value) => this._bitsBitVector[(int)bit] = value;
private void SetBit(Animation.Bits bit, bool value) => _bitsBitVector[(int)bit] = value;
private bool ChangeBit(Animation.Bits bit, bool value)
{
if (this._bitsBitVector[(int)bit] == value)
if (_bitsBitVector[(int)bit] == value)
return false;
this._bitsBitVector[(int)bit] = value;
_bitsBitVector[(int)bit] = value;
return true;
}
protected object GetData(DataCookie cookie) => this._dataMap.GetData(cookie);
protected object GetData(DataCookie cookie) => _dataMap.GetData(cookie);
protected void SetData(DataCookie cookie, object value) => this._dataMap.SetData(cookie, value);
protected void SetData(DataCookie cookie, object value) => _dataMap.SetData(cookie, value);
protected Delegate GetEventHandler(EventCookie cookie) => this._dataMap.GetEventHandler(cookie);
protected Delegate GetEventHandler(EventCookie cookie) => _dataMap.GetEventHandler(cookie);
protected void AddEventHandler(EventCookie cookie, Delegate handlerToAdd) => this._dataMap.AddEventHandler(cookie, handlerToAdd);
protected void AddEventHandler(EventCookie cookie, Delegate handlerToAdd) => _dataMap.AddEventHandler(cookie, handlerToAdd);
protected void RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove) => this._dataMap.RemoveEventHandler(cookie, handlerToRemove);
protected void RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove) => _dataMap.RemoveEventHandler(cookie, handlerToRemove);
protected void RemoveEventHandlers(EventCookie cookie) => this._dataMap.RemoveEventHandlers(cookie);
protected void RemoveEventHandlers(EventCookie cookie) => _dataMap.RemoveEventHandlers(cookie);
private static uint GetKey(EventCookie cookie) => EventCookie.ToUInt32(cookie);
+38 -38
View File
@@ -34,25 +34,25 @@ namespace Microsoft.Iris.Animations
public AnimationArgs(Camera cam)
{
this.ViewItem = null;
this.OldPosition = Vector3.Zero;
this.OldSize = Vector2.Zero;
this.OldScale = Vector3.Zero;
this.OldRotation = Rotation.Default;
this.OldAlpha = 0.0f;
this.NewPosition = Vector3.Zero;
this.NewSize = Vector2.Zero;
this.NewScale = Vector3.Zero;
this.NewRotation = Rotation.Default;
this.NewAlpha = 0.0f;
this.OldEye = cam.Eye;
this.NewEye = cam.Eye;
this.OldAt = cam.At;
this.NewAt = cam.At;
this.OldUp = cam.Up;
this.NewUp = cam.Up;
this.OldZn = cam.Zn;
this.NewZn = cam.Zn;
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(
@@ -68,25 +68,25 @@ namespace Microsoft.Iris.Animations
Rotation newRotation,
float newAlpha)
{
this.ViewItem = vi;
this.OldPosition = oldPosition;
this.OldSize = oldSize;
this.OldScale = oldScale;
this.OldRotation = oldRotation;
this.OldAlpha = oldAlpha;
this.NewPosition = newPosition;
this.NewSize = newSize;
this.NewScale = newScale;
this.NewRotation = newRotation;
this.NewAlpha = newAlpha;
this.OldEye = Vector3.Zero;
this.NewEye = Vector3.Zero;
this.OldAt = Vector3.Zero;
this.NewAt = Vector3.Zero;
this.OldUp = Vector3.Zero;
this.NewUp = Vector3.Zero;
this.OldZn = 0.0f;
this.NewZn = 0.0f;
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(
@@ -12,8 +12,8 @@ namespace Microsoft.Iris.Animations
{
private float _progress;
public AnimationCompleteArgs(float progress) => this._progress = progress;
public AnimationCompleteArgs(float progress) => _progress = progress;
public float Progress => this._progress;
public float Progress => _progress;
}
}
@@ -16,32 +16,32 @@ namespace Microsoft.Iris.Animations
public event EventHandler Completed;
public bool Playing => this._playing > 0;
public bool Playing => _playing > 0;
internal void AssociateWithAnimationInstance(ActiveSequence anim)
{
anim.AnimationCompleted += new EventHandler(this.OnAnimationCompleted);
++this._playing;
if (this._playing != 1)
anim.AnimationCompleted += new EventHandler(OnAnimationCompleted);
++_playing;
if (_playing != 1)
return;
this.FireNotification(NotificationID.Playing);
FireNotification(NotificationID.Playing);
}
internal void FireCompleted()
{
if (this.Completed != null)
this.Completed(this, EventArgs.Empty);
this.FireNotification(NotificationID.Completed);
if (Completed != null)
Completed(this, EventArgs.Empty);
FireNotification(NotificationID.Completed);
}
private void OnAnimationCompleted(object sender, EventArgs args)
{
((ActiveSequence)sender).AnimationCompleted -= new EventHandler(this.OnAnimationCompleted);
--this._playing;
if (this._playing != 0)
((ActiveSequence)sender).AnimationCompleted -= new EventHandler(OnAnimationCompleted);
--_playing;
if (_playing != 0)
return;
this.FireNotification(NotificationID.Playing);
this.FireCompleted();
FireNotification(NotificationID.Playing);
FireCompleted();
}
}
}
@@ -32,49 +32,49 @@ namespace Microsoft.Iris.Animations
public AnimationManager(IRenderSession session)
{
this._session = session;
this._orphans = new Vector<OrphanedVisualCollection>();
this._session.AnimationSystem.UpdatesPerSecond = session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi ? 0 : 3;
this._session.AnimationSystem.BackCompat = true;
_session = session;
_orphans = new Vector<OrphanedVisualCollection>();
_session.AnimationSystem.UpdatesPerSecond = session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi ? 0 : 3;
_session.AnimationSystem.BackCompat = true;
}
~AnimationManager() => this.Dispose(false);
~AnimationManager() => Dispose(false);
public void Dispose()
{
GC.SuppressFinalize(this);
this.Dispose(true);
Dispose(true);
}
protected virtual void Dispose(bool inDisposeFlag)
{
this._shuttingDown = true;
_shuttingDown = true;
if (!inDisposeFlag)
return;
foreach (DisposableObject orphan in this._orphans)
foreach (DisposableObject orphan in _orphans)
orphan.Dispose(this);
this._orphans.Clear();
_orphans.Clear();
}
internal bool ShuttingDown => this._shuttingDown;
internal bool ShuttingDown => _shuttingDown;
public void SetGlobalSpeedAdjustment(float value)
{
this.ValidateConnected();
this._session.AnimationSystem.SpeedAdjustment = value;
ValidateConnected();
_session.AnimationSystem.SpeedAdjustment = value;
}
public void PulseTimeAdvance(int pulseSize)
{
this.ValidateConnected();
this._session.AnimationSystem.PulseTimeAdvance(pulseSize);
ValidateConnected();
_session.AnimationSystem.PulseTimeAdvance(pulseSize);
}
public void RegisterAnimatedOrphans(OrphanedVisualCollection orphan) => this._orphans.Add(orphan);
public void RegisterAnimatedOrphans(OrphanedVisualCollection orphan) => _orphans.Add(orphan);
public void UnregisterAnimatedOrphans(OrphanedVisualCollection orphan) => this._orphans.Remove(orphan);
public void UnregisterAnimatedOrphans(OrphanedVisualCollection orphan) => _orphans.Remove(orphan);
public bool CanPlayAnimationType(AnimationType type) => this._session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi || type == AnimationType.Position || (type == AnimationType.Size || type == AnimationType.Scale) || type == AnimationType.Alpha;
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()
{
@@ -82,27 +82,27 @@ namespace Microsoft.Iris.Animations
internal IKeyframeAnimation BuildAnimation(AnimationProxy owner)
{
this.ValidateConnected();
ValidateConnected();
IKeyframeAnimation keyframeAnimation = null;
switch (owner.Type)
{
case AnimationType.Position:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultPositionInput);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultPositionInput);
break;
case AnimationType.Size:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultSizeInput);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultSizeInput);
break;
case AnimationType.Alpha:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultAlphaInput);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultAlphaInput);
break;
case AnimationType.Scale:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultScaleInput);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultScaleInput);
break;
case AnimationType.Rotate:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultRotationInput);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultRotationInput);
break;
case AnimationType.Orientation:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultOrientationInput);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultOrientationInput);
break;
case AnimationType.PositionX:
case AnimationType.PositionY:
@@ -111,28 +111,28 @@ namespace Microsoft.Iris.Animations
case AnimationType.ScaleX:
case AnimationType.ScaleY:
case AnimationType.Float:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultFloatInput);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultFloatInput);
break;
case AnimationType.Vector2:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector2Input);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector2Input);
break;
case AnimationType.Vector3:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector3Input);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector3Input);
break;
case AnimationType.Vector4:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector4Input);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector4Input);
break;
case AnimationType.CameraEye:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraEyeInput);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraEyeInput);
break;
case AnimationType.CameraAt:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraAtInput);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraAtInput);
break;
case AnimationType.CameraUp:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraUpInput);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraUpInput);
break;
case AnimationType.CameraZn:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraZnInput);
keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraZnInput);
break;
}
return keyframeAnimation;
+71 -71
View File
@@ -34,50 +34,50 @@ namespace Microsoft.Iris.Animations
{
UISession.Validate(activeSequence.Session);
AnimationSystem.ValidateAnimationType(createType);
this._activeSequence = activeSequence;
this._type = createType;
this._animatableTarget = animatableTarget;
this._rendererProperty = rendererProperty;
this._animation = this._activeSequence.Session.AnimationManager.BuildAnimation(this);
this.CommonCreate(loopCount, stopCmd);
_activeSequence = activeSequence;
_type = createType;
_animatableTarget = animatableTarget;
_rendererProperty = rendererProperty;
_animation = _activeSequence.Session.AnimationManager.BuildAnimation(this);
CommonCreate(loopCount, stopCmd);
}
private void CommonCreate(int loopCount, StopCommand stopCmd)
{
this._animation.RepeatCount = loopCount;
this._animation.AsyncNotifyEvent += new AsyncNotifyHandler(this.OnAsyncNotification);
this._animation.AddStageEvent(AnimationStage.Complete, new AnimationEvent(_animation, "AsyncNotify", 1U));
this._animation.AddStageEvent(AnimationStage.Reset, new AnimationEvent(_animation, "AsyncNotify", 2U));
this.SetStopCommand(stopCmd);
this._activeSequence.OnAttachChildAnimation(this);
_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()
{
this.CleanupWorker(0.0f, false);
CleanupWorker(0.0f, false);
base.OnDispose();
}
public UISession Session => this._activeSequence.Session;
public UISession Session => _activeSequence.Session;
public AnimationType Type => this._type;
public AnimationType Type => _type;
public bool HasDynamicKeyframes => this._dynamicFlag;
public bool HasDynamicKeyframes => _dynamicFlag;
internal bool DoNotAutoRelease
{
get => this._doNotAutoReleaseFlag;
set => this._doNotAutoReleaseFlag = value;
get => _doNotAutoReleaseFlag;
set => _doNotAutoReleaseFlag = value;
}
public void AddFloatKeyframe(BaseKeyframe keyframe, float value)
{
++this._keyframesValue;
++_keyframesValue;
AnimationInput animationInput1;
if (keyframe.IsRelativeToObject)
{
this._dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask);
_dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
if (keyframe.Multiply && value != 1.0)
{
AnimationInput animationInput2 = new ConstantAnimationInput(value);
@@ -91,17 +91,17 @@ namespace Microsoft.Iris.Animations
}
else
animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
_animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
}
public void AddVector2Keyframe(BaseKeyframe keyframe, Vector2 value)
{
++this._keyframesValue;
++_keyframesValue;
AnimationInput animationInput1;
if (keyframe.IsRelativeToObject)
{
this._dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask);
_dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
if (keyframe.Multiply && value != Vector2.UnitVector)
{
AnimationInput animationInput2 = new ConstantAnimationInput(value);
@@ -115,17 +115,17 @@ namespace Microsoft.Iris.Animations
}
else
animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
_animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
}
public void AddVector3Keyframe(BaseKeyframe keyframe, Vector3 value)
{
++this._keyframesValue;
++_keyframesValue;
AnimationInput animationInput1;
if (keyframe.IsRelativeToObject)
{
this._dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask);
_dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
if (keyframe.Multiply && value != Vector3.UnitVector)
{
AnimationInput animationInput2 = new ConstantAnimationInput(value);
@@ -139,17 +139,17 @@ namespace Microsoft.Iris.Animations
}
else
animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
_animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
}
public void AddVector4Keyframe(BaseKeyframe keyframe, Vector4 value)
{
++this._keyframesValue;
++_keyframesValue;
AnimationInput animationInput1;
if (keyframe.IsRelativeToObject)
{
this._dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask);
_dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
if (keyframe.Multiply && value != Vector4.UnitVector)
{
AnimationInput animationInput2 = new ConstantAnimationInput(value);
@@ -163,23 +163,23 @@ namespace Microsoft.Iris.Animations
}
else
animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
_animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
}
public void AddRotationKeyframe(BaseKeyframe keyframe, Rotation value)
{
if (keyframe.Type != AnimationType.Orientation)
{
this.AddVector4Keyframe(keyframe, new Vector4(value.Axis.X, value.Axis.Y, value.Axis.Z, value.AngleRadians));
AddVector4Keyframe(keyframe, new Vector4(value.Axis.X, value.Axis.Y, value.Axis.Z, value.AngleRadians));
}
else
{
++this._keyframesValue;
++_keyframesValue;
AnimationInput animationInput1;
if (keyframe.IsRelativeToObject)
{
this._dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask);
_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));
@@ -190,7 +190,7 @@ namespace Microsoft.Iris.Animations
animationInput1 = new ConstantAnimationInput(new Quaternion(value.Axis, value.AngleRadians));
AnimationInterpolation interpolation = GenerateInterpolation(keyframe.Interpolation);
interpolation.UseSphericalCombination = true;
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, interpolation));
_animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, interpolation));
}
}
@@ -199,21 +199,21 @@ namespace Microsoft.Iris.Animations
switch (stopCmd)
{
case StopCommand.LeaveCurrent:
this._animation.ResetBehavior = AnimationResetBehavior.LeaveCurrent;
_animation.ResetBehavior = AnimationResetBehavior.LeaveCurrent;
break;
case StopCommand.MoveToBegin:
this._animation.ResetBehavior = AnimationResetBehavior.SetInitialValue;
_animation.ResetBehavior = AnimationResetBehavior.SetInitialValue;
break;
case StopCommand.MoveToEnd:
this._animation.ResetBehavior = AnimationResetBehavior.SetFinalValue;
_animation.ResetBehavior = AnimationResetBehavior.SetFinalValue;
break;
}
this._animation.AutoReset = true;
_animation.AutoReset = true;
}
public bool ValidatePlayable()
{
if (this._keyframesValue >= 2)
if (_keyframesValue >= 2)
return true;
ErrorManager.ReportError("Animations must have at least 2 keyframes to play");
return false;
@@ -221,50 +221,50 @@ namespace Microsoft.Iris.Animations
public void Play()
{
if (!this.ValidatePlayable())
if (!ValidatePlayable())
return;
if (!this._activeSequence.Session.AnimationManager.CanPlayAnimationType(this._type))
if (!_activeSequence.Session.AnimationManager.CanPlayAnimationType(_type))
{
this.Cleanup(0.0f, true);
Cleanup(0.0f, true);
}
else
{
if (this._playingFlag || this._animation == null || !this.Session.IsValid)
if (_playingFlag || _animation == null || !Session.IsValid)
return;
this._animation.AddTarget(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.TargetMask);
this._animation.Play();
this._playingFlag = true;
_animation.AddTarget(_animatableTarget, _rendererProperty.Property, _rendererProperty.TargetMask);
_animation.Play();
_playingFlag = true;
}
}
public void Stop() => this.StopWorker(false, StopCommand.MoveToEnd);
public void Stop() => StopWorker(false, StopCommand.MoveToEnd);
public void Stop(StopCommand stopCommand) => this.StopWorker(true, stopCommand);
public void Stop(StopCommand stopCommand) => StopWorker(true, stopCommand);
private void StopWorker(bool stopCommandFlag, StopCommand stopCommand)
{
if (!this._playingFlag)
if (!_playingFlag)
return;
this._playingFlag = false;
if (this._animation == null || !this.Session.IsValid)
_playingFlag = false;
if (_animation == null || !Session.IsValid)
return;
if (stopCommandFlag)
this.SetStopCommand(stopCommand);
this._animation.Reset();
this._animation.RemoveAllTargets();
SetStopCommand(stopCommand);
_animation.Reset();
_animation.RemoveAllTargets();
}
private void Cleanup(float progress, bool forceDeferFlag)
{
if (this._animation == null)
if (_animation == null)
return;
if (UIDispatcher.IsUIThread && !forceDeferFlag)
{
this.CleanupWorker(progress, true);
CleanupWorker(progress, true);
}
else
{
if (!this.Session.IsValid)
if (!Session.IsValid)
return;
DeferredCall.Post(DispatchPriority.Housekeeping, s_deferredCleanupWorker, this);
}
@@ -272,17 +272,17 @@ namespace Microsoft.Iris.Animations
private void CleanupWorker(float progress, bool withNotifications)
{
this._playingFlag = false;
if (this._animation != null)
_playingFlag = false;
if (_animation != null)
{
this._animation.AsyncNotifyEvent -= new AsyncNotifyHandler(this.OnAsyncNotification);
this._animation.UnregisterUsage(this);
this._animation = null;
_animation.AsyncNotifyEvent -= new AsyncNotifyHandler(OnAsyncNotification);
_animation.UnregisterUsage(this);
_animation = null;
}
this._animatableTarget = null;
_animatableTarget = null;
if (!withNotifications)
return;
this._activeSequence.OnDetachChildAnimation(this, progress);
_activeSequence.OnDetachChildAnimation(this, progress);
}
private static void DeferredCleanupWorker(object args) => (args as AnimationProxy).CleanupWorker(0.0f, true);
@@ -322,10 +322,10 @@ namespace Microsoft.Iris.Animations
switch (nCookie)
{
case 1:
this.Cleanup(0.0f, false);
Cleanup(0.0f, false);
break;
case 2:
this.Cleanup(0.0f, false);
Cleanup(0.0f, false);
break;
}
}
@@ -29,28 +29,28 @@ namespace Microsoft.Iris.Animations
public AnimationTemplate(string debugIDName)
{
this._keyframesList = new List<BaseKeyframe>();
this.DebugID = debugIDName;
_keyframesList = new List<BaseKeyframe>();
DebugID = debugIDName;
}
public string DebugID
{
get => this._debugIDName;
set => this._debugIDName = value;
get => _debugIDName;
set => _debugIDName = value;
}
public int Loop
{
get => this._loopCount;
set => this._loopCount = value;
get => _loopCount;
set => _loopCount = value;
}
public List<BaseKeyframe> Keyframes => this._keyframesList;
public List<BaseKeyframe> Keyframes => _keyframesList;
public ActiveSequence Play(ViewItem vi)
{
AnimationArgs args = new AnimationArgs(vi);
return this.Play(vi.RendererVisual, ref args, null);
return Play(vi.RendererVisual, ref args, null);
}
public ActiveSequence Play(
@@ -58,7 +58,7 @@ namespace Microsoft.Iris.Animations
ref AnimationArgs args,
EventHandler onCompleteHandler)
{
ActiveSequence instance = this.CreateInstance(visualTarget, ref args);
ActiveSequence instance = CreateInstance(visualTarget, ref args);
if (onCompleteHandler != null)
instance.AnimationCompleted += onCompleteHandler;
instance.Play();
@@ -70,7 +70,7 @@ namespace Microsoft.Iris.Animations
string property,
ref AnimationArgs args)
{
if (this._keyframesList.Count == 0)
if (_keyframesList.Count == 0)
{
ErrorManager.ReportError("Animations must have at least 2 keyframes to play");
return null;
@@ -79,7 +79,7 @@ namespace Microsoft.Iris.Animations
AnimationProxy[] animationProxyArray = new AnimationProxy[20];
int[] numArray = new int[20];
bool[] flagArray = new bool[20];
foreach (BaseKeyframe keyframes in this._keyframesList)
foreach (BaseKeyframe keyframes in _keyframesList)
{
int type = (int)keyframes.Type;
keyframes.AddtoAnimation(this, aseq, property, ref args, ref animationProxyArray[type]);
@@ -110,17 +110,17 @@ namespace Microsoft.Iris.Animations
IAnimatable animatableTarget,
ref AnimationArgs args)
{
return this.CreateInstance(animatableTarget, null, ref args);
return CreateInstance(animatableTarget, null, ref args);
}
public void AddKeyframe(BaseKeyframe key) => this.InsertSorted(key);
public void AddKeyframe(BaseKeyframe key) => InsertSorted(key);
public BaseKeyframe GetKeyframe(float time)
{
int count = this._keyframesList.Count;
int count = _keyframesList.Count;
for (int index = 0; index < count; ++index)
{
BaseKeyframe keyframes = this._keyframesList[index];
BaseKeyframe keyframes = _keyframesList[index];
if (IsSameTime(time, keyframes.Time))
return keyframes;
}
@@ -129,58 +129,58 @@ namespace Microsoft.Iris.Animations
public void RemoveKeyframe(float time)
{
BaseKeyframe keyframe = this.GetKeyframe(time);
BaseKeyframe keyframe = GetKeyframe(time);
if (keyframe == null)
return;
this._keyframesList.Remove(keyframe);
_keyframesList.Remove(keyframe);
}
public StopCommand GetStopCommand(AnimationType paramType)
{
AnimationSystem.ValidateAnimationType(paramType);
StopCommand stopCommand = StopCommand.MoveToEnd;
if (this._StopCommandSet != null)
stopCommand = this._StopCommandSet[paramType];
if (_StopCommandSet != null)
stopCommand = _StopCommandSet[paramType];
return stopCommand;
}
public void SetStopCommand(AnimationType paramType, StopCommand command)
{
AnimationSystem.ValidateAnimationType(paramType);
if (this._StopCommandSet == null)
this._StopCommandSet = new StopCommandSet(StopCommand.MoveToEnd);
this._StopCommandSet[paramType] = command;
if (_StopCommandSet == null)
_StopCommandSet = new StopCommandSet(StopCommand.MoveToEnd);
_StopCommandSet[paramType] = command;
}
object ICloneable.Clone() => this.Clone();
object ICloneable.Clone() => Clone();
public virtual object Clone()
{
AnimationTemplate anim = new AnimationTemplate(this._debugIDName);
this.CloneWorker(anim);
AnimationTemplate anim = new AnimationTemplate(_debugIDName);
CloneWorker(anim);
return anim;
}
protected virtual void CloneWorker(AnimationTemplate anim)
{
anim._loopCount = this._loopCount;
int count = this._keyframesList.Count;
anim._loopCount = _loopCount;
int count = _keyframesList.Count;
for (int index = 0; index < count; ++index)
anim._keyframesList.Add(this._keyframesList[index].Clone());
anim._debugIDName = this._debugIDName;
anim._keyframesList.Add(_keyframesList[index].Clone());
anim._debugIDName = _debugIDName;
}
private void InsertSorted(BaseKeyframe key)
{
for (int index = this._keyframesList.Count - 1; index >= 0; --index)
for (int index = _keyframesList.Count - 1; index >= 0; --index)
{
if (_keyframesList[index].Time < (double)key.Time)
{
this._keyframesList.Insert(index + 1, key);
_keyframesList.Insert(index + 1, key);
return;
}
}
this._keyframesList.Insert(0, key);
_keyframesList.Insert(0, key);
}
private static bool IsSameTime(float t1, float t2)
@@ -17,14 +17,14 @@ namespace Microsoft.Iris.Animations
AnimationProxy animation,
ref AnimationArgs args)
{
float effectiveValue = this.GetEffectiveValue(targetObject, this._value, ref args);
float effectiveValue = GetEffectiveValue(targetObject, _value, ref args);
animation.AddFloatKeyframe(this, effectiveValue);
}
public float Value
{
get => this._value;
set => this._value = value;
get => _value;
set => _value = value;
}
public override object ObjectValue => Value;
@@ -39,12 +39,12 @@ namespace Microsoft.Iris.Animations
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
{
float effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._value, ref args);
this.Apply(animationTarget, effectiveValue);
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) => this.Value *= magnifyValue;
public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue;
}
}
+22 -22
View File
@@ -44,8 +44,8 @@ namespace Microsoft.Iris.Animations
public BaseKeyframe(float timeValue)
{
this._timeValue = timeValue;
this._relative = RelativeTo.Final;
_timeValue = timeValue;
_relative = RelativeTo.Final;
}
public void AddtoAnimation(
@@ -56,8 +56,8 @@ namespace Microsoft.Iris.Animations
ref AnimationProxy animation)
{
if (animation == null)
animation = this.CreateProxy(anim, aseq, property);
this.PopulateAnimationWorker(aseq.Target, animation, ref args);
animation = CreateProxy(anim, aseq, property);
PopulateAnimationWorker(aseq.Target, animation, ref args);
}
protected virtual AnimationProxy CreateProxy(
@@ -65,14 +65,14 @@ namespace Microsoft.Iris.Animations
ActiveSequence aseq,
string property)
{
StopCommand stopCommand = anim.GetStopCommand(this.Type);
RendererProperty rendererProperty = property != null ? new RendererProperty(property) : s_propertyMap[(int)this.Type];
return new AnimationProxy(aseq, aseq.Target, this.Type, rendererProperty, anim.Loop, stopCommand);
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)this.MemberwiseClone();
public BaseKeyframe Clone() => (BaseKeyframe)MemberwiseClone();
object ICloneable.Clone() => this.Clone();
object ICloneable.Clone() => Clone();
protected abstract void PopulateAnimationWorker(
IAnimatable targetObject,
@@ -81,22 +81,22 @@ namespace Microsoft.Iris.Animations
public float Time
{
get => this._timeValue;
set => this._timeValue = value;
get => _timeValue;
set => _timeValue = value;
}
public RelativeTo RelativeTo
{
get => this._relative == null ? RelativeTo.Absolute : this._relative;
set => this._relative = value;
get => _relative == null ? RelativeTo.Absolute : _relative;
set => _relative = value;
}
public bool IsRelativeToObject => this.RelativeTo.IsRelativeToObject;
public bool IsRelativeToObject => RelativeTo.IsRelativeToObject;
public Interpolation Interpolation
{
get => this._interpolation;
set => this._interpolation = value;
get => _interpolation;
set => _interpolation = value;
}
public abstract AnimationType Type { get; }
@@ -113,24 +113,24 @@ namespace Microsoft.Iris.Animations
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("<");
stringBuilder.Append(this.GetType().Name);
stringBuilder.Append(GetType().Name);
stringBuilder.Append(" Time=\"");
stringBuilder.Append(this._timeValue);
stringBuilder.Append(_timeValue);
stringBuilder.Append("\"");
if (this._interpolation != null)
if (_interpolation != null)
{
stringBuilder.Append(" Interpolation=\"");
stringBuilder.Append(this._interpolation.ToString());
stringBuilder.Append(_interpolation.ToString());
stringBuilder.Append("\"");
}
if (this._relative != RelativeTo.Absolute)
if (_relative != RelativeTo.Absolute)
{
stringBuilder.Append(" RelativeTo=\"");
stringBuilder.Append(_relative);
stringBuilder.Append("\"");
}
stringBuilder.Append(" Value=\"");
stringBuilder.Append(this.ObjectValue);
stringBuilder.Append(ObjectValue);
stringBuilder.Append("\"");
stringBuilder.Append("/>");
return stringBuilder.ToString();
@@ -8,7 +8,7 @@ namespace Microsoft.Iris.Animations
{
internal abstract class BaseMultiplyFloatKeyframe : BaseFloatKeyframe
{
public BaseMultiplyFloatKeyframe() => this.Value = 1f;
public BaseMultiplyFloatKeyframe() => Value = 1f;
public override bool Multiply => true;
}
@@ -10,7 +10,7 @@ namespace Microsoft.Iris.Animations
{
internal abstract class BaseMultiplyVector3Keyframe : BaseVector3Keyframe
{
public BaseMultiplyVector3Keyframe() => this.Value = Vector3.UnitVector;
public BaseMultiplyVector3Keyframe() => Value = Vector3.UnitVector;
public override bool Multiply => true;
@@ -19,8 +19,8 @@ namespace Microsoft.Iris.Animations
Vector3 baseValueVector,
ref AnimationArgs args)
{
if (this.RelativeTo == RelativeTo.Final)
baseValueVector *= this.GetRelativeToFinalValue(targetObject, ref args);
if (RelativeTo == RelativeTo.Final)
baseValueVector *= GetRelativeToFinalValue(targetObject, ref args);
return baseValueVector;
}
@@ -13,21 +13,21 @@ namespace Microsoft.Iris.Animations
{
private Rotation _valueRotation;
public BaseRotationKeyframe() => this._valueRotation = Rotation.Default;
public BaseRotationKeyframe() => _valueRotation = Rotation.Default;
protected override void PopulateAnimationWorker(
IAnimatable targetObject,
AnimationProxy animation,
ref AnimationArgs args)
{
Rotation effectiveValue = this.GetEffectiveValue(targetObject, this._valueRotation, ref args);
Rotation effectiveValue = GetEffectiveValue(targetObject, _valueRotation, ref args);
animation.AddRotationKeyframe(this, effectiveValue);
}
public Rotation Value
{
get => this._valueRotation;
set => this._valueRotation = value;
get => _valueRotation;
set => _valueRotation = value;
}
public override object ObjectValue => Value;
@@ -42,8 +42,8 @@ namespace Microsoft.Iris.Animations
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
{
Rotation effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._valueRotation, ref args);
this.Apply(animationTarget, effectiveValue);
Rotation effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _valueRotation, ref args);
Apply(animationTarget, effectiveValue);
}
public abstract void Apply(IAnimatableOwner animationTarget, Rotation valueRotation);
@@ -17,14 +17,14 @@ namespace Microsoft.Iris.Animations
AnimationProxy animation,
ref AnimationArgs args)
{
Vector2 effectiveValue = this.GetEffectiveValue(targetObject, this._valueVector, ref args);
Vector2 effectiveValue = GetEffectiveValue(targetObject, _valueVector, ref args);
animation.AddVector2Keyframe(this, effectiveValue);
}
public Vector2 Value
{
get => this._valueVector;
set => this._valueVector = value;
get => _valueVector;
set => _valueVector = value;
}
public override object ObjectValue => Value;
@@ -39,12 +39,12 @@ namespace Microsoft.Iris.Animations
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
{
Vector2 effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._valueVector, ref args);
this.Apply(animationTarget, effectiveValue);
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) => this.Value *= magnifyValue;
public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue;
}
}
@@ -17,14 +17,14 @@ namespace Microsoft.Iris.Animations
AnimationProxy animation,
ref AnimationArgs args)
{
Vector3 effectiveValue = this.GetEffectiveValue(targetObject, this._valueVector, ref args);
Vector3 effectiveValue = GetEffectiveValue(targetObject, _valueVector, ref args);
animation.AddVector3Keyframe(this, effectiveValue);
}
public Vector3 Value
{
get => this._valueVector;
set => this._valueVector = value;
get => _valueVector;
set => _valueVector = value;
}
public override object ObjectValue => Value;
@@ -39,12 +39,12 @@ namespace Microsoft.Iris.Animations
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
{
Vector3 effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._valueVector, ref args);
this.Apply(animationTarget, effectiveValue);
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) => this.Value *= magnifyValue;
public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue;
}
}
@@ -17,14 +17,14 @@ namespace Microsoft.Iris.Animations
AnimationProxy animation,
ref AnimationArgs args)
{
Vector4 effectiveValue = this.GetEffectiveValue(targetObject, this._valueVector, ref args);
Vector4 effectiveValue = GetEffectiveValue(targetObject, _valueVector, ref args);
animation.AddVector4Keyframe(this, effectiveValue);
}
public Vector4 Value
{
get => this._valueVector;
set => this._valueVector = value;
get => _valueVector;
set => _valueVector = value;
}
public override object ObjectValue => Value;
@@ -39,12 +39,12 @@ namespace Microsoft.Iris.Animations
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
{
Vector4 effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._valueVector, ref args);
this.Apply(animationTarget, effectiveValue);
Vector4 effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _valueVector, ref args);
Apply(animationTarget, effectiveValue);
}
public abstract void Apply(IAnimatableOwner animationTarget, Vector4 valueVector);
public override void MagnifyValue(float magnifyValue) => this.Value *= magnifyValue;
public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue;
}
}
@@ -20,7 +20,7 @@ namespace Microsoft.Iris.Animations
float baseValue,
ref AnimationArgs args)
{
if (this.RelativeTo == RelativeTo.Final)
if (RelativeTo == RelativeTo.Final)
baseValue *= args.NewZn;
return baseValue;
}
@@ -19,8 +19,8 @@ namespace Microsoft.Iris.Animations
public Color Color
{
get => new Color(this.Value.W, this.Value.X, this.Value.Y, this.Value.Z);
set => this.Value = value.RenderConvert().ToVector4();
get => new Color(Value.W, Value.X, Value.Y, Value.Z);
set => Value = value.RenderConvert().ToVector4();
}
}
}
+14 -14
View File
@@ -20,42 +20,42 @@ namespace Microsoft.Iris.Animations
{
}
public Interpolation(InterpolationType type) => this._type = type;
public Interpolation(InterpolationType type) => _type = type;
public InterpolationType Type
{
get => this._type;
set => this._type = value;
get => _type;
set => _type = value;
}
public float Weight
{
get => this._weight;
set => this._weight = value;
get => _weight;
set => _weight = value;
}
public float BezierHandle1
{
get => this._bezierHandle1;
set => this._bezierHandle1 = value;
get => _bezierHandle1;
set => _bezierHandle1 = value;
}
public float BezierHandle2
{
get => this._bezierHandle2;
set => this._bezierHandle2 = value;
get => _bezierHandle2;
set => _bezierHandle2 = value;
}
public float EasePercent
{
get => this._easePercent;
set => this._easePercent = value;
get => _easePercent;
set => _easePercent = value;
}
public override string ToString()
{
string str;
switch (this.Type)
switch (Type)
{
case InterpolationType.SCurve:
str = "SCurve";
@@ -96,11 +96,11 @@ namespace Microsoft.Iris.Animations
if (obj is Interpolation)
{
Interpolation interpolation = (Interpolation)obj;
flag = this._type == interpolation._type && _weight == (double)interpolation._weight && (_bezierHandle1 == (double)interpolation._bezierHandle1 && _bezierHandle2 == (double)interpolation._bezierHandle2) && _easePercent == (double)interpolation._easePercent;
flag = _type == interpolation._type && _weight == (double)interpolation._weight && (_bezierHandle1 == (double)interpolation._bezierHandle1 && _bezierHandle2 == (double)interpolation._bezierHandle2) && _easePercent == (double)interpolation._easePercent;
}
return flag;
}
public override int GetHashCode() => this._type.GetHashCode() ^ this._weight.GetHashCode() ^ this._bezierHandle1.GetHashCode() ^ this._bezierHandle2.GetHashCode() ^ this._easePercent.GetHashCode();
public override int GetHashCode() => _type.GetHashCode() ^ _weight.GetHashCode() ^ _bezierHandle1.GetHashCode() ^ _bezierHandle2.GetHashCode() ^ _easePercent.GetHashCode();
}
}

Some files were not shown because too many files have changed in this diff Show More