Browse Source
# Conflicts: # samples/interop/NativeEmbedSample/NativeEmbedSample.csprojpull/8110/head
374 changed files with 5433 additions and 1988 deletions
@ -0,0 +1,2 @@ |
|||
T:Avalonia.Metadata.NotClientImplementableAttribute |
|||
T:Avalonia.Metadata.UnstableAttribute |
|||
@ -0,0 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<AvaloniaPublicKey>0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87</AvaloniaPublicKey> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -1,7 +1,7 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="HarfBuzzSharp" Version="2.8.2-preview.254" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.8.2-preview.254" /> |
|||
<PackageReference Condition="'$(IncludeWasmSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.WebAssembly" Version="2.8.2-preview.254"/> |
|||
<PackageReference Include="HarfBuzzSharp" Version="2.8.2" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.8.2" /> |
|||
<PackageReference Condition="'$(IncludeWasmSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.WebAssembly" Version="2.8.2" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -1,5 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="JetBrains.DotMemoryUnit" Version="3.1.20200127.214830" /> |
|||
<PackageReference Include="JetBrains.DotMemoryUnit" Version="3.2.20220510" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -1,7 +1,6 @@ |
|||
<Project> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
|
|||
@ -1,7 +1,7 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="SkiaSharp" Version="2.88.0-preview.254" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="SkiaSharp.NativeAssets.Linux" Version="2.88.0-preview.254" /> |
|||
<PackageReference Condition="'$(IncludeWasmSkia)' == 'true'" Include="SkiaSharp.NativeAssets.WebAssembly" Version="2.88.0-preview.254"/> |
|||
<PackageReference Include="SkiaSharp" Version="2.88.0" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="SkiaSharp.NativeAssets.Linux" Version="2.88.0" /> |
|||
<PackageReference Condition="'$(IncludeWasmSkia)' == 'true'" Include="SkiaSharp.NativeAssets.WebAssembly" Version="2.88.0" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -0,0 +1,11 @@ |
|||
// |
|||
// Created by Dan Walmsley on 06/05/2022. |
|||
// Copyright (c) 2022 Avalonia. All rights reserved. |
|||
// |
|||
|
|||
#pragma once |
|||
|
|||
#define IS_NSPANEL |
|||
|
|||
#include "AvnWindow.mm" |
|||
|
|||
@ -0,0 +1,9 @@ |
|||
//
|
|||
// Created by Dan Walmsley on 06/05/2022.
|
|||
// Copyright (c) 2022 Avalonia. All rights reserved.
|
|||
//
|
|||
|
|||
#ifndef AVALONIA_NATIVE_OSX_POPUPIMPL_H |
|||
#define AVALONIA_NATIVE_OSX_POPUPIMPL_H |
|||
|
|||
#endif //AVALONIA_NATIVE_OSX_POPUPIMPL_H
|
|||
@ -0,0 +1,61 @@ |
|||
// |
|||
// Created by Dan Walmsley on 06/05/2022. |
|||
// Copyright (c) 2022 Avalonia. All rights reserved. |
|||
// |
|||
|
|||
#include "WindowInterfaces.h" |
|||
#include "AvnView.h" |
|||
#include "WindowImpl.h" |
|||
#include "automation.h" |
|||
#include "menu.h" |
|||
#include "common.h" |
|||
#import "WindowBaseImpl.h" |
|||
#import "WindowProtocol.h" |
|||
#import <AppKit/AppKit.h> |
|||
#include "PopupImpl.h" |
|||
|
|||
class PopupImpl : public virtual WindowBaseImpl, public IAvnPopup |
|||
{ |
|||
private: |
|||
BEGIN_INTERFACE_MAP() |
|||
INHERIT_INTERFACE_MAP(WindowBaseImpl) |
|||
INTERFACE_MAP_ENTRY(IAvnPopup, IID_IAvnPopup) |
|||
END_INTERFACE_MAP() |
|||
virtual ~PopupImpl(){} |
|||
ComPtr<IAvnWindowEvents> WindowEvents; |
|||
PopupImpl(IAvnWindowEvents* events, IAvnGlContext* gl) : WindowBaseImpl(events, gl) |
|||
{ |
|||
WindowEvents = events; |
|||
} |
|||
protected: |
|||
virtual NSWindowStyleMask GetStyle() override |
|||
{ |
|||
return NSWindowStyleMaskBorderless; |
|||
} |
|||
|
|||
virtual void OnInitialiseNSWindow () override |
|||
{ |
|||
[Window setLevel:NSPopUpMenuWindowLevel]; |
|||
} |
|||
|
|||
public: |
|||
virtual bool ShouldTakeFocusOnShow() override |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
virtual HRESULT Show(bool activate, bool isDialog) override |
|||
{ |
|||
return WindowBaseImpl::Show(activate, true); |
|||
} |
|||
}; |
|||
|
|||
|
|||
extern IAvnPopup* CreateAvnPopup(IAvnWindowEvents*events, IAvnGlContext* gl) |
|||
{ |
|||
@autoreleasepool |
|||
{ |
|||
IAvnPopup* ptr = dynamic_cast<IAvnPopup*>(new PopupImpl(events, gl)); |
|||
return ptr; |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
//
|
|||
// Created by Dan Walmsley on 06/05/2022.
|
|||
// Copyright (c) 2022 Avalonia. All rights reserved.
|
|||
//
|
|||
|
|||
#import <Foundation/Foundation.h> |
|||
#import <AppKit/AppKit.h> |
|||
#include "WindowProtocol.h" |
|||
#include "WindowBaseImpl.h" |
|||
|
|||
@interface AvnWindow : NSWindow <AvnWindowProtocol, NSWindowDelegate> |
|||
-(AvnWindow* _Nonnull) initWithParent: (WindowBaseImpl* _Nonnull) parent contentRect: (NSRect)contentRect styleMask: (NSWindowStyleMask)styleMask; |
|||
@end |
|||
|
|||
@interface AvnPanel : NSPanel <AvnWindowProtocol, NSWindowDelegate> |
|||
-(AvnPanel* _Nonnull) initWithParent: (WindowBaseImpl* _Nonnull) parent contentRect: (NSRect)contentRect styleMask: (NSWindowStyleMask)styleMask; |
|||
@end |
|||
@ -0,0 +1,210 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="700" |
|||
x:Class="RenderDemo.Pages.Transform3DPage"> |
|||
<UserControl.Styles> |
|||
<Styles> |
|||
<Styles.Resources> |
|||
<Template x:Key="TestContent"> |
|||
<Grid RowDefinitions="*,*" ColumnDefinitions="*,*" Margin="5"> |
|||
<TextBlock>I'm a text</TextBlock> |
|||
<Button Grid.Row="0" Grid.Column="1" Content="A Button"></Button> |
|||
<Slider Grid.Row="1" |
|||
Grid.Column="0" |
|||
Grid.ColumnSpan="2" |
|||
Value="{Binding Depth}" |
|||
Minimum="100" |
|||
Maximum="300" /> |
|||
</Grid> |
|||
</Template> |
|||
</Styles.Resources> |
|||
</Styles> |
|||
<Style Selector="Border.Test"> |
|||
<Setter Property="Width" Value="200" /> |
|||
<Setter Property="Height" Value="200" /> |
|||
<Setter Property="Child" Value="{StaticResource TestContent}" /> |
|||
<Setter Property="BorderThickness" Value="2" /> |
|||
<Setter Property="BorderBrush" Value="Black" /> |
|||
<Setter Property="Grid.ColumnSpan" Value="2" /> |
|||
</Style> |
|||
<Style Selector="TextBlock, Label, Slider"> |
|||
<Setter Property="VerticalAlignment" Value="Center" /> |
|||
<Setter Property="Margin" Value="10,0,10,0" /> |
|||
</Style> |
|||
<Style Selector="Border TextBlock"> |
|||
<Setter Property="Foreground" Value="White" /> |
|||
</Style> |
|||
<Style Selector="Border Button"> |
|||
<Setter Property="Background" Value="White"></Setter> |
|||
<Setter Property="Foreground" Value="Black" /> |
|||
</Style> |
|||
|
|||
<Style Selector="Border#B1"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:10" |
|||
IterationCount="Infinite"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="0" /> |
|||
<Setter Property="ZIndex" Value="4" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="25%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="90" /> |
|||
<Setter Property="ZIndex" Value="1" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="360" /> |
|||
<Setter Property="ZIndex" Value="4" /> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
<Style Selector="Border#B2"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:10" |
|||
IterationCount="Infinite"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="90" /> |
|||
<Setter Property="ZIndex" Value="1" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="25%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="180" /> |
|||
<Setter Property="ZIndex" Value="1" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="75%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="360" /> |
|||
<Setter Property="ZIndex" Value="4" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="450" /> |
|||
<Setter Property="ZIndex" Value="1" /> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
<Style Selector="Border#B3"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:10" |
|||
IterationCount="Infinite"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="180" /> |
|||
<Setter Property="ZIndex" Value="1" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="50%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="360" /> |
|||
<Setter Property="ZIndex" Value="4" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="75%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="450" /> |
|||
<Setter Property="ZIndex" Value="1" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="540" /> |
|||
<Setter Property="ZIndex" Value="1" /> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
<Style Selector="Border#B4"> |
|||
<Style.Animations> |
|||
<Animation Duration="0:0:10" |
|||
IterationCount="Infinite"> |
|||
<KeyFrame Cue="0%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="270" /> |
|||
<Setter Property="ZIndex" Value="1" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="25%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="360" /> |
|||
<Setter Property="ZIndex" Value="4" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="50%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="450" /> |
|||
<Setter Property="ZIndex" Value="1" /> |
|||
</KeyFrame> |
|||
<KeyFrame Cue="100%"> |
|||
<Setter Property="Rotate3DTransform.AngleX" Value="630" /> |
|||
<Setter Property="ZIndex" Value="1" /> |
|||
</KeyFrame> |
|||
</Animation> |
|||
</Style.Animations> |
|||
</Style> |
|||
</UserControl.Styles> |
|||
|
|||
<Grid ColumnDefinitions="Auto,*,Auto,*" RowDefinitions="*, Auto, Auto, Auto, Auto, Auto, Auto, Auto"> |
|||
<Grid.Clock> |
|||
<Clock /> |
|||
</Grid.Clock> |
|||
<Border Name="B1" Background="DarkRed" Classes="Test"> |
|||
<Border.RenderTransform> |
|||
<Rotate3DTransform CenterZ="-100" |
|||
Depth="{Binding Depth}" /> |
|||
</Border.RenderTransform> |
|||
</Border> |
|||
<Border Name="B2" Grid.Row="0" Grid.Column="0" Classes="Test" Background="DarkGreen"> |
|||
<Border.RenderTransform> |
|||
<Rotate3DTransform CenterZ="-100" |
|||
Depth="{Binding Depth}" /> |
|||
</Border.RenderTransform> |
|||
</Border> |
|||
<Border Name="B3" Grid.Row="0" Grid.Column="0" Classes="Test" Background="DarkBlue"> |
|||
<Border.RenderTransform> |
|||
<Rotate3DTransform CenterZ="-100" |
|||
Depth="{Binding Depth}" /> |
|||
</Border.RenderTransform> |
|||
</Border> |
|||
<Border Name="B4" Grid.Row="0" Grid.Column="0" Classes="Test" Background="Orange"> |
|||
<Border.RenderTransform> |
|||
<Rotate3DTransform CenterZ="-100" |
|||
Depth="{Binding Depth}" /> |
|||
</Border.RenderTransform> |
|||
</Border> |
|||
|
|||
<Label Grid.Column="0" Grid.Row="1">Depth: </Label> |
|||
<Slider Grid.Column="1" Grid.Row="1" Value="{Binding Depth}" Minimum="100" Maximum="300" /> |
|||
|
|||
<Border Grid.Row="0" Grid.Column="2" Classes="Test" ZIndex="-2"> |
|||
<Border.Background> |
|||
<LinearGradientBrush StartPoint="0%,0%" EndPoint="0%,100%"> |
|||
<GradientStop Offset="0" Color="Red" /> |
|||
<GradientStop Offset="1" Color="Blue" /> |
|||
</LinearGradientBrush> |
|||
</Border.Background> |
|||
<Border.Styles> |
|||
<Style Selector="Label"> |
|||
<Setter Property="VerticalAlignment" Value="Center" /> |
|||
</Style> |
|||
<Style Selector="Slider"> |
|||
<Setter Property="Width" Value="100" /> |
|||
</Style> |
|||
</Border.Styles> |
|||
<Border.RenderTransform> |
|||
<Rotate3DTransform Depth="{Binding Depth}" |
|||
CenterX="{Binding CenterX}" |
|||
CenterY="{Binding CenterY}" |
|||
CenterZ="{Binding CenterZ}" |
|||
AngleX="{Binding AngleX}" |
|||
AngleY="{Binding AngleY}" |
|||
AngleZ="{Binding AngleZ}" /> |
|||
</Border.RenderTransform> |
|||
</Border> |
|||
|
|||
<Label Grid.Row="1" Grid.Column="2">Center X: </Label> |
|||
<Slider Grid.Row="1" Grid.Column="3" Value="{Binding CenterX}" Minimum="-100" Maximum="100" /> |
|||
|
|||
<Label Grid.Row="2" Grid.Column="2">Center Y: </Label> |
|||
<Slider Grid.Row="2" Grid.Column="3" Value="{Binding CenterY}" Minimum="-100" Maximum="100" /> |
|||
|
|||
<Label Grid.Row="3" Grid.Column="2">Center Z: </Label> |
|||
<Slider Grid.Row="3" Grid.Column="3" Value="{Binding CenterZ}" Minimum="-100" Maximum="100" /> |
|||
|
|||
<Label Grid.Row="4" Grid.Column="2">Angle X: </Label> |
|||
<Slider Grid.Row="4" Grid.Column="3" Value="{Binding AngleX}" Minimum="-180" Maximum="180" /> |
|||
|
|||
<Label Grid.Row="5" Grid.Column="2">Angle Y: </Label> |
|||
<Slider Grid.Row="5" Grid.Column="3" Value="{Binding AngleY}" Minimum="-180" Maximum="180" /> |
|||
|
|||
<Label Grid.Row="6" Grid.Column="2">Angle Z: </Label> |
|||
<Slider Grid.Row="6" Grid.Column="3" Value="{Binding AngleZ}" Minimum="-180" Maximum="180" /> |
|||
</Grid> |
|||
</UserControl> |
|||
@ -0,0 +1,21 @@ |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Markup.Xaml; |
|||
using RenderDemo.ViewModels; |
|||
|
|||
namespace RenderDemo.Pages; |
|||
|
|||
public class Transform3DPage : UserControl |
|||
{ |
|||
public Transform3DPage() |
|||
{ |
|||
InitializeComponent(); |
|||
this.DataContext = new Transform3DPageViewModel(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,55 @@ |
|||
using System; |
|||
using MiniMvvm; |
|||
using Avalonia.Animation; |
|||
|
|||
namespace RenderDemo.ViewModels |
|||
{ |
|||
public class Transform3DPageViewModel : ViewModelBase |
|||
{ |
|||
private double _depth = 200; |
|||
|
|||
private double _centerX = 0; |
|||
private double _centerY = 0; |
|||
private double _centerZ = 0; |
|||
private double _angleX = 0; |
|||
private double _angleY = 0; |
|||
private double _angleZ = 0; |
|||
|
|||
public double Depth |
|||
{ |
|||
get => _depth; |
|||
set => RaiseAndSetIfChanged(ref _depth, value); |
|||
} |
|||
|
|||
public double CenterX |
|||
{ |
|||
get => _centerX; |
|||
set => RaiseAndSetIfChanged(ref _centerX, value); |
|||
} |
|||
public double CenterY |
|||
{ |
|||
get => _centerY; |
|||
set => RaiseAndSetIfChanged(ref _centerY, value); |
|||
} |
|||
public double CenterZ |
|||
{ |
|||
get => _centerZ; |
|||
set => RaiseAndSetIfChanged(ref _centerZ, value); |
|||
} |
|||
public double AngleX |
|||
{ |
|||
get => _angleX; |
|||
set => RaiseAndSetIfChanged(ref _angleX, value); |
|||
} |
|||
public double AngleY |
|||
{ |
|||
get => _angleY; |
|||
set => RaiseAndSetIfChanged(ref _angleY, value); |
|||
} |
|||
public double AngleZ |
|||
{ |
|||
get => _angleZ; |
|||
set => RaiseAndSetIfChanged(ref _angleZ, value); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,121 @@ |
|||
using System; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Avalonia.Media; |
|||
using Avalonia.Styling; |
|||
|
|||
namespace Avalonia.Animation; |
|||
|
|||
public class Rotate3DTransition: PageSlide |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of the <see cref="Rotate3DTransition"/>
|
|||
/// </summary>
|
|||
/// <param name="duration">How long the rotation should take place</param>
|
|||
/// <param name="orientation">The orientation of the rotation</param>
|
|||
/// <param name="depth">Defines the depth of the 3D Effect. If null, depth will be calculated automatically from the width or height of the common parent of the visual being rotated</param>
|
|||
public Rotate3DTransition(TimeSpan duration, SlideAxis orientation = SlideAxis.Horizontal, double? depth = null) |
|||
: base(duration, orientation) |
|||
{ |
|||
Depth = depth; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Defines the depth of the 3D Effect. If null, depth will be calculated automatically from the width or height
|
|||
/// of the common parent of the visual being rotated.
|
|||
/// </summary>
|
|||
public double? Depth { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of the <see cref="Rotate3DTransition"/>
|
|||
/// </summary>
|
|||
public Rotate3DTransition() { } |
|||
|
|||
/// <inheritdoc />
|
|||
public override async Task Start(Visual? @from, Visual? to, bool forward, CancellationToken cancellationToken) |
|||
{ |
|||
if (cancellationToken.IsCancellationRequested) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
var tasks = new Task[from != null && to != null ? 2 : 1]; |
|||
var parent = GetVisualParent(from, to); |
|||
var (rotateProperty, center) = Orientation switch |
|||
{ |
|||
SlideAxis.Vertical => (Rotate3DTransform.AngleXProperty, parent.Bounds.Height), |
|||
SlideAxis.Horizontal => (Rotate3DTransform.AngleYProperty, parent.Bounds.Width), |
|||
_ => throw new ArgumentOutOfRangeException() |
|||
}; |
|||
|
|||
var depthSetter = new Setter {Property = Rotate3DTransform.DepthProperty, Value = Depth ?? center}; |
|||
var centerZSetter = new Setter {Property = Rotate3DTransform.CenterZProperty, Value = -center / 2}; |
|||
|
|||
KeyFrame CreateKeyFrame(double cue, double rotation, int zIndex, bool isVisible = true) => |
|||
new() { |
|||
Setters = |
|||
{ |
|||
new Setter { Property = rotateProperty, Value = rotation }, |
|||
new Setter { Property = Visual.ZIndexProperty, Value = zIndex }, |
|||
new Setter { Property = Visual.IsVisibleProperty, Value = isVisible }, |
|||
centerZSetter, |
|||
depthSetter |
|||
}, |
|||
Cue = new Cue(cue) |
|||
}; |
|||
|
|||
if (from != null) |
|||
{ |
|||
var animation = new Animation |
|||
{ |
|||
Easing = SlideOutEasing, |
|||
Duration = Duration, |
|||
FillMode = FillMode.Forward, |
|||
Children = |
|||
{ |
|||
CreateKeyFrame(0d, 0d, 2), |
|||
CreateKeyFrame(0.5d, 45d * (forward ? -1 : 1), 1), |
|||
CreateKeyFrame(1d, 90d * (forward ? -1 : 1), 1, isVisible: false) |
|||
} |
|||
}; |
|||
|
|||
tasks[0] = animation.RunAsync(from, null, cancellationToken); |
|||
} |
|||
|
|||
if (to != null) |
|||
{ |
|||
to.IsVisible = true; |
|||
var animation = new Animation |
|||
{ |
|||
Easing = SlideInEasing, |
|||
Duration = Duration, |
|||
FillMode = FillMode.Forward, |
|||
Children = |
|||
{ |
|||
CreateKeyFrame(0d, 90d * (forward ? 1 : -1), 1), |
|||
CreateKeyFrame(0.5d, 45d * (forward ? 1 : -1), 1), |
|||
CreateKeyFrame(1d, 0d, 2) |
|||
} |
|||
}; |
|||
|
|||
tasks[from != null ? 1 : 0] = animation.RunAsync(to, null, cancellationToken); |
|||
} |
|||
|
|||
await Task.WhenAll(tasks); |
|||
|
|||
if (!cancellationToken.IsCancellationRequested) |
|||
{ |
|||
if (to != null) |
|||
{ |
|||
to.ZIndex = 2; |
|||
} |
|||
|
|||
if (from != null) |
|||
{ |
|||
from.IsVisible = false; |
|||
from.ZIndex = 1; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue