committed by
GitHub
569 changed files with 10008 additions and 10956 deletions
@ -1,7 +1,3 @@ |
|||
[submodule "src/Avalonia.HtmlRenderer/external"] |
|||
path = src/Avalonia.HtmlRenderer/external |
|||
url = https://github.com/AvaloniaUI/HTML-Renderer.git |
|||
branch = perspex-pcl |
|||
[submodule "src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github"] |
|||
path = src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github |
|||
url = https://github.com/AvaloniaUI/Portable.Xaml.git |
|||
|
|||
@ -0,0 +1,8 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.3.0" /> |
|||
<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.0" /> |
|||
<PackageReference Include="System.ComponentModel.Primitives" Version="4.3.0" /> |
|||
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -0,0 +1,11 @@ |
|||
<Project DefaultTargets="Build" |
|||
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<Compile Update="**\*.xaml.cs"> |
|||
<DependentUpon>%(Filename)</DependentUpon> |
|||
</Compile> |
|||
<EmbeddedResource Include="**\*.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -1,5 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="reactiveui" Version="8.0.0-alpha0073" /> |
|||
<PackageReference Include="reactiveui" Version="8.0.0" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -0,0 +1,13 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup Condition="'$(TargetFramework)'=='net461'" > |
|||
<OutputType>WinExe</OutputType> |
|||
</PropertyGroup> |
|||
|
|||
<!-- Should be a Condition="'$(TargetFramework)'=='net461'" here but that doesn't work due |
|||
to https://github.com/dotnet/sdk/issues/1227 --> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" /> |
|||
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" /> |
|||
</ItemGroup> |
|||
<Import Condition="'$(TargetFramework)'=='net461'" Project="SharpDX.props" /> |
|||
</Project> |
|||
@ -0,0 +1,14 @@ |
|||
<Project DefaultTargets="Build" |
|||
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<Product>Avalonia</Product> |
|||
<Version>0.6.2</Version> |
|||
<Copyright>Copyright 2016 © The AvaloniaUI Project</Copyright> |
|||
<PackageLicenseUrl>https://github.com/AvaloniaUI/Avalonia/blob/master/licence.md</PackageLicenseUrl> |
|||
<PackageProjectUrl>https://github.com/AvaloniaUI/Avalonia/</PackageProjectUrl> |
|||
<RepositoryUrl>https://github.com/AvaloniaUI/Avalonia/</RepositoryUrl> |
|||
<GenerateDocumentationFile>true</GenerateDocumentationFile> |
|||
<NoWarn>CS1591</NoWarn> |
|||
<LangVersion>latest</LangVersion> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -0,0 +1,5 @@ |
|||
<Project> |
|||
<ItemGroup> |
|||
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.0" PrivateAssets="All" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -0,0 +1,15 @@ |
|||
; This is the default configuration file for Cake. |
|||
; This file was downloaded from https://github.com/cake-build/resources |
|||
|
|||
[Nuget] |
|||
Source=https://api.nuget.org/v3/index.json |
|||
UseInProcessClient=true |
|||
LoadDependencies=false |
|||
|
|||
[Paths] |
|||
Tools=./tools |
|||
Addins=./tools/Addins |
|||
Modules=./tools/Modules |
|||
|
|||
[Settings] |
|||
SkipVerification=false |
|||
@ -1,155 +1,33 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProjectGuid>{08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}</ProjectGuid> |
|||
<OutputType>WinExe</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>BindingTest</RootNamespace> |
|||
<AssemblyName>BindingTest</AssemblyName> |
|||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|||
<TargetFrameworkProfile /> |
|||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle> |
|||
<OutputType>Exe</OutputType> |
|||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<PlatformTarget>AnyCPU</PlatformTarget> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<PlatformTarget>AnyCPU</PlatformTarget> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup> |
|||
<StartupObject /> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.ComponentModel.DataAnnotations" /> |
|||
<Reference Include="System.Core" /> |
|||
<Reference Include="System.Xml.Linq" /> |
|||
<Reference Include="System.Data.DataSetExtensions" /> |
|||
<Reference Include="Microsoft.CSharp" /> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Xml" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="App.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
<Compile Include="App.xaml.cs"> |
|||
<DependentUpon>App.xaml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="MainWindow.xaml.cs"> |
|||
<DependentUpon>MainWindow.xaml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
<Compile Include="TestItemView.xaml.cs"> |
|||
<DependentUpon>TestItemView.xaml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="ViewModels\DataAnnotationsErrorViewModel.cs" /> |
|||
<Compile Include="ViewModels\IndeiErrorViewModel.cs" /> |
|||
<Compile Include="ViewModels\ExceptionErrorViewModel.cs" /> |
|||
<Compile Include="ViewModels\MainWindowViewModel.cs" /> |
|||
<Compile Include="ViewModels\NestedCommandViewModel.cs" /> |
|||
<Compile Include="ViewModels\TestItem.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<None Include="App.config" /> |
|||
<EmbeddedResource Include="MainWindow.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
<EmbeddedResource Include="TestItemView.xaml" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj"> |
|||
<Project>{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}</Project> |
|||
<Name>Avalonia.DotNetFrameworkRuntime</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj"> |
|||
<Project>{3e53a01a-b331-47f3-b828-4a5717e77a24}</Project> |
|||
<Name>Avalonia.Markup.Xaml</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj"> |
|||
<Project>{6417e941-21bc-467b-a771-0de389353ce6}</Project> |
|||
<Name>Avalonia.Markup</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj"> |
|||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
|||
<Name>Avalonia.Animation</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj"> |
|||
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project> |
|||
<Name>Avalonia.Base</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj"> |
|||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project> |
|||
<Name>Avalonia.Controls</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj"> |
|||
<Project>{799a7bb5-3c2c-48b6-85a7-406a12c420da}</Project> |
|||
<Name>Avalonia.DesignerSupport</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj"> |
|||
<Project>{7062ae20-5dcc-4442-9645-8195bdece63e}</Project> |
|||
<Name>Avalonia.Diagnostics</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj"> |
|||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
|||
<Name>Avalonia.Input</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj"> |
|||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
|||
<Name>Avalonia.Interactivity</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj"> |
|||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
|||
<Name>Avalonia.Layout</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj"> |
|||
<Project>{b61b66a3-b82d-4875-8001-89d3394fe0c9}</Project> |
|||
<Name>Avalonia.Logging.Serilog</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj"> |
|||
<Project>{6417b24e-49c2-4985-8db2-3ab9d898ec91}</Project> |
|||
<Name>Avalonia.ReactiveUI</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj"> |
|||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|||
<Name>Avalonia.Visuals</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj"> |
|||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project> |
|||
<Name>Avalonia.Styling</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj"> |
|||
<Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project> |
|||
<Name>Avalonia.Themes.Default</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" Condition="'$(Platform)'!='Mono'"> |
|||
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project> |
|||
<Name>Avalonia.Direct2D1</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" Condition="'$(Platform)'!='Mono'"> |
|||
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project> |
|||
<Name>Avalonia.Win32</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj" /> |
|||
|
|||
<ProjectReference Condition="'$(TargetFramework)'=='netcoreapp2.0'" Include="..\..\src\Avalonia.DotNetCoreRuntime\Avalonia.DotNetCoreRuntime.csproj" /> |
|||
|
|||
<ProjectReference Condition="'$(TargetFramework)'=='net461'" Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj" /> |
|||
|
|||
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj" /> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj" /> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj" /> |
|||
</ItemGroup> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<Import Project="..\..\build\SampleApp.props" /> |
|||
<Import Project="..\..\build\EmbedXaml.props" /> |
|||
<Import Project="..\..\build\Serilog.props" /> |
|||
<Import Project="..\..\build\Rx.props" /> |
|||
<Import Project="..\..\build\ReactiveUI.props" /> |
|||
|
|||
@ -1,36 +0,0 @@ |
|||
using System.Reflection; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
// General Information about an assembly is controlled through the following
|
|||
// set of attributes. Change these attribute values to modify the information
|
|||
// associated with an assembly.
|
|||
[assembly: AssemblyTitle("BindingTest")] |
|||
[assembly: AssemblyDescription("")] |
|||
[assembly: AssemblyConfiguration("")] |
|||
[assembly: AssemblyCompany("")] |
|||
[assembly: AssemblyProduct("BindingTest")] |
|||
[assembly: AssemblyCopyright("Copyright © 2015")] |
|||
[assembly: AssemblyTrademark("")] |
|||
[assembly: AssemblyCulture("")] |
|||
|
|||
// Setting ComVisible to false makes the types in this assembly not visible
|
|||
// to COM components. If you need to access a type in this assembly from
|
|||
// COM, set the ComVisible attribute to true on that type.
|
|||
[assembly: ComVisible(false)] |
|||
|
|||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|||
[assembly: Guid("08b3e6b9-1cd5-443c-9f61-6d49d1c5f162")] |
|||
|
|||
// Version information for an assembly consists of the following four values:
|
|||
//
|
|||
// Major Version
|
|||
// Minor Version
|
|||
// Build Number
|
|||
// Revision
|
|||
//
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
|||
// by using the '*' as shown below:
|
|||
// [assembly: AssemblyVersion("1.0.*")]
|
|||
[assembly: AssemblyVersion("1.0.0.0")] |
|||
[assembly: AssemblyFileVersion("1.0.0.0")] |
|||
@ -1,138 +1,21 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProjectGuid>{2B888490-D14A-4BCA-AB4B-48676FA93C9B}</ProjectGuid> |
|||
<OutputType>WinExe</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>ControlCatalog.Desktop</RootNamespace> |
|||
<AssemblyName>ControlCatalog.Desktop</AssemblyName> |
|||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|||
<TargetFrameworkProfile /> |
|||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle> |
|||
<OutputType>Exe</OutputType> |
|||
<TargetFramework>net461</TargetFramework> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<PlatformTarget>AnyCPU</PlatformTarget> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<PlatformTarget>x86</PlatformTarget> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup> |
|||
<StartupObject /> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Core" /> |
|||
<Reference Include="System.Xml.Linq" /> |
|||
<Reference Include="System.Data.DataSetExtensions" /> |
|||
<Reference Include="Microsoft.CSharp" /> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Net.Http" /> |
|||
<Reference Include="System.Xml" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="Program.cs" /> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<None Include="App.config" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj" /> |
|||
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj"> |
|||
<Project>{799a7bb5-3c2c-48b6-85a7-406a12c420da}</Project> |
|||
<Name>Avalonia.DesignerSupport</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj"> |
|||
<Project>{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}</Project> |
|||
<Name>Avalonia.DotNetFrameworkRuntime</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Gtk3\Avalonia.Gtk3.csproj"> |
|||
<Project>{bb1f7bb5-6ad4-4776-94d9-c09d0a972658}</Project> |
|||
<Name>Avalonia.Gtk3</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj"> |
|||
<Project>{3E53A01A-B331-47F3-B828-4A5717E77A24}</Project> |
|||
<Name>Avalonia.Markup.Xaml</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj"> |
|||
<Project>{6417E941-21BC-467B-A771-0DE389353CE6}</Project> |
|||
<Name>Avalonia.Markup</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj"> |
|||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
|||
<Name>Avalonia.Animation</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj"> |
|||
<Project>{B09B78D8-9B26-48B0-9149-D64A2F120F3F}</Project> |
|||
<Name>Avalonia.Base</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj"> |
|||
<Project>{D2221C82-4A25-4583-9B43-D791E3F6820C}</Project> |
|||
<Name>Avalonia.Controls</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj"> |
|||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
|||
<Name>Avalonia.Input</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj"> |
|||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
|||
<Name>Avalonia.Interactivity</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj"> |
|||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
|||
<Name>Avalonia.Layout</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj"> |
|||
<Project>{B61B66A3-B82D-4875-8001-89D3394FE0C9}</Project> |
|||
<Name>Avalonia.Logging.Serilog</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj"> |
|||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|||
<Name>Avalonia.Visuals</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj"> |
|||
<Project>{F1BAA01A-F176-4C6A-B39D-5B40BB1B148F}</Project> |
|||
<Name>Avalonia.Styling</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj"> |
|||
<Project>{3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}</Project> |
|||
<Name>Avalonia.Themes.Default</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Skia\Avalonia.Skia\Avalonia.Skia.csproj"> |
|||
<Project>{7d2d3083-71dd-4cc9-8907-39a0d86fb322}</Project> |
|||
<Name>Avalonia.Skia</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" Condition="'$(Platform)'!='Mono'"> |
|||
<Project>{3E908F67-5543-4879-A1DC-08EACE79B3CD}</Project> |
|||
<Name>Avalonia.Direct2D1</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" Condition="'$(Platform)'!='Mono'"> |
|||
<Project>{811A76CF-1CF6-440F-963B-BBE31BD72A82}</Project> |
|||
<Name>Avalonia.Win32</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj"> |
|||
<Project>{d0a739b9-3c68-4ba6-a328-41606954b6bd}</Project> |
|||
<Name>ControlCatalog</Name> |
|||
</ProjectReference> |
|||
<Folder Include="Properties\" /> |
|||
</ItemGroup> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
|
|||
<Import Project="..\..\build\SampleApp.props" /> |
|||
<Import Project="..\..\build\Serilog.props" /> |
|||
<Import Project="..\..\build\SkiaSharp.props" /> |
|||
</Project> |
|||
@ -1,36 +0,0 @@ |
|||
using System.Reflection; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
// General Information about an assembly is controlled through the following
|
|||
// set of attributes. Change these attribute values to modify the information
|
|||
// associated with an assembly.
|
|||
[assembly: AssemblyTitle("ControlCatalog.Desktop")] |
|||
[assembly: AssemblyDescription("")] |
|||
[assembly: AssemblyConfiguration("")] |
|||
[assembly: AssemblyCompany("")] |
|||
[assembly: AssemblyProduct("ControlCatalog.Desktop")] |
|||
[assembly: AssemblyCopyright("Copyright © 2016")] |
|||
[assembly: AssemblyTrademark("")] |
|||
[assembly: AssemblyCulture("")] |
|||
|
|||
// Setting ComVisible to false makes the types in this assembly not visible
|
|||
// to COM components. If you need to access a type in this assembly from
|
|||
// COM, set the ComVisible attribute to true on that type.
|
|||
[assembly: ComVisible(false)] |
|||
|
|||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|||
[assembly: Guid("2b888490-d14a-4bca-ab4b-48676fa93c9b")] |
|||
|
|||
// Version information for an assembly consists of the following four values:
|
|||
//
|
|||
// Major Version
|
|||
// Minor Version
|
|||
// Build Number
|
|||
// Revision
|
|||
//
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
|||
// by using the '*' as shown below:
|
|||
// [assembly: AssemblyVersion("1.0.*")]
|
|||
[assembly: AssemblyVersion("1.0.0.0")] |
|||
[assembly: AssemblyFileVersion("1.0.0.0")] |
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@ |
|||
<Project> |
|||
<Import Project="..\build\SharedVersion.props" /> |
|||
</Project> |
|||
@ -1,2 +1,123 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui"> |
|||
<UserControl |
|||
xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|||
<UserControl.Styles> |
|||
<Styles> |
|||
<Styles.Resources> |
|||
<Template x:Key="Acorn"> |
|||
<Path Fill="White" Stretch="Uniform" |
|||
Data="F1 M 16.6309,18.6563C 17.1309, |
|||
8.15625 29.8809,14.1563 29.8809, |
|||
14.1563C 30.8809,11.1563 34.1308, |
|||
11.4063 34.1308,11.4063C 33.5,12 |
|||
34.6309,13.1563 34.6309,13.1563C |
|||
32.1309,13.1562 31.1309,14.9062 |
|||
31.1309,14.9062C 41.1309,23.9062 |
|||
32.6309,27.9063 32.6309,27.9062C |
|||
24.6309,24.9063 21.1309,22.1562 |
|||
16.6309,18.6563 Z M 16.6309,19.9063C |
|||
21.6309,24.1563 25.1309,26.1562 |
|||
31.6309,28.6562C 31.6309,28.6562 |
|||
26.3809,39.1562 18.3809,36.1563C |
|||
18.3809,36.1563 18,38 16.3809,36.9063C |
|||
15,36 16.3809,34.9063 16.3809,34.9063C |
|||
16.3809,34.9063 10.1309,30.9062 16.6309,19.9063 Z"/> |
|||
</Template> |
|||
<Template x:Key="Heart"> |
|||
<Path Fill="Red" Stretch="Uniform" Data=" |
|||
M 272.70141,238.71731 |
|||
C 206.46141,238.71731 152.70146,292.4773 152.70146,358.71731 |
|||
C 152.70146,493.47282 288.63461,528.80461 381.26391,662.02535 |
|||
C 468.83815,529.62199 609.82641,489.17075 609.82641,358.71731 |
|||
C 609.82641,292.47731 556.06651,238.7173 489.82641,238.71731 |
|||
C 441.77851,238.71731 400.42481,267.08774 381.26391,307.90481 |
|||
C 362.10311,267.08773 320.74941,238.7173 272.70141,238.71731 z "/> |
|||
</Template> |
|||
</Styles.Resources> |
|||
<Style Selector="Border.Test"> |
|||
<Setter Property="Margin" Value="15"/> |
|||
<Setter Property="Width" Value="100"/> |
|||
<Setter Property="Height" Value="100"/> |
|||
<Setter Property="Child" Value="{StaticResource Acorn}"/> |
|||
</Style> |
|||
<Style Selector="Border.Rect1:pointerover"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:2.5" |
|||
RepeatCount="4" |
|||
FillMode="None" |
|||
PlaybackDirection="AlternateReverse" |
|||
Easing="SineEaseInOut"> |
|||
<KeyFrame Cue="20%"> |
|||
<Setter Property="RotateTransform.Angle" Value="45"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="50%"> |
|||
<Setter Property="ScaleTransform.ScaleX" Value="1.5"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="80%"> |
|||
<Setter Property="RotateTransform.Angle" Value="120"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
<Style Selector="Border.Rect2:pointerover"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.5" Easing="SineEaseInOut"> |
|||
<KeyFrame Cue="50%"> |
|||
<Setter Property="ScaleTransform.ScaleX" Value="0.8"/> |
|||
<Setter Property="ScaleTransform.ScaleY" Value="0.8"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
<Style Selector="Border.Rect3"> |
|||
<Setter Property="Child" Value="{StaticResource Heart}"/> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:0.5" |
|||
Easing="QuadraticEaseInOut" |
|||
RepeatCount="Loop"> |
|||
<KeyFrame Cue="50%"> |
|||
<Setter Property="ScaleTransform.ScaleX" Value="0.8"/> |
|||
<Setter Property="ScaleTransform.ScaleY" Value="0.8"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
<Style Selector="Border.Rect4:pointerover"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:3" Easing="BounceEaseInOut"> |
|||
<KeyFrame Cue="48%"> |
|||
<Setter Property="TranslateTransform.Y" Value="-100"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
<Style Selector="Border.Rect5:pointerover"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:3" Easing="CircularEaseInOut"> |
|||
<KeyFrame Cue="25%"> |
|||
<Setter Property="SkewTransform.AngleX" Value="-20"/> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="75%"> |
|||
<Setter Property="SkewTransform.AngleX" Value="20"/> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
</Styles> |
|||
</UserControl.Styles> |
|||
<Grid> |
|||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" ClipToBounds="False"> |
|||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"> |
|||
<TextBlock VerticalAlignment="Center">Hover to activate Transform Keyframe Animations.</TextBlock> |
|||
<Button Content="{Binding PlayStateText}" Command="{Binding ToggleGlobalPlayState}"/> |
|||
</StackPanel> |
|||
<WrapPanel ClipToBounds="False"> |
|||
<Border Classes="Test Rect1" Background="DarkRed"/> |
|||
<Border Classes="Test Rect2" Background="Magenta"/> |
|||
<Border Classes="Test Rect3"/> |
|||
<Border Classes="Test Rect4" Background="Navy"/> |
|||
<Border Classes="Test Rect5" Background="SeaGreen"/> |
|||
</WrapPanel> |
|||
</StackPanel> |
|||
</Grid> |
|||
</UserControl> |
|||
@ -1,24 +0,0 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Logging.Serilog; |
|||
using Avalonia.Platform; |
|||
using Serilog; |
|||
|
|||
namespace RenderTest |
|||
{ |
|||
internal class Program |
|||
{ |
|||
static void Main(string[] args) |
|||
{ |
|||
// TODO: Make this work with GTK/Skia/Cairo depending on command-line args
|
|||
// again.
|
|||
AppBuilder.Configure<App>() |
|||
.UsePlatformDetect() |
|||
.UseReactiveUI() |
|||
.LogToDebug() |
|||
.Start<MainWindow>(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,36 +0,0 @@ |
|||
using System.Reflection; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
// General Information about an assembly is controlled through the following
|
|||
// set of attributes. Change these attribute values to modify the information
|
|||
// associated with an assembly.
|
|||
[assembly: AssemblyTitle("RenderTest")] |
|||
[assembly: AssemblyDescription("")] |
|||
[assembly: AssemblyConfiguration("")] |
|||
[assembly: AssemblyCompany("")] |
|||
[assembly: AssemblyProduct("RenderTest")] |
|||
[assembly: AssemblyCopyright("Copyright © 2016")] |
|||
[assembly: AssemblyTrademark("")] |
|||
[assembly: AssemblyCulture("")] |
|||
|
|||
// Setting ComVisible to false makes the types in this assembly not visible
|
|||
// to COM components. If you need to access a type in this assembly from
|
|||
// COM, set the ComVisible attribute to true on that type.
|
|||
[assembly: ComVisible(false)] |
|||
|
|||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|||
[assembly: Guid("f1fdc5b0-4654-416f-ae69-e3e9bbd87801")] |
|||
|
|||
// Version information for an assembly consists of the following four values:
|
|||
//
|
|||
// Major Version
|
|||
// Minor Version
|
|||
// Build Number
|
|||
// Revision
|
|||
//
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
|||
// by using the '*' as shown below:
|
|||
// [assembly: AssemblyVersion("1.0.*")]
|
|||
[assembly: AssemblyVersion("1.0.0.0")] |
|||
[assembly: AssemblyFileVersion("1.0.0.0")] |
|||
@ -1,184 +1,33 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProjectGuid>{F1FDC5B0-4654-416F-AE69-E3E9BBD87801}</ProjectGuid> |
|||
<OutputType>WinExe</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>RenderTest</RootNamespace> |
|||
<AssemblyName>RenderTest</AssemblyName> |
|||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|||
<TargetFrameworkProfile /> |
|||
<OutputType>Exe</OutputType> |
|||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<PlatformTarget>AnyCPU</PlatformTarget> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<PlatformTarget>AnyCPU</PlatformTarget> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup> |
|||
<StartupObject /> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Core" /> |
|||
<Reference Include="System.Xml.Linq" /> |
|||
<Reference Include="System.Data.DataSetExtensions" /> |
|||
<Reference Include="Microsoft.CSharp" /> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Net.Http" /> |
|||
<Reference Include="System.Xml" /> |
|||
<Reference Include="WindowsBase" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="App.xaml.cs"> |
|||
<DependentUpon>App.xaml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Pages\DrawingPage.xaml.cs"> |
|||
<DependentUpon>DrawingPage.xaml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Pages\ClippingPage.xaml.cs"> |
|||
<DependentUpon>ClippingPage.xaml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Pages\AnimationsPage.xaml.cs"> |
|||
<DependentUpon>AnimationsPage.xaml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Program.cs" /> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
<Compile Include="MainWindow.xaml.cs"> |
|||
<DependentUpon>MainWindow.xaml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="ViewModels\MainWindowViewModel.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<None Include="App.config" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="App.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj"> |
|||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
|||
<Name>Avalonia.Animation</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj"> |
|||
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project> |
|||
<Name>Avalonia.Base</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj"> |
|||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project> |
|||
<Name>Avalonia.Controls</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj"> |
|||
<Project>{799a7bb5-3c2c-48b6-85a7-406a12c420da}</Project> |
|||
<Name>Avalonia.DesignerSupport</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj"> |
|||
<Project>{7062ae20-5dcc-4442-9645-8195bdece63e}</Project> |
|||
<Name>Avalonia.Diagnostics</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj"> |
|||
<Project>{4a1abb09-9047-4bd5-a4ad-a055e52c5ee0}</Project> |
|||
<Name>Avalonia.DotNetFrameworkRuntime</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj"> |
|||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
|||
<Name>Avalonia.Input</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj"> |
|||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
|||
<Name>Avalonia.Interactivity</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj"> |
|||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
|||
<Name>Avalonia.Layout</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj"> |
|||
<Project>{b61b66a3-b82d-4875-8001-89d3394fe0c9}</Project> |
|||
<Name>Avalonia.Logging.Serilog</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj"> |
|||
<Project>{6417b24e-49c2-4985-8db2-3ab9d898ec91}</Project> |
|||
<Name>Avalonia.ReactiveUI</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj"> |
|||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|||
<Name>Avalonia.Visuals</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj"> |
|||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project> |
|||
<Name>Avalonia.Styling</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj"> |
|||
<Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project> |
|||
<Name>Avalonia.Themes.Default</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj"> |
|||
<Project>{3e53a01a-b331-47f3-b828-4a5717e77a24}</Project> |
|||
<Name>Avalonia.Markup.Xaml</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj"> |
|||
<Project>{6417e941-21bc-467b-a771-0de389353ce6}</Project> |
|||
<Name>Avalonia.Markup</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Skia\Avalonia.Skia\Avalonia.Skia.csproj"> |
|||
<Project>{7d2d3083-71dd-4cc9-8907-39a0d86fb322}</Project> |
|||
<Name>Avalonia.Skia</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj"> |
|||
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project> |
|||
<Name>Avalonia.Direct2D1</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj"> |
|||
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project> |
|||
<Name>Avalonia.Win32</Name> |
|||
</ProjectReference> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="MainWindow.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="SideBar.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="Pages\AnimationsPage.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="Pages\ClippingPage.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="Pages\DrawingPage.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
</ItemGroup> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj" /> |
|||
|
|||
<ProjectReference Condition="'$(TargetFramework)'=='netcoreapp2.0'" Include="..\..\src\Avalonia.DotNetCoreRuntime\Avalonia.DotNetCoreRuntime.csproj" /> |
|||
|
|||
<ProjectReference Condition="'$(TargetFramework)'=='net461'" Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj" /> |
|||
|
|||
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj" /> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj" /> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj" /> |
|||
</ItemGroup> |
|||
<Import Project="..\..\build\SampleApp.props" /> |
|||
<Import Project="..\..\build\EmbedXaml.props" /> |
|||
<Import Project="..\..\build\Serilog.props" /> |
|||
<Import Project="..\..\build\Rx.props" /> |
|||
<Import Project="..\..\build\ReactiveUI.props" /> |
|||
|
|||
@ -0,0 +1,40 @@ |
|||
using System; |
|||
using ReactiveUI; |
|||
using Avalonia.Animation; |
|||
|
|||
namespace RenderTest.ViewModels |
|||
{ |
|||
public class AnimationsPageViewModel : ReactiveObject |
|||
{ |
|||
private string _playStateText = "Pause all animations"; |
|||
|
|||
public AnimationsPageViewModel() |
|||
{ |
|||
ToggleGlobalPlayState = ReactiveCommand.Create(()=>TogglePlayState()); |
|||
} |
|||
|
|||
void TogglePlayState() |
|||
{ |
|||
switch (Timing.GetGlobalPlayState()) |
|||
{ |
|||
case PlayState.Run: |
|||
PlayStateText = "Resume all animations"; |
|||
Timing.SetGlobalPlayState(PlayState.Pause); |
|||
break; |
|||
|
|||
case PlayState.Pause: |
|||
PlayStateText = "Pause all animations"; |
|||
Timing.SetGlobalPlayState(PlayState.Run); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
public string PlayStateText |
|||
{ |
|||
get { return _playStateText; } |
|||
set { this.RaiseAndSetIfChanged(ref _playStateText, value); } |
|||
} |
|||
|
|||
public ReactiveCommand ToggleGlobalPlayState { get; } |
|||
} |
|||
} |
|||
@ -1,36 +0,0 @@ |
|||
using System.Reflection; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
// General Information about an assembly is controlled through the following
|
|||
// set of attributes. Change these attribute values to modify the information
|
|||
// associated with an assembly.
|
|||
[assembly: AssemblyTitle("VirtualizationTest")] |
|||
[assembly: AssemblyDescription("")] |
|||
[assembly: AssemblyConfiguration("")] |
|||
[assembly: AssemblyCompany("")] |
|||
[assembly: AssemblyProduct("VirtualizationTest")] |
|||
[assembly: AssemblyCopyright("Copyright © 2016")] |
|||
[assembly: AssemblyTrademark("")] |
|||
[assembly: AssemblyCulture("")] |
|||
|
|||
// Setting ComVisible to false makes the types in this assembly not visible
|
|||
// to COM components. If you need to access a type in this assembly from
|
|||
// COM, set the ComVisible attribute to true on that type.
|
|||
[assembly: ComVisible(false)] |
|||
|
|||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|||
[assembly: Guid("fbcaf3d0-2808-4934-8e96-3f607594517b")] |
|||
|
|||
// Version information for an assembly consists of the following four values:
|
|||
//
|
|||
// Major Version
|
|||
// Minor Version
|
|||
// Build Number
|
|||
// Revision
|
|||
//
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
|||
// by using the '*' as shown below:
|
|||
// [assembly: AssemblyVersion("1.0.*")]
|
|||
[assembly: AssemblyVersion("1.0.0.0")] |
|||
[assembly: AssemblyFileVersion("1.0.0.0")] |
|||
@ -1,151 +1,33 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProjectGuid>{FBCAF3D0-2808-4934-8E96-3F607594517B}</ProjectGuid> |
|||
<OutputType>WinExe</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>VirtualizationTest</RootNamespace> |
|||
<AssemblyName>VirtualizationTest</AssemblyName> |
|||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|||
<TargetFrameworkProfile /> |
|||
<OutputType>Exe</OutputType> |
|||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<PlatformTarget>AnyCPU</PlatformTarget> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<PlatformTarget>AnyCPU</PlatformTarget> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup> |
|||
<StartupObject /> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Core" /> |
|||
<Reference Include="System.Xml.Linq" /> |
|||
<Reference Include="System.Data.DataSetExtensions" /> |
|||
<Reference Include="Microsoft.CSharp" /> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Net.Http" /> |
|||
<Reference Include="System.Xml" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="App.xaml.cs"> |
|||
<DependentUpon>App.xaml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="MainWindow.xaml.cs"> |
|||
<DependentUpon>MainWindow.xaml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Program.cs" /> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
<Compile Include="ViewModels\ItemViewModel.cs" /> |
|||
<Compile Include="ViewModels\MainWindowViewModel.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<None Include="App.config" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj"> |
|||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
|||
<Name>Avalonia.Animation</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj"> |
|||
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project> |
|||
<Name>Avalonia.Base</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj"> |
|||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project> |
|||
<Name>Avalonia.Controls</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj"> |
|||
<Project>{799a7bb5-3c2c-48b6-85a7-406a12c420da}</Project> |
|||
<Name>Avalonia.DesignerSupport</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj"> |
|||
<Project>{7062ae20-5dcc-4442-9645-8195bdece63e}</Project> |
|||
<Name>Avalonia.Diagnostics</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj"> |
|||
<Project>{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}</Project> |
|||
<Name>Avalonia.DotNetFrameworkRuntime</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj"> |
|||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
|||
<Name>Avalonia.Input</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj"> |
|||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
|||
<Name>Avalonia.Interactivity</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj"> |
|||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
|||
<Name>Avalonia.Layout</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj"> |
|||
<Project>{B61B66A3-B82D-4875-8001-89D3394FE0C9}</Project> |
|||
<Name>Avalonia.Logging.Serilog</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj"> |
|||
<Project>{6417b24e-49c2-4985-8db2-3ab9d898ec91}</Project> |
|||
<Name>Avalonia.ReactiveUI</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj"> |
|||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|||
<Name>Avalonia.Visuals</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj"> |
|||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project> |
|||
<Name>Avalonia.Styling</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj"> |
|||
<Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project> |
|||
<Name>Avalonia.Themes.Default</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj"> |
|||
<Project>{3e53a01a-b331-47f3-b828-4a5717e77a24}</Project> |
|||
<Name>Avalonia.Markup.Xaml</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj"> |
|||
<Project>{6417e941-21bc-467b-a771-0de389353ce6}</Project> |
|||
<Name>Avalonia.Markup</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" Condition="'$(Platform)'!='Mono'"> |
|||
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project> |
|||
<Name>Avalonia.Direct2D1</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" Condition="'$(Platform)'!='Mono'"> |
|||
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project> |
|||
<Name>Avalonia.Win32</Name> |
|||
</ProjectReference> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="App.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="MainWindow.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj" /> |
|||
|
|||
<ProjectReference Condition="'$(TargetFramework)'=='netcoreapp2.0'" Include="..\..\src\Avalonia.DotNetCoreRuntime\Avalonia.DotNetCoreRuntime.csproj" /> |
|||
|
|||
<ProjectReference Condition="'$(TargetFramework)'=='net461'" Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj" /> |
|||
|
|||
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj" /> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj" /> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj" /> |
|||
</ItemGroup> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<Import Project="..\..\build\SampleApp.props" /> |
|||
<Import Project="..\..\build\EmbedXaml.props" /> |
|||
<Import Project="..\..\build\Serilog.props" /> |
|||
<Import Project="..\..\build\Rx.props" /> |
|||
<Import Project="..\..\build\ReactiveUI.props" /> |
|||
|
|||
@ -1,134 +0,0 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
using System.Diagnostics; |
|||
using System.Linq; |
|||
using System.Reactive.Linq; |
|||
using Avalonia.Data; |
|||
using Avalonia.Threading; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Utilities for creating animations.
|
|||
/// </summary>
|
|||
public static class Animate |
|||
{ |
|||
/// <summary>
|
|||
/// The number of frames per second.
|
|||
/// </summary>
|
|||
public const int FramesPerSecond = 60; |
|||
|
|||
/// <summary>
|
|||
/// The time span of each frame.
|
|||
/// </summary>
|
|||
private static readonly TimeSpan Tick = TimeSpan.FromSeconds(1.0 / FramesPerSecond); |
|||
|
|||
/// <summary>
|
|||
/// Initializes static members of the <see cref="Animate"/> class.
|
|||
/// </summary>
|
|||
static Animate() |
|||
{ |
|||
Stopwatch = new Stopwatch(); |
|||
Stopwatch.Start(); |
|||
Timer = Observable.Interval(Tick, AvaloniaScheduler.Instance) |
|||
.Select(_ => Stopwatch.Elapsed) |
|||
.Publish() |
|||
.RefCount(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The stopwatch used to track time.
|
|||
/// </summary>
|
|||
/// <value>
|
|||
/// The stopwatch used to track time.
|
|||
/// </value>
|
|||
public static Stopwatch Stopwatch |
|||
{ |
|||
get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the animation timer.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// The animation timer ticks <see cref="FramesPerSecond"/> times per second. The
|
|||
/// parameter passed to a subsciber is the time span since the animation system was
|
|||
/// initialized.
|
|||
/// </remarks>
|
|||
/// <value>
|
|||
/// The animation timer.
|
|||
/// </value>
|
|||
public static IObservable<TimeSpan> Timer |
|||
{ |
|||
get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets a timer that fires every frame for the specified duration.
|
|||
/// </summary>
|
|||
/// <param name="duration">The duration of the animation.</param>
|
|||
/// <returns>
|
|||
/// An observable that notifies the subscriber of the progress along the animation.
|
|||
/// </returns>
|
|||
/// <remarks>
|
|||
/// The parameter passed to the subscriber is the progress along the animation, with
|
|||
/// 0 being the start and 1 being the end. The observable is guaranteed to fire 0
|
|||
/// immediately on subscribe and 1 at the end of the duration.
|
|||
/// </remarks>
|
|||
public static IObservable<double> GetTimer(TimeSpan duration) |
|||
{ |
|||
var startTime = Stopwatch.Elapsed.Ticks; |
|||
var endTime = startTime + duration.Ticks; |
|||
return Timer |
|||
.TakeWhile(x => x.Ticks < endTime) |
|||
.Select(x => (x.Ticks - startTime) / (double)duration.Ticks) |
|||
.StartWith(0.0) |
|||
.Concat(Observable.Return(1.0)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Animates a <see cref="AvaloniaProperty"/>.
|
|||
/// </summary>
|
|||
/// <param name="target">The target object.</param>
|
|||
/// <param name="property">The target property.</param>
|
|||
/// <param name="start">The value of the property at the start of the animation.</param>
|
|||
/// <param name="finish">The value of the property at the end of the animation.</param>
|
|||
/// <param name="easing">The easing function to use.</param>
|
|||
/// <param name="duration">The duration of the animation.</param>
|
|||
/// <returns>An <see cref="Animation"/> that can be used to track or stop the animation.</returns>
|
|||
public static Animation Property( |
|||
IAvaloniaObject target, |
|||
AvaloniaProperty property, |
|||
object start, |
|||
object finish, |
|||
IEasing easing, |
|||
TimeSpan duration) |
|||
{ |
|||
var o = GetTimer(duration).Select(progress => easing.Ease(progress, start, finish)); |
|||
return new Animation(o, target.Bind(property, o, BindingPriority.Animation)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Animates a <see cref="AvaloniaProperty"/>.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The property type.</typeparam>
|
|||
/// <param name="target">The target object.</param>
|
|||
/// <param name="property">The target property.</param>
|
|||
/// <param name="start">The value of the property at the start of the animation.</param>
|
|||
/// <param name="finish">The value of the property at the end of the animation.</param>
|
|||
/// <param name="easing">The easing function to use.</param>
|
|||
/// <param name="duration">The duration of the animation.</param>
|
|||
/// <returns>An <see cref="Animation"/> that can be used to track or stop the animation.</returns>
|
|||
public static Animation<T> Property<T>( |
|||
IAvaloniaObject target, |
|||
AvaloniaProperty<T> property, |
|||
T start, |
|||
T finish, |
|||
IEasing<T> easing, |
|||
TimeSpan duration) |
|||
{ |
|||
var o = GetTimer(duration).Select(progress => easing.Ease(progress, start, finish)); |
|||
return new Animation<T>(o, target.Bind(property, o, BindingPriority.Animation)); |
|||
} |
|||
} |
|||
} |
|||
@ -1,45 +0,0 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Defines animation extension methods.
|
|||
/// </summary>
|
|||
public static class AnimationExtensions |
|||
{ |
|||
/// <summary>
|
|||
/// Returns a new <see cref="PropertyTransition"/> for the specified
|
|||
/// <see cref="AvaloniaProperty"/> using linear easing.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The type of the <see cref="AvaloniaProperty"/>.</typeparam>
|
|||
/// <param name="property">The property to animate.</param>
|
|||
/// <param name="milliseconds">The animation duration in milliseconds.</param>
|
|||
/// <returns>
|
|||
/// A <see cref="PropertyTransition"/> that can be added to the
|
|||
/// <see cref="Animatable.PropertyTransitions"/> collection.
|
|||
/// </returns>
|
|||
public static PropertyTransition Transition<T>(this AvaloniaProperty<T> property, int milliseconds) |
|||
{ |
|||
return Transition(property, TimeSpan.FromMilliseconds(milliseconds)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns a new <see cref="PropertyTransition"/> for the specified
|
|||
/// <see cref="AvaloniaProperty"/> using linear easing.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The type of the <see cref="AvaloniaProperty"/>.</typeparam>
|
|||
/// <param name="property">The property to animate.</param>
|
|||
/// <param name="duration">The animation duration.</param>
|
|||
/// <returns>
|
|||
/// A <see cref="PropertyTransition"/> that can be added to the
|
|||
/// <see cref="Animatable.PropertyTransitions"/> collection.
|
|||
/// </returns>
|
|||
public static PropertyTransition Transition<T>(this AvaloniaProperty<T> property, TimeSpan duration) |
|||
{ |
|||
return new PropertyTransition(property, duration, LinearEasing.For<T>()); |
|||
} |
|||
} |
|||
} |
|||
@ -1,56 +0,0 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Tracks the progress of an animation.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The type of the value being animated./</typeparam>
|
|||
public class Animation<T> : IObservable<T>, IDisposable |
|||
{ |
|||
/// <summary>
|
|||
/// The animation being tracked.
|
|||
/// </summary>
|
|||
private readonly IObservable<T> _inner; |
|||
|
|||
/// <summary>
|
|||
/// The disposable used to cancel the animation.
|
|||
/// </summary>
|
|||
private readonly IDisposable _subscription; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Animation{T}"/> class.
|
|||
/// </summary>
|
|||
/// <param name="inner">The animation observable being tracked.</param>
|
|||
/// <param name="subscription">A disposable used to cancel the animation.</param>
|
|||
public Animation(IObservable<T> inner, IDisposable subscription) |
|||
{ |
|||
_inner = inner; |
|||
_subscription = subscription; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Cancels the animation.
|
|||
/// </summary>
|
|||
public void Dispose() |
|||
{ |
|||
_subscription.Dispose(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Notifies the provider that an observer is to receive notifications.
|
|||
/// </summary>
|
|||
/// <param name="observer">The observer.</param>
|
|||
/// <returns>
|
|||
/// A reference to an interface that allows observers to stop receiving notifications
|
|||
/// before the provider has finished sending them.
|
|||
/// </returns>
|
|||
public IDisposable Subscribe(IObserver<T> observer) |
|||
{ |
|||
return _inner.Subscribe(observer); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.ComponentModel; |
|||
using Avalonia.Metadata; |
|||
using Avalonia.Collections; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Defines a KeyFrame that is used for
|
|||
/// <see cref="Animator{T}"/> objects.
|
|||
/// </summary>
|
|||
public class AnimatorKeyFrame |
|||
{ |
|||
public Type Handler; |
|||
public Cue Cue; |
|||
public TimeSpan KeyTime; |
|||
internal bool timeSpanSet, cueSet; |
|||
public AvaloniaProperty Property; |
|||
public object Value; |
|||
} |
|||
} |
|||
@ -0,0 +1,256 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using Avalonia.Data; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Provides statefulness for an iteration of a keyframe animation.
|
|||
/// </summary>
|
|||
internal class AnimatorStateMachine<T> : IObservable<object>, IDisposable |
|||
{ |
|||
object _lastInterpValue; |
|||
object _firstKFValue; |
|||
|
|||
private ulong _delayTotalFrameCount; |
|||
private ulong _durationTotalFrameCount; |
|||
private ulong _delayFrameCount; |
|||
private ulong _durationFrameCount; |
|||
private ulong _repeatCount; |
|||
private ulong _currentIteration; |
|||
|
|||
private bool _isLooping; |
|||
private bool _isRepeating; |
|||
private bool _isReversed; |
|||
private bool _checkLoopAndRepeat; |
|||
private bool _gotFirstKFValue; |
|||
|
|||
private FillMode _fillMode; |
|||
private PlaybackDirection _animationDirection; |
|||
private KeyFramesStates _currentState; |
|||
private KeyFramesStates _savedState; |
|||
private Animator<T> _parent; |
|||
private Animation _targetAnimation; |
|||
private Animatable _targetControl; |
|||
private T _neutralValue; |
|||
internal bool _unsubscribe = false; |
|||
private IObserver<object> _targetObserver; |
|||
|
|||
[Flags] |
|||
private enum KeyFramesStates |
|||
{ |
|||
Initialize, |
|||
DoDelay, |
|||
DoRun, |
|||
RunForwards, |
|||
RunBackwards, |
|||
RunApplyValue, |
|||
RunComplete, |
|||
Pause, |
|||
Stop, |
|||
Disposed |
|||
} |
|||
|
|||
public void Initialize(Animation animation, Animatable control, Animator<T> keyframes) |
|||
{ |
|||
_parent = keyframes; |
|||
_targetAnimation = animation; |
|||
_targetControl = control; |
|||
_neutralValue = (T)_targetControl.GetValue(_parent.Property); |
|||
|
|||
_delayTotalFrameCount = (ulong)(animation.Delay.Ticks / Timing.FrameTick.Ticks); |
|||
_durationTotalFrameCount = (ulong)(animation.Duration.Ticks / Timing.FrameTick.Ticks); |
|||
|
|||
switch (animation.RepeatCount.RepeatType) |
|||
{ |
|||
case RepeatType.Loop: |
|||
_isLooping = true; |
|||
_checkLoopAndRepeat = true; |
|||
break; |
|||
case RepeatType.Repeat: |
|||
_isRepeating = true; |
|||
_checkLoopAndRepeat = true; |
|||
_repeatCount = animation.RepeatCount.Value; |
|||
break; |
|||
} |
|||
|
|||
_isReversed = (animation.PlaybackDirection & PlaybackDirection.Reverse) != 0; |
|||
_animationDirection = _targetAnimation.PlaybackDirection; |
|||
_fillMode = _targetAnimation.FillMode; |
|||
|
|||
if (_durationTotalFrameCount > 0) |
|||
_currentState = KeyFramesStates.DoDelay; |
|||
else |
|||
_currentState = KeyFramesStates.DoRun; |
|||
} |
|||
|
|||
public void Step(PlayState _playState, Func<double, T, T> Interpolator) |
|||
{ |
|||
try |
|||
{ |
|||
InternalStep(_playState, Interpolator); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
_targetObserver?.OnError(e); |
|||
} |
|||
} |
|||
|
|||
private void InternalStep(PlayState _playState, Func<double, T, T> Interpolator) |
|||
{ |
|||
if (!_gotFirstKFValue) |
|||
{ |
|||
_firstKFValue = _parent.First().Value; |
|||
_gotFirstKFValue = true; |
|||
} |
|||
|
|||
if (_currentState == KeyFramesStates.Disposed) |
|||
throw new InvalidProgramException("This KeyFrames Animation is already disposed."); |
|||
|
|||
if (_playState == PlayState.Stop) |
|||
_currentState = KeyFramesStates.Stop; |
|||
|
|||
// Save state and pause the machine
|
|||
if (_playState == PlayState.Pause && _currentState != KeyFramesStates.Pause) |
|||
{ |
|||
_savedState = _currentState; |
|||
_currentState = KeyFramesStates.Pause; |
|||
} |
|||
|
|||
// Resume the previous state
|
|||
if (_playState != PlayState.Pause && _currentState == KeyFramesStates.Pause) |
|||
_currentState = _savedState; |
|||
|
|||
double _tempDuration = 0d, _easedTime; |
|||
|
|||
checkstate: |
|||
switch (_currentState) |
|||
{ |
|||
case KeyFramesStates.DoDelay: |
|||
|
|||
if (_fillMode == FillMode.Backward |
|||
|| _fillMode == FillMode.Both) |
|||
{ |
|||
if (_currentIteration == 0) |
|||
{ |
|||
_targetObserver.OnNext(_firstKFValue); |
|||
} |
|||
else |
|||
{ |
|||
_targetObserver.OnNext(_lastInterpValue); |
|||
} |
|||
} |
|||
|
|||
if (_delayFrameCount > _delayTotalFrameCount) |
|||
{ |
|||
_currentState = KeyFramesStates.DoRun; |
|||
goto checkstate; |
|||
} |
|||
_delayFrameCount++; |
|||
break; |
|||
|
|||
case KeyFramesStates.DoRun: |
|||
|
|||
if (_isReversed) |
|||
_currentState = KeyFramesStates.RunBackwards; |
|||
else |
|||
_currentState = KeyFramesStates.RunForwards; |
|||
|
|||
goto checkstate; |
|||
|
|||
case KeyFramesStates.RunForwards: |
|||
|
|||
if (_durationFrameCount > _durationTotalFrameCount) |
|||
{ |
|||
_currentState = KeyFramesStates.RunComplete; |
|||
goto checkstate; |
|||
} |
|||
|
|||
_tempDuration = (double)_durationFrameCount / _durationTotalFrameCount; |
|||
_currentState = KeyFramesStates.RunApplyValue; |
|||
|
|||
goto checkstate; |
|||
|
|||
case KeyFramesStates.RunBackwards: |
|||
|
|||
if (_durationFrameCount > _durationTotalFrameCount) |
|||
{ |
|||
_currentState = KeyFramesStates.RunComplete; |
|||
goto checkstate; |
|||
} |
|||
|
|||
_tempDuration = (double)(_durationTotalFrameCount - _durationFrameCount) / _durationTotalFrameCount; |
|||
_currentState = KeyFramesStates.RunApplyValue; |
|||
|
|||
goto checkstate; |
|||
|
|||
case KeyFramesStates.RunApplyValue: |
|||
|
|||
_easedTime = _targetAnimation.Easing.Ease(_tempDuration); |
|||
|
|||
_durationFrameCount++; |
|||
_lastInterpValue = Interpolator(_easedTime, _neutralValue); |
|||
_targetObserver.OnNext(_lastInterpValue); |
|||
_currentState = KeyFramesStates.DoRun; |
|||
|
|||
break; |
|||
|
|||
case KeyFramesStates.RunComplete: |
|||
|
|||
if (_checkLoopAndRepeat) |
|||
{ |
|||
_delayFrameCount = 0; |
|||
_durationFrameCount = 0; |
|||
|
|||
if (_isLooping) |
|||
{ |
|||
_currentState = KeyFramesStates.DoRun; |
|||
} |
|||
else if (_isRepeating) |
|||
{ |
|||
if (_currentIteration >= _repeatCount) |
|||
{ |
|||
_currentState = KeyFramesStates.Stop; |
|||
} |
|||
else |
|||
{ |
|||
_currentState = KeyFramesStates.DoRun; |
|||
} |
|||
_currentIteration++; |
|||
} |
|||
|
|||
if (_animationDirection == PlaybackDirection.Alternate |
|||
|| _animationDirection == PlaybackDirection.AlternateReverse) |
|||
_isReversed = !_isReversed; |
|||
|
|||
break; |
|||
} |
|||
|
|||
_currentState = KeyFramesStates.Stop; |
|||
goto checkstate; |
|||
|
|||
case KeyFramesStates.Stop: |
|||
|
|||
if (_fillMode == FillMode.Forward |
|||
|| _fillMode == FillMode.Both) |
|||
{ |
|||
_targetControl.SetValue(_parent.Property, _lastInterpValue, BindingPriority.LocalValue); |
|||
} |
|||
_targetObserver.OnCompleted(); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
public IDisposable Subscribe(IObserver<object> observer) |
|||
{ |
|||
_targetObserver = observer; |
|||
return this; |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
_unsubscribe = true; |
|||
_currentState = KeyFramesStates.Disposed; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,192 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using Avalonia.Collections; |
|||
using System.ComponentModel; |
|||
using Avalonia.Animation.Utils; |
|||
using System.Reactive.Linq; |
|||
using System.Linq; |
|||
using Avalonia.Data; |
|||
using System.Reactive.Disposables; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Base class for KeyFrames objects
|
|||
/// </summary>
|
|||
public abstract class Animator<T> : AvaloniaList<AnimatorKeyFrame>, IAnimator |
|||
{ |
|||
/// <summary>
|
|||
/// List of type-converted keyframes.
|
|||
/// </summary>
|
|||
private Dictionary<double, (T, bool isNeutral)> _convertedKeyframes = new Dictionary<double, (T, bool)>(); |
|||
|
|||
private bool _isVerfifiedAndConverted; |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the target property for the keyframe.
|
|||
/// </summary>
|
|||
public AvaloniaProperty Property { get; set; } |
|||
|
|||
public Animator() |
|||
{ |
|||
// Invalidate keyframes when changed.
|
|||
this.CollectionChanged += delegate { _isVerfifiedAndConverted = false; }; |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public virtual IDisposable Apply(Animation animation, Animatable control, IObservable<bool> obsMatch) |
|||
{ |
|||
if (!_isVerfifiedAndConverted) |
|||
VerifyConvertKeyFrames(animation, typeof(T)); |
|||
|
|||
return obsMatch |
|||
.Where(p => p == true) |
|||
// Ignore triggers when global timers are paused.
|
|||
.Where(p => Timing.GetGlobalPlayState() != PlayState.Pause) |
|||
.Subscribe(_ => |
|||
{ |
|||
var timerObs = RunKeyFrames(animation, control); |
|||
}); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Get the nearest pair of cue-time ordered keyframes
|
|||
/// according to the given time parameter that is relative to the
|
|||
/// total animation time and the normalized intra-keyframe pair time
|
|||
/// (i.e., the normalized time between the selected keyframes, relative to the
|
|||
/// time parameter).
|
|||
/// </summary>
|
|||
/// <param name="t">The time parameter, relative to the total animation time</param>
|
|||
protected (double IntraKFTime, KeyFramePair<T> KFPair) GetKFPairAndIntraKFTime(double t) |
|||
{ |
|||
KeyValuePair<double, (T, bool)> firstCue, lastCue; |
|||
int kvCount = _convertedKeyframes.Count(); |
|||
if (kvCount > 2) |
|||
{ |
|||
if (DoubleUtils.AboutEqual(t, 0.0) || t < 0.0) |
|||
{ |
|||
firstCue = _convertedKeyframes.First(); |
|||
lastCue = _convertedKeyframes.Skip(1).First(); |
|||
} |
|||
else if (DoubleUtils.AboutEqual(t, 1.0) || t > 1.0) |
|||
{ |
|||
firstCue = _convertedKeyframes.Skip(kvCount - 2).First(); |
|||
lastCue = _convertedKeyframes.Last(); |
|||
} |
|||
else |
|||
{ |
|||
firstCue = _convertedKeyframes.Where(j => j.Key <= t).Last(); |
|||
lastCue = _convertedKeyframes.Where(j => j.Key >= t).First(); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
firstCue = _convertedKeyframes.First(); |
|||
lastCue = _convertedKeyframes.Last(); |
|||
} |
|||
|
|||
double t0 = firstCue.Key; |
|||
double t1 = lastCue.Key; |
|||
var intraframeTime = (t - t0) / (t1 - t0); |
|||
return (intraframeTime, new KeyFramePair<T>(firstCue, lastCue)); |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// Runs the KeyFrames Animation.
|
|||
/// </summary>
|
|||
private IDisposable RunKeyFrames(Animation animation, Animatable control) |
|||
{ |
|||
var _kfStateMach = new AnimatorStateMachine<T>(); |
|||
_kfStateMach.Initialize(animation, control, this); |
|||
|
|||
Timing.AnimationStateTimer |
|||
.TakeWhile(_ => !_kfStateMach._unsubscribe) |
|||
.Subscribe(p => |
|||
{ |
|||
_kfStateMach.Step(p, DoInterpolation); |
|||
}); |
|||
|
|||
return control.Bind(Property, _kfStateMach, BindingPriority.Animation); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Interpolates a value given the desired time.
|
|||
/// </summary>
|
|||
protected abstract T DoInterpolation(double time, T neutralValue); |
|||
|
|||
/// <summary>
|
|||
/// Verifies and converts keyframe values according to this class's target type.
|
|||
/// </summary>
|
|||
private void VerifyConvertKeyFrames(Animation animation, Type type) |
|||
{ |
|||
var typeConv = TypeDescriptor.GetConverter(type); |
|||
|
|||
foreach (AnimatorKeyFrame k in this) |
|||
{ |
|||
if (k.Value == null) |
|||
{ |
|||
throw new ArgumentNullException($"KeyFrame value can't be null."); |
|||
} |
|||
if (!typeConv.CanConvertTo(k.Value.GetType())) |
|||
{ |
|||
throw new InvalidCastException($"KeyFrame value doesnt match property type."); |
|||
} |
|||
|
|||
T convertedValue = (T)typeConv.ConvertTo(k.Value, type); |
|||
|
|||
Cue _normalizedCue = k.Cue; |
|||
|
|||
if (k.timeSpanSet) |
|||
{ |
|||
_normalizedCue = new Cue(k.KeyTime.Ticks / animation.Duration.Ticks); |
|||
} |
|||
|
|||
_convertedKeyframes.Add(_normalizedCue.CueValue, (convertedValue, false)); |
|||
} |
|||
|
|||
SortKeyFrameCues(_convertedKeyframes); |
|||
_isVerfifiedAndConverted = true; |
|||
|
|||
} |
|||
|
|||
private void SortKeyFrameCues(Dictionary<double, (T, bool)> convertedValues) |
|||
{ |
|||
bool hasStartKey, hasEndKey; |
|||
hasStartKey = hasEndKey = false; |
|||
|
|||
// Make start and end keyframe mandatory.
|
|||
foreach (var converted in _convertedKeyframes.Keys) |
|||
{ |
|||
if (DoubleUtils.AboutEqual(converted, 0.0)) |
|||
{ |
|||
hasStartKey = true; |
|||
} |
|||
else if (DoubleUtils.AboutEqual(converted, 1.0)) |
|||
{ |
|||
hasEndKey = true; |
|||
} |
|||
} |
|||
|
|||
if (!hasStartKey || !hasEndKey) |
|||
AddNeutralKeyFrames(hasStartKey, hasEndKey, _convertedKeyframes); |
|||
|
|||
_convertedKeyframes = _convertedKeyframes.OrderBy(p => p.Key) |
|||
.ToDictionary((k) => k.Key, (v) => v.Value); |
|||
} |
|||
|
|||
private void AddNeutralKeyFrames(bool hasStartKey, bool hasEndKey, Dictionary<double, (T, bool)> convertedKeyframes) |
|||
{ |
|||
if (!hasStartKey) |
|||
{ |
|||
convertedKeyframes.Add(0.0d, (default(T), true)); |
|||
} |
|||
|
|||
if (!hasEndKey) |
|||
{ |
|||
convertedKeyframes.Add(1.0d, (default(T), true)); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,88 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel; |
|||
using System.Globalization; |
|||
using System.Text; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// A Cue object for <see cref="KeyFrame"/>.
|
|||
/// </summary>
|
|||
[TypeConverter(typeof(CueTypeConverter))] |
|||
public struct Cue : IEquatable<Cue>, IEquatable<double> |
|||
{ |
|||
/// <summary>
|
|||
/// The normalized percent value, ranging from 0.0 to 1.0
|
|||
/// </summary>
|
|||
public double CueValue { get; } |
|||
|
|||
/// <summary>
|
|||
/// Sets a new <see cref="Cue"/> object.
|
|||
/// </summary>
|
|||
/// <param name="value"></param>
|
|||
public Cue(double value) |
|||
{ |
|||
if (value <= 1 && value >= 0) |
|||
CueValue = value; |
|||
else |
|||
throw new ArgumentException($"This cue object's value should be within or equal to 0.0 and 1.0"); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Parses a string to a <see cref="Cue"/> object.
|
|||
/// </summary>
|
|||
public static object Parse(string value, CultureInfo culture) |
|||
{ |
|||
string v = value; |
|||
|
|||
if (value.EndsWith("%")) |
|||
{ |
|||
v = v.TrimEnd('%'); |
|||
} |
|||
|
|||
if (double.TryParse(v, NumberStyles.Float, culture, out double res)) |
|||
{ |
|||
return new Cue(res / 100d); |
|||
} |
|||
else |
|||
{ |
|||
throw new FormatException($"Invalid Cue string \"{value}\""); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Checks for equality between two <see cref="Cue"/>s.
|
|||
/// </summary>
|
|||
/// <param name="other">The second cue.</param>
|
|||
public bool Equals(Cue other) |
|||
{ |
|||
return CueValue == other.CueValue; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Checks for equality between a <see cref="Cue"/>
|
|||
/// and a <see cref="double"/> value.
|
|||
/// </summary>
|
|||
/// <param name="other"></param>
|
|||
/// <returns></returns>
|
|||
public bool Equals(double other) |
|||
{ |
|||
return CueValue == other; |
|||
} |
|||
} |
|||
|
|||
public class CueTypeConverter : TypeConverter |
|||
{ |
|||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) |
|||
{ |
|||
return sourceType == typeof(string); |
|||
} |
|||
|
|||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) |
|||
{ |
|||
return Cue.Parse((string)value, culture); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Linq; |
|||
using System.Reactive.Linq; |
|||
using System.Diagnostics; |
|||
using Avalonia.Animation.Utils; |
|||
using Avalonia.Data; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Animator that handles <see cref="double"/> properties.
|
|||
/// </summary>
|
|||
public class DoubleAnimator : Animator<double> |
|||
{ |
|||
|
|||
/// <inheritdocs/>
|
|||
protected override double DoInterpolation(double t, double neutralValue) |
|||
{ |
|||
var pair = GetKFPairAndIntraKFTime(t); |
|||
double y0, y1; |
|||
|
|||
var firstKF = pair.KFPair.FirstKeyFrame; |
|||
var secondKF = pair.KFPair.SecondKeyFrame; |
|||
|
|||
if (firstKF.Value.isNeutral) |
|||
y0 = neutralValue; |
|||
else |
|||
y0 = firstKF.Value.TargetValue; |
|||
|
|||
if (secondKF.Value.isNeutral) |
|||
y1 = neutralValue; |
|||
else |
|||
y1 = secondKF.Value.TargetValue; |
|||
|
|||
// Do linear parametric interpolation
|
|||
return y0 + (pair.IntraKFTime) * (y1 - y0); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Avalonia.Metadata; |
|||
using System; |
|||
using System.Reactive.Linq; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Transition class that handles <see cref="AvaloniaProperty"/> with <see cref="double"/> types.
|
|||
/// </summary>
|
|||
public class DoubleTransition : Transition<double> |
|||
{ |
|||
/// <inheritdocs/>
|
|||
public override IObservable<double> DoTransition(IObservable<double> progress, double oldValue, double newValue) |
|||
{ |
|||
var delta = newValue - oldValue; |
|||
return progress |
|||
.Select(p => Easing.Ease(p) * delta + oldValue); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases in a <see cref="double"/> value
|
|||
/// using a overshooting cubic function.
|
|||
/// </summary>
|
|||
public class BackEaseIn : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double p) |
|||
{ |
|||
return p * (p * p - Math.Sin(p * Math.PI)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases a <see cref="double"/> value
|
|||
/// using a piecewise overshooting cubic function.
|
|||
/// </summary>
|
|||
public class BackEaseInOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
|
|||
if (p < 0.5d) |
|||
{ |
|||
double f = 2d * p; |
|||
return 0.5d * f * (f * f - Math.Sin(f * Math.PI)); |
|||
} |
|||
else |
|||
{ |
|||
double f = (1d - (2d * p - 1d)); |
|||
return 0.5d * (1d - f * (f * f - Math.Sin(f * Math.PI))) + 0.5d; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases out a <see cref="double"/> value
|
|||
/// using a overshooting cubic function.
|
|||
/// </summary>
|
|||
public class BackEaseOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = 1d - progress; |
|||
return 1 - p * (p * p - Math.Sin(p * Math.PI)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
|
|||
using Avalonia.Animation.Utils; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases in a <see cref="double"/> value
|
|||
/// using a simulated bounce function.
|
|||
/// </summary>
|
|||
public class BounceEaseIn : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
return 1 - BounceEaseUtils.Bounce(1 - progress); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Avalonia.Animation.Utils; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases a <see cref="double"/> value
|
|||
/// using a piecewise simulated bounce function.
|
|||
/// </summary>
|
|||
public class BounceEaseInOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
if (p < 0.5d) |
|||
{ |
|||
return 0.5f * (1 - BounceEaseUtils.Bounce(1 - (p * 2))); |
|||
} |
|||
else |
|||
{ |
|||
return 0.5f * BounceEaseUtils.Bounce(p * 2 - 1) + 0.5f; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
using Avalonia.Animation.Utils; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases out a <see cref="double"/> value
|
|||
/// using a simulated bounce function.
|
|||
/// </summary>
|
|||
public class BounceEaseOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
return BounceEaseUtils.Bounce(progress); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases in a <see cref="double"/> value
|
|||
/// using the shifted fourth quadrant of
|
|||
/// the unit circle.
|
|||
/// </summary>
|
|||
public class CircularEaseIn : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double p) |
|||
{ |
|||
return 1d - Math.Sqrt(1d - p * p); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases a <see cref="double"/> value
|
|||
/// using a piecewise unit circle function.
|
|||
/// </summary>
|
|||
public class CircularEaseInOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
if (p < 0.5d) |
|||
{ |
|||
return 0.5d * (1d - Math.Sqrt(1d - 4d * p * p)); |
|||
} |
|||
else |
|||
{ |
|||
double t = 2d * p; |
|||
return 0.5d * (Math.Sqrt((3d - t) * (t - 1d)) + 1d); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases out a <see cref="double"/> value
|
|||
/// using the shifted second quadrant of
|
|||
/// the unit circle.
|
|||
/// </summary>
|
|||
public class CircularEaseOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
return Math.Sqrt((2d - p) * p); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases in a <see cref="double"/> value
|
|||
/// using a cubic equation.
|
|||
/// </summary>
|
|||
public class CubicEaseIn : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
return progress * progress * progress; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases a <see cref="double"/> value
|
|||
/// using a piece-wise cubic equation.
|
|||
/// </summary>
|
|||
public class CubicEaseInOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
|
|||
if (progress < 0.5d) |
|||
{ |
|||
return 4d * p * p * p; |
|||
} |
|||
else |
|||
{ |
|||
double f = 2d * (p - 1); |
|||
return 0.5d * f * f * f + 1d; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases out a <see cref="double"/> value
|
|||
/// using a cubic equation.
|
|||
/// </summary>
|
|||
public class CubicEaseOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double f = (progress - 1d); |
|||
return f * f * f + 1d; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
using Avalonia.Collections; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Reflection; |
|||
using System.Linq; |
|||
using System.ComponentModel; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Base class for all Easing classes.
|
|||
/// </summary>
|
|||
[TypeConverter(typeof(EasingTypeConverter))] |
|||
public abstract class Easing : IEasing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public abstract double Ease(double progress); |
|||
|
|||
static Dictionary<string, Type> _easingTypes; |
|||
|
|||
static readonly Type s_thisType = typeof(Easing); |
|||
|
|||
/// <summary>
|
|||
/// Parses a Easing type string.
|
|||
/// </summary>
|
|||
/// <param name="e">The Easing type string.</param>
|
|||
/// <returns>Returns the instance of the parsed type.</returns>
|
|||
public static Easing Parse(string e) |
|||
{ |
|||
if (_easingTypes == null) |
|||
{ |
|||
_easingTypes = new Dictionary<string, Type>(); |
|||
|
|||
// Fetch the built-in easings.
|
|||
var derivedTypes = typeof(Easing).Assembly.GetTypes() |
|||
.Where(p => p.Namespace == s_thisType.Namespace) |
|||
.Where(p => p.IsSubclassOf(s_thisType)) |
|||
.Select(p => p).ToList(); |
|||
|
|||
foreach (var easingType in derivedTypes) |
|||
_easingTypes.Add(easingType.Name, easingType); |
|||
} |
|||
|
|||
if (_easingTypes.ContainsKey(e)) |
|||
{ |
|||
var type = _easingTypes[e]; |
|||
return (Easing)Activator.CreateInstance(type); |
|||
} |
|||
else |
|||
{ |
|||
throw new FormatException($"Easing \"{e}\" was not found in {s_thisType.Namespace} namespace."); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Avalonia.Animation.Utils; |
|||
using System; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases in a <see cref="double"/> value
|
|||
/// using a damped sine function.
|
|||
/// </summary>
|
|||
public class ElasticEaseIn : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
return Math.Sin(13d * EasingUtils.HALFPI * p) * Math.Pow(2d, 10d * (p - 1)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
using Avalonia.Animation.Utils; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases a <see cref="double"/> value
|
|||
/// using a piecewise damped sine function.
|
|||
/// </summary>
|
|||
public class ElasticEaseInOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
|
|||
if (p < 0.5d) |
|||
{ |
|||
double t = 2d * p; |
|||
return 0.5d * Math.Sin(13d * EasingUtils.HALFPI * t) * Math.Pow(2d, 10d * (t - 1d)); |
|||
} |
|||
else |
|||
{ |
|||
return 0.5d * (Math.Sin(-13d * EasingUtils.HALFPI * ((2d * p - 1d) + 1d)) * Math.Pow(2d, -10d * (2d * p - 1d)) + 2d); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Avalonia.Animation.Utils; |
|||
using System; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases out a <see cref="double"/> value
|
|||
/// using a damped sine function.
|
|||
/// </summary>
|
|||
public class ElasticEaseOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
return Math.Sin(-13d * EasingUtils.HALFPI * (p + 1)) * Math.Pow(2d, -10d * p) + 1d; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases in a <see cref="double"/> value
|
|||
/// using a exponential function.
|
|||
/// </summary>
|
|||
public class ExponentialEaseIn : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
return (p == 0.0d) ? p : Math.Pow(2d, 10d * (p - 1d)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases a <see cref="double"/> value
|
|||
/// using a piecewise exponential function.
|
|||
/// </summary>
|
|||
public class ExponentialEaseInOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
|
|||
if (p < 0.5d) |
|||
{ |
|||
return 0.5d * Math.Pow(2d, 20d * p - 10d); |
|||
} |
|||
else |
|||
{ |
|||
return -0.5d * Math.Pow(2d, -20d * p + 10d) + 1d; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases out a <see cref="double"/> value
|
|||
/// using a exponential function.
|
|||
/// </summary>
|
|||
public class ExponentialEaseOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
return (p == 1.0d) ? p : 1d - Math.Pow(2d, -10d * p); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Linearly eases a <see cref="double"/> value.
|
|||
/// </summary>
|
|||
public class LinearEasing : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
return progress; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases in a <see cref="double"/> value
|
|||
/// using a quadratic function.
|
|||
/// </summary>
|
|||
public class QuadraticEaseIn : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
return progress * progress; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases a <see cref="double"/> value
|
|||
/// using a piece-wise quadratic function.
|
|||
/// </summary>
|
|||
public class QuadraticEaseInOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
|
|||
if (progress < 0.5d) |
|||
{ |
|||
return 2d * p * p; |
|||
} |
|||
else |
|||
{ |
|||
return p * (-2d * p + 4d) - 1d; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases out a <see cref="double"/> value
|
|||
/// using a quadratic function.
|
|||
/// </summary>
|
|||
public class QuadraticEaseOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
return -(progress * (progress - 2d)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases in a <see cref="double"/> value
|
|||
/// using a quartic equation.
|
|||
/// </summary>
|
|||
public class QuarticEaseIn : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p2 = progress * progress; |
|||
return p2 * p2; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases a <see cref="double"/> value
|
|||
/// using a piece-wise quartic equation.
|
|||
/// </summary>
|
|||
public class QuarticEaseInOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
|
|||
if (p < 0.5d) |
|||
{ |
|||
double p2 = p * p; |
|||
return 8d * p2 * p2; |
|||
} |
|||
else |
|||
{ |
|||
double f = p - 1d; |
|||
double f2 = f * f; |
|||
return -8d * f2 * f2 + 1d; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases out a <see cref="double"/> value
|
|||
/// using a quartic equation.
|
|||
/// </summary>
|
|||
public class QuarticEaseOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double f = progress - 1d; |
|||
double f2 = f * f; |
|||
return -f2 * f2 + 1d; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases in a <see cref="double"/> value
|
|||
/// using a quartic equation.
|
|||
/// </summary>
|
|||
public class QuinticEaseIn : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p2 = progress * progress; |
|||
return p2 * p2 * progress; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases a <see cref="double"/> value
|
|||
/// using a piece-wise quartic equation.
|
|||
/// </summary>
|
|||
public class QuinticEaseInOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double p = progress; |
|||
if (p < 0.5d) |
|||
{ |
|||
double p2 = p * p; |
|||
return 16d * p2 * p2 * p; |
|||
} |
|||
else |
|||
{ |
|||
double f = 2d * p - 2d; |
|||
double f2 = f * f; |
|||
return 0.5d * f2 * f2 * f + 1d; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
namespace Avalonia.Animation.Easings |
|||
{ |
|||
/// <summary>
|
|||
/// Eases out a <see cref="double"/> value
|
|||
/// using a quartic equation.
|
|||
/// </summary>
|
|||
public class QuinticEaseOut : Easing |
|||
{ |
|||
/// <inheritdoc/>
|
|||
public override double Ease(double progress) |
|||
{ |
|||
double f = (progress - 1d); |
|||
double f2 = f * f; |
|||
return f2 * f2 * f + 1d; |
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue