1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +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,99 +11,100 @@
xmlns:cal="http://www.caliburnproject.org"
GlowBrush="{DynamicResource AccentColorBrush}" Icon="../../Resources/bow.png"
ResizeMode="NoResize">
<Grid Margin="10,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<!-- Header -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="65" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="65" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid Margin="10,0">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="4" FontSize="20" Content="Basics" />
<!-- Layer name -->
<TextBlock Grid.Row="1" Grid.Column="0" Margin="10,12" FontSize="13.333" Text="Name:"
VerticalAlignment="Center" Height="18" />
<TextBox Grid.Row="1" Grid.Column="1" x:Name="Name" Margin="10" Width="200"
Text="{Binding Path=ProposedLayer.Name}" />
<Grid Grid.Row="0">
<!-- Header -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="65" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="65" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="4" FontSize="20" Content="Basics" />
<!-- Layer type -->
<TextBlock Grid.Row="1" Grid.Column="2" Margin="10,12" FontSize="13.333" Text="Type:"
VerticalAlignment="Center" Height="18" />
<!-- Layer name -->
<TextBlock Grid.Row="1" Grid.Column="0" Margin="10,12" FontSize="13.333" Text="Name:"
VerticalAlignment="Center" Height="18" />
<TextBox Grid.Row="1" Grid.Column="1" x:Name="Name" Margin="10" Width="200"
Text="{Binding Path=ProposedLayer.Name}" />
<ComboBox Grid.Row="1" Grid.Column="3" Margin="10" Width="120" x:Name="LayerTypes">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Layer type -->
<TextBlock Grid.Row="1" Grid.Column="2" Margin="10,12" FontSize="13.333" Text="Type:"
VerticalAlignment="Center" Height="18" />
<!-- Event toggle -->
<Label Grid.Row="1" Grid.Column="4" Content="Is event: " Margin="0 3 0 0" HorizontalAlignment="Right"
VerticalAlignment="Center" />
<ToggleButton Grid.Row="1" Grid.Column="5" Margin="0,4,6,0" Width="25" Height="25"
IsChecked="{Binding Path=ProposedLayer.IsEvent}"
Style="{DynamicResource MetroCircleToggleButtonStyle}" VerticalAlignment="Center"
cal:Message.Attach="[Event Click] = [Action ToggleIsEvent]" />
<ComboBox Grid.Row="1" Grid.Column="3" Margin="10" Width="120" x:Name="LayerTypes">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Name, Mode=OneWay}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Event toggle -->
<Label Grid.Row="1" Grid.Column="4" Content="Is event: " Margin="0 3 0 0" HorizontalAlignment="Right"
VerticalAlignment="Center" />
<ToggleButton Grid.Row="1" Grid.Column="5" Margin="0,4,6,0" Width="25" Height="25"
IsChecked="{Binding Path=ProposedLayer.IsEvent}"
Style="{DynamicResource MetroCircleToggleButtonStyle}" VerticalAlignment="Center"
cal:Message.Attach="[Event Click] = [Action ToggleIsEvent]" />
</Grid>
<!-- Condition editor -->
<Label Grid.Row="2" Grid.Column="0" FontSize="20" Content="Display if.." />
<Border Grid.Row="3" Grid.Column="0" BorderThickness="1" BorderBrush="{StaticResource GrayBrush7}"
Margin="10,0" SnapsToDevicePixels="True">
<ListBox Height="138" x:Name="LayerConditionVms" ScrollViewer.VerticalScrollBarVisibility="Visible">
<ListBox.Template>
<ControlTemplate>
<ScrollViewer>
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ListBox.Template>
</ListBox>
</Border>
<Button Grid.Row="4" x:Name="AddCondition" Content="Add condition" VerticalAlignment="Center"
Style="{DynamicResource SquareButtonStyle}" Width="95" HorizontalAlignment="Right" Height="30"
Margin="0,10,10,10" ScrollViewer.VerticalScrollBarVisibility="Auto" />
<!-- Advanced -->
<Label Grid.Row="4" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
Content="Advanced" Width="97" VerticalAlignment="Bottom" />
<!-- Advanced settings -->
<ContentControl Grid.Row="5" Grid.Column="0" x:Name="LayerPropertiesViewModel" />
<!-- Event settings -->
<ContentControl Grid.Row="6" Grid.Column="0" x:Name="EventPropertiesViewModel" />
<StackPanel Grid.Row="7" Grid.Column="0" Orientation="Horizontal">
<Button x:Name="Apply" Content="Apply" VerticalAlignment="Bottom"
Style="{DynamicResource SquareButtonStyle}" Width="95" HorizontalAlignment="Left"
Margin="10,0,0,20"
Height="30" />
<Button x:Name="PreSelect" Content="Reset" VerticalAlignment="Bottom"
Style="{DynamicResource SquareButtonStyle}" Width="95" HorizontalAlignment="Left"
Margin="10,0,0,20"
Height="30" />
</StackPanel>
</Grid>
<!-- Condition editor -->
<Label Grid.Row="2" Grid.Column="0" FontSize="20" Content="Display if.." />
<Border Grid.Row="3" Grid.Column="0" BorderThickness="1" BorderBrush="{StaticResource GrayBrush7}"
Margin="10,0" SnapsToDevicePixels="True">
<ListBox Height="138" x:Name="LayerConditionVms" ScrollViewer.VerticalScrollBarVisibility="Visible">
<ListBox.Template>
<ControlTemplate>
<ScrollViewer>
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ListBox.Template>
</ListBox>
</Border>
<Button Grid.Row="4" x:Name="AddCondition" Content="Add condition" VerticalAlignment="Center"
Style="{DynamicResource SquareButtonStyle}" Width="95" HorizontalAlignment="Right" Height="30"
Margin="0,10,10,10" ScrollViewer.VerticalScrollBarVisibility="Auto" />
<!-- Advanced -->
<Label Grid.Row="4" Grid.Column="0" FontSize="20" HorizontalAlignment="Left"
Content="Advanced" Width="97" VerticalAlignment="Bottom" />
<!-- Advanced settings -->
<ContentControl Grid.Row="5" Grid.Column="0" x:Name="LayerPropertiesViewModel" />
<!-- Event settings -->
<ContentControl Grid.Row="6" Grid.Column="0" x:Name="EventPropertiesViewModel" />
<StackPanel Grid.Row="7" Grid.Column="0" Orientation="Horizontal">
<Button x:Name="Apply" Content="Apply" VerticalAlignment="Bottom"
Style="{DynamicResource SquareButtonStyle}" Width="95" HorizontalAlignment="Left"
Margin="10,0,0,20"
Height="30" />
<Button x:Name="PreSelect" Content="Reset" VerticalAlignment="Bottom"
Style="{DynamicResource SquareButtonStyle}" Width="95" HorizontalAlignment="Left"
Margin="10,0,0,20"
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();
}
}
}