Added rotation

This commit is contained in:
SpoinkyNL committed 2020-01-23 23:30:01 +01:00
1 parent 1cdc5ac51d
commit 3ea938d69b
6 files changed
+58 -11

No files matched your search

@@ -61,6 +61,12 @@
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Next frame" Command="{s:Action GoToNextFrame}" Focusable="False">
<materialDesign:PackIcon Kind="SkipNext" />
</Button>
<ToggleButton Style="{StaticResource MaterialDesignFlatToggleButton}"
ToolTip="Repeat after last keyframe"
IsChecked="{Binding RepeatAfterLastKeyframe}"
Focusable="False">
<materialDesign:PackIcon Kind="Repeat" Height="24" Width="24" />
</ToggleButton>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}" Text="{Binding FormattedCurrentTime}" HorizontalAlignment="Right" Margin="0 0 20 0" />
@@ -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();