diff --git a/src/Artemis.Core/Models/Profile/Layer.cs b/src/Artemis.Core/Models/Profile/Layer.cs index 05412ec8f..36a6c7535 100644 --- a/src/Artemis.Core/Models/Profile/Layer.cs +++ b/src/Artemis.Core/Models/Profile/Layer.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; using System.Linq; using Artemis.Core.Exceptions; using Artemis.Core.Extensions; @@ -148,6 +149,17 @@ namespace Artemis.Core.Models.Profile public override void Update(double deltaTime) { + foreach (var property in Properties) + { + property.KeyframeEngine?.Update(deltaTime); + // This is a placeholder method of repeating the animation until repeat modes are implemented + if (property.KeyframeEngine != null && property.IsUsingKeyframes && property.KeyframeEngine.NextKeyframe == null) + { + Debug.WriteLine($"Reset {property} progress"); + property.KeyframeEngine.OverrideProgress(TimeSpan.Zero); + } + } + LayerBrush?.Update(deltaTime); } @@ -189,7 +201,7 @@ namespace Artemis.Core.Models.Profile } var shader = SKShader.CreateSweepGradient(new SKPoint(LayerShape.RenderRectangle.MidX, LayerShape.RenderRectangle.MidY), testColors.ToArray()); - canvas.DrawPath(LayerShape.RenderPath, new SKPaint {Shader = shader, Color = new SKColor(0, 0, 0, (byte) (OpacityProperty.CurrentValue * 2.55f)) }); + canvas.DrawPath(LayerShape.RenderPath, new SKPaint {Shader = shader, Color = new SKColor(0, 0, 0, (byte) (OpacityProperty.CurrentValue * 2.55f))}); } LayerBrush?.Render(canvas); @@ -200,7 +212,7 @@ namespace Artemis.Core.Models.Profile { if (LayerShape == null) return SKPoint.Empty; - + if (!absolute) { var anchor = AnchorPointProperty.CurrentValue; diff --git a/src/Artemis.Core/Services/CoreService.cs b/src/Artemis.Core/Services/CoreService.cs index 5e1b6603b..6fc200143 100644 --- a/src/Artemis.Core/Services/CoreService.cs +++ b/src/Artemis.Core/Services/CoreService.cs @@ -33,7 +33,7 @@ namespace Artemis.Core.Services _surfaceService = surfaceService; _rgbService.Surface.Updating += SurfaceOnUpdating; _rgbService.Surface.Updated += SurfaceOnUpdated; - + _modules = _pluginService.GetPluginsOfType(); _pluginService.PluginEnabled += (sender, args) => _modules = _pluginService.GetPluginsOfType(); _pluginService.PluginDisabled += (sender, args) => _modules = _pluginService.GetPluginsOfType(); diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml index a08fb3929..b12302f3e 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml @@ -61,6 +61,12 @@ + + + diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs index 85c77e957..8eb887d1a 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs @@ -45,7 +45,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties } public bool Playing { get; set; } - + public bool RepeatAfterLastKeyframe { get; set; } public string FormattedCurrentTime => $"{Math.Floor(_profileEditorService.CurrentTime.TotalSeconds):00}.{_profileEditorService.CurrentTime.Milliseconds:000}"; public int PixelsPerSecond @@ -173,7 +173,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties Execute.PostToUIThread(() => { var newTime = _profileEditorService.CurrentTime.Add(TimeSpan.FromSeconds(e.DeltaTime)); - if (newTime > CalculateEndTime()) + if (RepeatAfterLastKeyframe) + { + if (newTime > CalculateEndTime().Subtract(TimeSpan.FromSeconds(10))) + newTime = TimeSpan.Zero; + } + else if (newTime > CalculateEndTime()) { newTime = CalculateEndTime(); Pause(); diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/EditToolView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/EditToolView.xaml index b8cd2ca59..376440aa6 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/EditToolView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/Tools/EditToolView.xaml @@ -19,28 +19,28 @@ Canvas.Left="{Binding TopLeft.X}" Canvas.Top="{Binding TopLeft.Y}" Fill="Transparent" - MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action TopLeftRotate}" Cursor="Cross" /> + MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="Cross" /> + MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="Cross" /> + MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="Cross" /> + MouseDown="{s:Action ShapeEditMouseDown}" MouseUp="{s:Action ShapeEditMouseUp}" MouseMove="{s:Action Rotate}" Cursor="Cross" />