Profiles - Made data bindings compatible with timeline changes

This commit is contained in:
SpoinkyNL committed 2020-11-02 22:09:29 +01:00
1 parent 997ab005d8
commit 0f5c2b80c4
23 files changed
+175 -163

No files matched your search

@@ -60,9 +60,9 @@ namespace Artemis.Core
/// Gets ors ets the easing function of the data binding
/// </summary>
public Easings.Functions EasingFunction { get; set; }
internal DataBindingEntity Entity { get; }
/// <summary>
/// Gets the current value of the data binding
/// </summary>
@@ -139,16 +139,24 @@ namespace Artemis.Core
/// </summary>
/// <param name="timeline">The timeline to apply during update</param>
public void Update(Timeline timeline)
{
UpdateWithDelta(timeline.Delta);
}
/// <summary>
/// Updates the smoothing progress of the data binding
/// </summary>
/// <param name="delta">The delta to apply during update</param>
public void UpdateWithDelta(TimeSpan delta)
{
if (_disposed)
throw new ObjectDisposedException("DataBinding");
// Data bindings cannot go back in time like brushes
TimeSpan deltaTime = timeline.Delta;
if (deltaTime < TimeSpan.Zero)
deltaTime = TimeSpan.Zero;
if (delta < TimeSpan.Zero)
delta = TimeSpan.Zero;
_easingProgress = _easingProgress.Add(deltaTime);
_easingProgress = _easingProgress.Add(delta);
if (_easingProgress > EasingTime)
_easingProgress = EasingTime;
}