1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-01-02 10:43:31 +00:00

Added easing config

This commit is contained in:
SpoinkyNL 2016-12-01 15:06:43 +01:00
parent 041a2db6e2
commit ab82491137
8 changed files with 218 additions and 96 deletions

View File

@ -602,6 +602,7 @@
<Compile Include="Modules\Games\Dota2\Dota2ViewModel.cs" />
<Compile Include="Modules\Games\RocketLeague\RocketLeagueViewModel.cs" />
<Compile Include="Modules\Games\Witcher3\Witcher3ViewModel.cs" />
<Compile Include="ViewModels\Profiles\LayerTweenViewModel.cs" />
<Compile Include="ViewModels\Profiles\Events\EventPropertiesViewModel.cs" />
<Compile Include="ViewModels\Profiles\ProfileViewModel.cs" />
<Compile Include="Profiles\Layers\Types\Keyboard\KeyboardPropertiesViewModel.cs" />
@ -674,6 +675,9 @@
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayView.xaml.cs">
<DependentUpon>VolumeDisplayView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Profiles\LayerTweenView.xaml.cs">
<DependentUpon>LayerTweenView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Profiles\ProfileEditorView.xaml.cs">
<DependentUpon>ProfileEditorView.xaml</DependentUpon>
</Compile>
@ -916,6 +920,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Profiles\LayerTweenView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Profiles\ProfileEditorView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@ -6,16 +6,16 @@ namespace Artemis.Profiles.Layers.Models
public class TweenModel
{
private readonly LayerModel _layerModel;
private float _height;
private Tweener<float> _heightTweener;
private float _opacity;
private Tweener<float> _opacityTweener;
private float _width;
private Tweener<float> _widthTweener;
private float _x;
private Tweener<float> _xTweener;
private float _y;
private Tweener<float> _yTweener;
private float _width;
private Tweener<float> _widthTweener;
private float _height;
private Tweener<float> _heightTweener;
private float _opacity;
private Tweener<float> _opacityTweener;
public TweenModel(LayerModel layerModel)
{
@ -32,6 +32,7 @@ namespace Artemis.Profiles.Layers.Models
public void Update()
{
// TODO: Don't update if animation speed is 0
if (Math.Abs(_layerModel.X - _x) > 0.001)
_xTweener = new Tweener<float>(_x, (float) _layerModel.X, _layerModel.Properties.XEaseTime,
GetEaseFunction(_layerModel.Properties.XEase));
@ -80,7 +81,7 @@ namespace Artemis.Profiles.Layers.Models
return Ease.Quint.In;
case "Out":
return Ease.Quint.Out;
case "InOut":
case "In/out":
return Ease.Quint.InOut;
default:
return Ease.Linear;

View File

@ -23,6 +23,7 @@
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<!-- Animation -->
<TextBlock Grid.Row="0" Grid.Column="0" Margin="10" FontSize="13.333" Text="Animation:"
@ -86,8 +87,7 @@
</Grid>
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
Foreground="{DynamicResource HighlightBrush}"
Text="Note: It is recommended to use very tiny gifs (25x7 per example, for size per keyboard see FAQ). Any higher will degrade performance without any noticeable quality difference."
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" />
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" ><Run Text="Note: It is recommended to use very tiny gifs (25x7 per example, for size per keyboard see FAQ). "/><LineBreak/><Run Text="Any higher will degrade performance without any noticeable quality difference."/></TextBlock>
</Grid>
<!-- Dynamic -->
@ -98,5 +98,7 @@
<ContentControl Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" x:Name="HeightProperties" />
<ContentControl Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4" x:Name="WidthProperties" />
<ContentControl Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="4" x:Name="OpacityProperties" />
<ContentControl Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="4" x:Name="LayerTweenViewModel" />
</Grid>
</UserControl>

View File

@ -20,6 +20,7 @@ namespace Artemis.Profiles.Layers.Types.Keyboard
HeightProperties = new LayerDynamicPropertiesViewModel("Height", editorVm);
WidthProperties = new LayerDynamicPropertiesViewModel("Width", editorVm);
OpacityProperties = new LayerDynamicPropertiesViewModel("Opacity", editorVm);
LayerTweenViewModel = new LayerTweenViewModel(editorVm);
SelectedLayerAnimation =
LayerAnimations.FirstOrDefault(l => l.Name == editorVm.ProposedLayer.LayerAnimation?.Name) ??
@ -33,6 +34,7 @@ namespace Artemis.Profiles.Layers.Types.Keyboard
public LayerDynamicPropertiesViewModel HeightProperties { get; set; }
public LayerDynamicPropertiesViewModel WidthProperties { get; set; }
public LayerDynamicPropertiesViewModel OpacityProperties { get; set; }
public LayerTweenViewModel LayerTweenViewModel { get; set; }
public bool IsGif
{

View File

@ -0,0 +1,18 @@
using Artemis.Profiles.Layers.Models;
using Caliburn.Micro;
namespace Artemis.ViewModels.Profiles
{
public class LayerTweenViewModel : Screen
{
public LayerModel LayerModel { get; set; }
public LayerTweenViewModel(LayerEditorViewModel editorViewModel)
{
LayerModel = editorViewModel.ProposedLayer;
EaseFunctions = new BindableCollection<string> {"Linear", "In", "Out", "In/out"};
}
public BindableCollection<string> EaseFunctions { get; set; }
}
}

View File

@ -11,6 +11,7 @@
xmlns:cal="http://www.caliburnproject.org"
GlowBrush="{DynamicResource AccentColorBrush}" Icon="../../Resources/bow.png"
ResizeMode="NoResize">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid Margin="10,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -105,5 +106,5 @@
Height="30" />
</StackPanel>
</Grid>
</ScrollViewer>
</controls:MetroWindow>

View File

@ -0,0 +1,62 @@
<UserControl x:Class="Artemis.Views.Profiles.LayerTweenView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Artemis.Views.Profiles"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="900">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="84" />
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="84" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" FontSize="20" HorizontalAlignment="Left" Content="Easing"
VerticalAlignment="Bottom" />
<!-- X -->
<TextBlock Grid.Row="1" Grid.Column="0" Margin="10" FontSize="13.333" Text="X:" VerticalAlignment="Center" Height="18" />
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">
<ComboBox Margin="10,10,10,0" VerticalAlignment="Top" Height="22" Width="86" ItemsSource="{Binding EaseFunctions}" SelectedItem="{Binding Path=LayerModel.Properties.XEase}" />
<controls:NumericUpDown Margin="0,10,10,0" Height="22" Width="105" Value="{Binding Path=LayerModel.Properties.XEaseTime}" />
</StackPanel>
<!-- Y -->
<TextBlock Grid.Row="1" Grid.Column="2" Margin="10" FontSize="13.333" Text="Y:" VerticalAlignment="Center" Height="18" />
<StackPanel Grid.Row="1" Grid.Column="3" Orientation="Horizontal">
<ComboBox Margin="10,10,10,0" VerticalAlignment="Top" Height="22" Width="86" ItemsSource="{Binding EaseFunctions}" SelectedItem="{Binding Path=LayerModel.Properties.YEase}" />
<controls:NumericUpDown Margin="0,10,10,0" Height="22" Width="105" Value="{Binding Path=LayerModel.Properties.YEaseTime}" />
</StackPanel>
<!-- Width -->
<TextBlock Grid.Row="2" Grid.Column="0" Margin="10" FontSize="13.333" Text="Width:" VerticalAlignment="Center" Height="18" />
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal">
<ComboBox Margin="10,10,10,0" VerticalAlignment="Top" Height="22" Width="86" ItemsSource="{Binding EaseFunctions}" SelectedItem="{Binding Path=LayerModel.Properties.WidthEase}" />
<controls:NumericUpDown Margin="0,10,10,0" Height="22" Width="105" Value="{Binding Path=LayerModel.Properties.WidthEaseTime}" />
</StackPanel>
<!-- Height -->
<TextBlock Grid.Row="2" Grid.Column="2" Margin="10" FontSize="13.333" Text="Height:" VerticalAlignment="Center" Height="18" />
<StackPanel Grid.Row="2" Grid.Column="3" Orientation="Horizontal">
<ComboBox Margin="10,10,10,0" VerticalAlignment="Top" Height="22" Width="86" ItemsSource="{Binding EaseFunctions}" SelectedItem="{Binding Path=LayerModel.Properties.HeightEase}" />
<controls:NumericUpDown Margin="0,10,10,0" Height="22" Width="105" Value="{Binding Path=LayerModel.Properties.HeightEaseTime}" />
</StackPanel>
<!-- Opacity -->
<TextBlock Grid.Row="3" Grid.Column="0" Margin="10" FontSize="13.333" Text="Opacity:" VerticalAlignment="Center" Height="18" />
<StackPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal">
<ComboBox Margin="10,10,10,0" VerticalAlignment="Top" Height="22" Width="86" ItemsSource="{Binding EaseFunctions}" SelectedItem="{Binding Path=LayerModel.Properties.OpacityEase}" />
<controls:NumericUpDown Margin="0,10,10,0" Height="22" Width="105" Value="{Binding Path=LayerModel.Properties.OpacityEaseTime}" />
</StackPanel>
</Grid>
</UserControl>

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Artemis.Views.Profiles
{
/// <summary>
/// Interaction logic for LayerTweenView.xaml
/// </summary>
public partial class LayerTweenView : UserControl
{
public LayerTweenView()
{
InitializeComponent();
}
}
}