├── Sample
├── Assets
│ ├── StoreLogo.png
│ ├── SplashScreen.scale-200.png
│ ├── LockScreenLogo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Wide310x150Logo.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ └── Square44x44Logo.targetsize-24_altform-unplated.png
├── App.xaml
├── Page1.xaml
├── Page2.xaml
├── Page1.xaml.cs
├── Page2.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── MainPage.xaml
├── MainPage.xaml.cs
├── Package.appxmanifest
├── App.xaml.cs
└── Sample.csproj
├── README.md
├── Flow Frame
├── FlowFrame.targets
├── Properties
│ └── AssemblyInfo.cs
├── Flow Frame.nuspec
├── FlowFrame.cs
├── Flow Frame.csproj
└── Services
│ └── AnimationService.cs
├── LICENSE.md
├── .gitattributes
├── Flow Frame.sln
└── .gitignore
/Sample/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/colinkiama/UWP-Flow-Frame/HEAD/Sample/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Sample/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/colinkiama/UWP-Flow-Frame/HEAD/Sample/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Sample/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/colinkiama/UWP-Flow-Frame/HEAD/Sample/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Sample/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/colinkiama/UWP-Flow-Frame/HEAD/Sample/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Sample/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/colinkiama/UWP-Flow-Frame/HEAD/Sample/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Sample/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/colinkiama/UWP-Flow-Frame/HEAD/Sample/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Sample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/colinkiama/UWP-Flow-Frame/HEAD/Sample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Sample/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UWP-Flow-Frame
2 | Flow Frame is a new and improved Frame control. This builds upon the default frame control by providing high-performance page transition animations powered by the composition layer. Fresh, new animations will be used by default, with options to configure the animations or even create your own custom animations (from scratch).
3 |
4 | Readme will be updated with more info later.
5 |
6 | # Special Thanks
7 | Thank you lupeski (reddplanetdev) for me how to animate pages from frames.
8 |
--------------------------------------------------------------------------------
/Sample/Page1.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Sample/Page2.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Flow Frame/FlowFrame.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | x86
5 | $(Platform)
6 |
7 |
8 |
9 | Flow_Frame.dll
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Sample/Page1.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Controls.Primitives;
11 | using Windows.UI.Xaml.Data;
12 | using Windows.UI.Xaml.Input;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Navigation;
15 |
16 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
17 |
18 | namespace Sample
19 | {
20 | ///
21 | /// An empty page that can be used on its own or navigated to within a Frame.
22 | ///
23 | public sealed partial class Page1 : Page
24 | {
25 | public Page1()
26 | {
27 | this.InitializeComponent();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Sample/Page2.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Controls.Primitives;
11 | using Windows.UI.Xaml.Data;
12 | using Windows.UI.Xaml.Input;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Navigation;
15 |
16 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
17 |
18 | namespace Sample
19 | {
20 | ///
21 | /// An empty page that can be used on its own or navigated to within a Frame.
22 | ///
23 | public sealed partial class Page2 : Page
24 | {
25 | public Page2()
26 | {
27 | this.InitializeComponent();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Colin Kiama
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Sample/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Sample")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Sample")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Flow Frame/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Flow Frame")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Flow Frame")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Sample/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
23 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Sample/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Sample/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Controls.Primitives;
11 | using Windows.UI.Xaml.Data;
12 | using Windows.UI.Xaml.Input;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Navigation;
15 |
16 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
17 |
18 | namespace Sample
19 | {
20 | ///
21 | /// An empty page that can be used on its own or navigated to within a Frame.
22 | ///
23 | public sealed partial class MainPage : Page
24 | {
25 | public MainPage()
26 | {
27 | this.InitializeComponent();
28 | }
29 |
30 | private async void nextButton_Click(object sender, RoutedEventArgs e)
31 | {
32 | await mainFrame.Navigate(typeof(Page2));
33 | }
34 |
35 | private async void prevButton_Click(object sender, RoutedEventArgs e)
36 | {
37 | if (mainFrame.CanGoBack)
38 | {
39 | await mainFrame.GoBack();
40 | }
41 | }
42 |
43 | protected async override void OnNavigatedTo(NavigationEventArgs e)
44 | {
45 | base.OnNavigatedTo(e);
46 | await mainFrame.Navigate(typeof(Page1));
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Flow Frame/Flow Frame.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | FlowFrame.colinkiama
5 | 0.0.0.1
6 | Flow Frame
7 | Colin Kiama
8 | Colin Kiama
9 | https://raw.githubusercontent.com/colinkiama/UWP-Flow-Frame/master/LICENSE.md
10 | https://github.com/colinkiama/UWP-Flow-Frame
11 | false
12 | Flow Frame is a new and improved Frame control. This builds upon the default frame control by providing high-performance page transition animations powered by the composition layer. Fresh, new animations will be used by default
13 | Beta Release
14 | Copyright 2018
15 | flow frame flowframe colinkiama uwp frame composition ui
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Sample/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 | Sample
18 | colinkiama
19 | Assets\StoreLogo.png
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/Flow Frame/FlowFrame.cs:
--------------------------------------------------------------------------------
1 | using Flow_Frame.Services;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Windows.Foundation;
8 | using Windows.UI.Composition;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media.Animation;
11 |
12 | namespace Flow_Frame
13 | {
14 | public sealed class FlowFrame : Frame
15 | {
16 | public new IAsyncOperation Navigate(Type sourcePageType)
17 | {
18 | return Task.Run(async () =>
19 | {
20 | bool navigated = false;
21 | await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, async () =>
22 | {
23 |
24 | await AnimationService.FastSlideOut(this);
25 | navigated = base.Navigate(sourcePageType, null, new SuppressNavigationTransitionInfo());
26 | await AnimationService.FastSlideIn(this);
27 |
28 | });
29 | return navigated;
30 | }).AsAsyncOperation();
31 | }
32 |
33 | public new IAsyncOperation Navigate(Type sourcePageType, object parameter)
34 | {
35 | return Task.Run(async () =>
36 | {
37 | bool navigated = false;
38 | await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, async () =>
39 | {
40 | await AnimationService.FastSlideOut(this);
41 | navigated = base.Navigate(sourcePageType, parameter, new SuppressNavigationTransitionInfo());
42 | await AnimationService.FastSlideIn(this);
43 | });
44 | return navigated;
45 | }).AsAsyncOperation();
46 | }
47 |
48 | public new IAsyncAction GoBack()
49 | {
50 | return Task.Run(async () =>
51 | {
52 | await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, async () =>
53 | {
54 | await AnimationService.FastSlideOutReverse(this);
55 | base.GoBack(new SuppressNavigationTransitionInfo());
56 | await AnimationService.FastSlideInReverse(this);
57 | });
58 | }).AsAsyncAction();
59 |
60 | }
61 |
62 | private bool CheckIfFirstForwardStackItemHasPageType(Type pageType)
63 | {
64 | bool frameHistoryHasPageType = false;
65 | var pageList = ForwardStack;
66 | if (pageList.Count > 1)
67 | {
68 | frameHistoryHasPageType = (pageList.First().SourcePageType == pageType);
69 | }
70 |
71 | return frameHistoryHasPageType;
72 | }
73 |
74 |
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/Flow Frame.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28010.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flow Frame", "Flow Frame\Flow Frame.csproj", "{5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "Sample\Sample.csproj", "{5946BDBE-8808-4441-856A-A5D0504043BE}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Debug|ARM = Debug|ARM
14 | Debug|x64 = Debug|x64
15 | Debug|x86 = Debug|x86
16 | Release|Any CPU = Release|Any CPU
17 | Release|ARM = Release|ARM
18 | Release|x64 = Release|x64
19 | Release|x86 = Release|x86
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Debug|ARM.ActiveCfg = Debug|ARM
25 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Debug|ARM.Build.0 = Debug|ARM
26 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Debug|x64.ActiveCfg = Debug|x64
27 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Debug|x64.Build.0 = Debug|x64
28 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Debug|x86.ActiveCfg = Debug|x86
29 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Debug|x86.Build.0 = Debug|x86
30 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Release|Any CPU.Build.0 = Release|Any CPU
32 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Release|ARM.ActiveCfg = Release|ARM
33 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Release|ARM.Build.0 = Release|ARM
34 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Release|x64.ActiveCfg = Release|x64
35 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Release|x64.Build.0 = Release|x64
36 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Release|x86.ActiveCfg = Release|x86
37 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}.Release|x86.Build.0 = Release|x86
38 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Debug|Any CPU.ActiveCfg = Debug|x86
39 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Debug|ARM.ActiveCfg = Debug|ARM
40 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Debug|ARM.Build.0 = Debug|ARM
41 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Debug|ARM.Deploy.0 = Debug|ARM
42 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Debug|x64.ActiveCfg = Debug|x64
43 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Debug|x64.Build.0 = Debug|x64
44 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Debug|x64.Deploy.0 = Debug|x64
45 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Debug|x86.ActiveCfg = Debug|x86
46 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Debug|x86.Build.0 = Debug|x86
47 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Debug|x86.Deploy.0 = Debug|x86
48 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Release|Any CPU.ActiveCfg = Release|x86
49 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Release|ARM.ActiveCfg = Release|ARM
50 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Release|ARM.Build.0 = Release|ARM
51 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Release|ARM.Deploy.0 = Release|ARM
52 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Release|x64.ActiveCfg = Release|x64
53 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Release|x64.Build.0 = Release|x64
54 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Release|x64.Deploy.0 = Release|x64
55 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Release|x86.ActiveCfg = Release|x86
56 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Release|x86.Build.0 = Release|x86
57 | {5946BDBE-8808-4441-856A-A5D0504043BE}.Release|x86.Deploy.0 = Release|x86
58 | EndGlobalSection
59 | GlobalSection(SolutionProperties) = preSolution
60 | HideSolutionNode = FALSE
61 | EndGlobalSection
62 | GlobalSection(ExtensibilityGlobals) = postSolution
63 | SolutionGuid = {6D6B114B-AEC5-4A48-8FD3-461F00A8248D}
64 | EndGlobalSection
65 | EndGlobal
66 |
--------------------------------------------------------------------------------
/Sample/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.ApplicationModel;
7 | using Windows.ApplicationModel.Activation;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Data;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Navigation;
17 |
18 | namespace Sample
19 | {
20 | ///
21 | /// Provides application-specific behavior to supplement the default Application class.
22 | ///
23 | sealed partial class App : Application
24 | {
25 | ///
26 | /// Initializes the singleton application object. This is the first line of authored code
27 | /// executed, and as such is the logical equivalent of main() or WinMain().
28 | ///
29 | public App()
30 | {
31 | this.InitializeComponent();
32 | this.Suspending += OnSuspending;
33 | }
34 |
35 | ///
36 | /// Invoked when the application is launched normally by the end user. Other entry points
37 | /// will be used such as when the application is launched to open a specific file.
38 | ///
39 | /// Details about the launch request and process.
40 | protected override void OnLaunched(LaunchActivatedEventArgs e)
41 | {
42 | Frame rootFrame = Window.Current.Content as Frame;
43 |
44 | // Do not repeat app initialization when the Window already has content,
45 | // just ensure that the window is active
46 | if (rootFrame == null)
47 | {
48 | // Create a Frame to act as the navigation context and navigate to the first page
49 | rootFrame = new Frame();
50 |
51 | rootFrame.NavigationFailed += OnNavigationFailed;
52 |
53 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
54 | {
55 | //TODO: Load state from previously suspended application
56 | }
57 |
58 | // Place the frame in the current Window
59 | Window.Current.Content = rootFrame;
60 | }
61 |
62 | if (e.PrelaunchActivated == false)
63 | {
64 | if (rootFrame.Content == null)
65 | {
66 | // When the navigation stack isn't restored navigate to the first page,
67 | // configuring the new page by passing required information as a navigation
68 | // parameter
69 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
70 | }
71 | // Ensure the current window is active
72 | Window.Current.Activate();
73 | }
74 | }
75 |
76 | ///
77 | /// Invoked when Navigation to a certain page fails
78 | ///
79 | /// The Frame which failed navigation
80 | /// Details about the navigation failure
81 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
82 | {
83 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
84 | }
85 |
86 | ///
87 | /// Invoked when application execution is being suspended. Application state is saved
88 | /// without knowing whether the application will be terminated or resumed with the contents
89 | /// of memory still intact.
90 | ///
91 | /// The source of the suspend request.
92 | /// Details about the suspend request.
93 | private void OnSuspending(object sender, SuspendingEventArgs e)
94 | {
95 | var deferral = e.SuspendingOperation.GetDeferral();
96 | //TODO: Save application state and stop any background activity
97 | deferral.Complete();
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/Flow Frame/Flow Frame.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {5CF3D485-2F90-47A3-B5E7-124BCEB4BB2E}
8 | winmdobj
9 | Properties
10 | Flow_Frame
11 | Flow Frame
12 | en-US
13 | UAP
14 | 10.0.17134.0
15 | 10.0.14393.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | false
20 |
21 |
22 | AnyCPU
23 | true
24 | full
25 | false
26 | bin\Debug\
27 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
28 | prompt
29 | 4
30 | true
31 | bin\Debug\Flow Frame.XML
32 |
33 |
34 | AnyCPU
35 | pdbonly
36 | true
37 | bin\Release\
38 | TRACE;NETFX_CORE;WINDOWS_UWP
39 | prompt
40 | 4
41 | true
42 | bin\Release\Flow Frame.XML
43 |
44 |
45 | x86
46 | true
47 | bin\x86\Debug\
48 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
49 | ;2008
50 | full
51 | x86
52 | false
53 | prompt
54 | true
55 | bin\x86\Debug\Flow Frame.XML
56 |
57 |
58 | x86
59 | bin\x86\Release\
60 | TRACE;NETFX_CORE;WINDOWS_UWP
61 | true
62 | ;2008
63 | pdbonly
64 | x86
65 | false
66 | prompt
67 | true
68 | bin\x86\Release\Flow Frame.XML
69 | MinimumRecommendedRules.ruleset
70 |
71 |
72 | ARM
73 | true
74 | bin\ARM\Debug\
75 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
76 | ;2008
77 | full
78 | ARM
79 | false
80 | prompt
81 | true
82 | bin\ARM\Debug\Flow Frame.XML
83 |
84 |
85 | ARM
86 | bin\ARM\Release\
87 | TRACE;NETFX_CORE;WINDOWS_UWP
88 | true
89 | ;2008
90 | pdbonly
91 | ARM
92 | false
93 | prompt
94 | true
95 | bin\ARM\Release\Flow Frame.XML
96 |
97 |
98 | x64
99 | true
100 | bin\x64\Debug\
101 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
102 | ;2008
103 | full
104 | x64
105 | false
106 | prompt
107 | true
108 | bin\x64\Debug\Flow Frame.XML
109 |
110 |
111 | x64
112 | bin\x64\Release\
113 | TRACE;NETFX_CORE;WINDOWS_UWP
114 | true
115 | ;2008
116 | pdbonly
117 | x64
118 | false
119 | prompt
120 | true
121 | bin\x64\Release\Flow Frame.XML
122 |
123 |
124 | PackageReference
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 | 6.1.7
134 |
135 |
136 |
137 | 14.0
138 |
139 |
140 |
147 |
--------------------------------------------------------------------------------
/Sample/Sample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | {5946BDBE-8808-4441-856A-A5D0504043BE}
8 | AppContainerExe
9 | Properties
10 | Sample
11 | Sample
12 | en-US
13 | UAP
14 | 10.0.17134.0
15 | 10.0.14393.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | true
20 | Sample_TemporaryKey.pfx
21 |
22 |
23 | true
24 | bin\x86\Debug\
25 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
26 | ;2008
27 | full
28 | x86
29 | false
30 | prompt
31 | true
32 |
33 |
34 | bin\x86\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | true
37 | ;2008
38 | pdbonly
39 | x86
40 | false
41 | prompt
42 | true
43 | true
44 |
45 |
46 | true
47 | bin\ARM\Debug\
48 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
49 | ;2008
50 | full
51 | ARM
52 | false
53 | prompt
54 | true
55 |
56 |
57 | bin\ARM\Release\
58 | TRACE;NETFX_CORE;WINDOWS_UWP
59 | true
60 | ;2008
61 | pdbonly
62 | ARM
63 | false
64 | prompt
65 | true
66 | true
67 |
68 |
69 | true
70 | bin\x64\Debug\
71 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
72 | ;2008
73 | full
74 | x64
75 | false
76 | prompt
77 | true
78 |
79 |
80 | bin\x64\Release\
81 | TRACE;NETFX_CORE;WINDOWS_UWP
82 | true
83 | ;2008
84 | pdbonly
85 | x64
86 | false
87 | prompt
88 | true
89 | true
90 |
91 |
92 | PackageReference
93 |
94 |
95 |
96 | App.xaml
97 |
98 |
99 | MainPage.xaml
100 |
101 |
102 | Page1.xaml
103 |
104 |
105 | Page2.xaml
106 |
107 |
108 |
109 |
110 |
111 | Designer
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 | MSBuild:Compile
128 | Designer
129 |
130 |
131 | MSBuild:Compile
132 | Designer
133 |
134 |
135 | Designer
136 | MSBuild:Compile
137 |
138 |
139 | Designer
140 | MSBuild:Compile
141 |
142 |
143 |
144 |
145 | 6.1.7
146 |
147 |
148 |
149 |
150 | {5cf3d485-2f90-47a3-b5e7-124bceb4bb2e}
151 | Flow Frame
152 |
153 |
154 |
155 | 14.0
156 |
157 |
158 |
165 |
--------------------------------------------------------------------------------
/Flow Frame/Services/AnimationService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Numerics;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using Windows.UI;
9 | using Windows.UI.Composition;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Hosting;
13 | using Windows.UI.Xaml.Media;
14 |
15 | namespace Flow_Frame.Services
16 | {
17 | internal class AnimationService
18 | {
19 | private static Compositor _compositor;
20 | const string systemBackgroundColourKey = "SystemControlBackgroundAltHighBrush";
21 |
22 | internal static async Task AnimatePageInReverse(Frame frame)
23 | {
24 | if (frame.Content is FrameworkElement page)
25 | {
26 | if (_compositor == null)
27 | _compositor = ElementCompositionPreview.GetElementVisual(page).Compositor;
28 |
29 | var visual = ElementCompositionPreview.GetElementVisual(page);
30 |
31 | visual.Offset = new Vector3(-140, 0, 0);
32 | visual.Opacity = 0f;
33 | visual.Scale = new Vector3(1, 1, 0);
34 |
35 | KeyFrameAnimation offsetInAnimation = _compositor.CreateScalarKeyFrameAnimation();
36 | offsetInAnimation.InsertExpressionKeyFrame(1f, "0");
37 | offsetInAnimation.Duration = TimeSpan.FromMilliseconds(250);
38 |
39 |
40 | KeyFrameAnimation fadeAnimation = _compositor.CreateScalarKeyFrameAnimation();
41 | fadeAnimation.InsertExpressionKeyFrame(1f, "1");
42 | fadeAnimation.Duration = TimeSpan.FromMilliseconds(250);
43 |
44 |
45 | visual.StartAnimation("Offset.X", offsetInAnimation);
46 | visual.StartAnimation("Opacity", fadeAnimation);
47 |
48 | await Task.Delay(fadeAnimation.Duration);
49 | }
50 | }
51 |
52 | internal async static Task AnimatePageOutReverse(Frame frame)
53 | {
54 | if (frame.Content is FrameworkElement page)
55 | {
56 | if (_compositor == null)
57 | _compositor = ElementCompositionPreview.GetElementVisual(page).Compositor;
58 |
59 | var visual = ElementCompositionPreview.GetElementVisual(page);
60 |
61 |
62 |
63 | string offsetToUse = $"{frame.ActualWidth}";
64 |
65 | KeyFrameAnimation offsetInAnimation = _compositor.CreateScalarKeyFrameAnimation();
66 | offsetInAnimation.InsertExpressionKeyFrame(1f, offsetToUse);
67 | offsetInAnimation.Duration = TimeSpan.FromMilliseconds(250);
68 |
69 | KeyFrameAnimation fadeAnimation = _compositor.CreateScalarKeyFrameAnimation();
70 | fadeAnimation.InsertExpressionKeyFrame(1f, "0");
71 | fadeAnimation.Duration = TimeSpan.FromMilliseconds(250);
72 |
73 | visual.StartAnimation("Offset.X", offsetInAnimation);
74 | visual.StartAnimation("Opacity", fadeAnimation);
75 | await Task.Delay(fadeAnimation.Duration);
76 | }
77 | }
78 |
79 | internal async static Task AnimatePageIn(Frame frame)
80 | {
81 | if (frame.Content is FrameworkElement page)
82 | {
83 | if (_compositor == null)
84 | _compositor = ElementCompositionPreview.GetElementVisual(page).Compositor;
85 |
86 | var visual = ElementCompositionPreview.GetElementVisual(page);
87 |
88 | visual.Offset = new Vector3(140, 0, 0);
89 | visual.Opacity = 0f;
90 | visual.Scale = new Vector3(1, 1, 0);
91 |
92 | KeyFrameAnimation offsetInAnimation = _compositor.CreateScalarKeyFrameAnimation();
93 | offsetInAnimation.InsertExpressionKeyFrame(1f, "0");
94 | offsetInAnimation.Duration = TimeSpan.FromMilliseconds(250);
95 |
96 |
97 | KeyFrameAnimation fadeAnimation = _compositor.CreateScalarKeyFrameAnimation();
98 | fadeAnimation.InsertExpressionKeyFrame(1f, "1");
99 | fadeAnimation.Duration = TimeSpan.FromMilliseconds(250);
100 |
101 |
102 | visual.StartAnimation("Offset.X", offsetInAnimation);
103 | visual.StartAnimation("Opacity", fadeAnimation);
104 | await Task.Delay(fadeAnimation.Duration);
105 | }
106 |
107 |
108 | }
109 |
110 | internal async static Task AnimatePageOut(Frame frame)
111 | {
112 | if (frame.Content is FrameworkElement page)
113 | {
114 | if (_compositor == null)
115 | _compositor = ElementCompositionPreview.GetElementVisual(page).Compositor;
116 |
117 | var visual = ElementCompositionPreview.GetElementVisual(page);
118 |
119 |
120 | KeyFrameAnimation offsetInAnimation = _compositor.CreateScalarKeyFrameAnimation();
121 |
122 |
123 | string offsetToUse = $"-{frame.ActualWidth}";
124 | offsetInAnimation.InsertExpressionKeyFrame(1f, offsetToUse);
125 | offsetInAnimation.Duration = TimeSpan.FromMilliseconds(250);
126 |
127 | KeyFrameAnimation fadeAnimation = _compositor.CreateScalarKeyFrameAnimation();
128 | fadeAnimation.InsertExpressionKeyFrame(1f, "0");
129 | fadeAnimation.Duration = TimeSpan.FromMilliseconds(200);
130 |
131 | visual.StartAnimation("Offset.X", offsetInAnimation);
132 | visual.StartAnimation("Opacity", fadeAnimation);
133 | await Task.Delay(offsetInAnimation.Duration);
134 | }
135 | }
136 |
137 | internal async static Task FastSlideIn(Frame frame)
138 | {
139 | if (frame.Content is Page page)
140 | {
141 | //frame.Background = page.Background;
142 | if (_compositor == null)
143 | _compositor = ElementCompositionPreview.GetElementVisual(page).Compositor;
144 |
145 | var visual = ElementCompositionPreview.GetElementVisual(page);
146 | visual.Offset = new Vector3((float)frame.ActualWidth - 140, 0, 0);
147 |
148 | KeyFrameAnimation offsetInAnimation = _compositor.CreateScalarKeyFrameAnimation();
149 | offsetInAnimation.InsertExpressionKeyFrame(1f, "0");
150 | offsetInAnimation.Duration = TimeSpan.FromMilliseconds(300);
151 |
152 |
153 |
154 |
155 | visual.StartAnimation("Offset.X", offsetInAnimation);
156 | await Task.Delay(offsetInAnimation.Duration);
157 | }
158 | }
159 |
160 | internal async static Task FastSlideOut(Frame frame)
161 | {
162 | if (frame.Content is Page page)
163 | {
164 | if (page.Background != null)
165 | {
166 | frame.Background = page.Background;
167 | }
168 |
169 | else if (page.Content is Panel panel)
170 | {
171 | if (panel.Background != null)
172 | {
173 | frame.Background = panel.Background;
174 | }
175 | else
176 | {
177 | frame.Background = (SolidColorBrush)Application.Current.Resources[systemBackgroundColourKey];
178 | }
179 | }
180 |
181 | if (_compositor == null)
182 | _compositor = ElementCompositionPreview.GetElementVisual(page).Compositor;
183 |
184 | var visual = ElementCompositionPreview.GetElementVisual(page);
185 |
186 |
187 | KeyFrameAnimation offsetInAnimation = _compositor.CreateScalarKeyFrameAnimation();
188 |
189 | string offsetToUse = $"-{140}";
190 | offsetInAnimation.InsertExpressionKeyFrame(1f, offsetToUse);
191 | offsetInAnimation.Duration = TimeSpan.FromMilliseconds(300);
192 |
193 |
194 | visual.StartAnimation("Offset.X", offsetInAnimation);
195 | await Task.Delay(100);
196 | }
197 | }
198 |
199 | internal async static Task FastSlideInReverse(Frame frame)
200 | {
201 | if (frame.Content is Page page)
202 | {
203 | if (_compositor == null)
204 | _compositor = ElementCompositionPreview.GetElementVisual(page).Compositor;
205 |
206 | var visual = ElementCompositionPreview.GetElementVisual(page);
207 | visual.Offset = new Vector3(-((float)frame.ActualWidth - 140), 0, 0);
208 |
209 | KeyFrameAnimation offsetInAnimation = _compositor.CreateScalarKeyFrameAnimation();
210 | offsetInAnimation.InsertExpressionKeyFrame(1f, "0");
211 | offsetInAnimation.Duration = TimeSpan.FromMilliseconds(300);
212 |
213 |
214 |
215 |
216 | visual.StartAnimation("Offset.X", offsetInAnimation);
217 | await Task.Delay(offsetInAnimation.Duration);
218 | }
219 | }
220 |
221 | internal async static Task FastSlideOutReverse(Frame frame)
222 | {
223 | if (frame.Content is Page page)
224 | {
225 | if (page.Background != null)
226 | {
227 | frame.Background = page.Background;
228 | }
229 |
230 | else if (page.Content is Panel panel)
231 | {
232 | if (panel.Background != null)
233 | {
234 | frame.Background = panel.Background;
235 | }
236 | else
237 | {
238 | frame.Background = (SolidColorBrush)Application.Current.Resources[systemBackgroundColourKey];
239 | }
240 | }
241 |
242 | if (_compositor == null)
243 | _compositor = ElementCompositionPreview.GetElementVisual(page).Compositor;
244 |
245 | var visual = ElementCompositionPreview.GetElementVisual(page);
246 |
247 |
248 | KeyFrameAnimation offsetInAnimation = _compositor.CreateScalarKeyFrameAnimation();
249 |
250 | string offsetToUse = $"{140}";
251 | offsetInAnimation.InsertExpressionKeyFrame(1f, offsetToUse);
252 | offsetInAnimation.Duration = TimeSpan.FromMilliseconds(300);
253 |
254 |
255 | visual.StartAnimation("Offset.X", offsetInAnimation);
256 | await Task.Delay(100);
257 | }
258 | }
259 |
260 | internal async static Task ColorTransitionIn(Frame frame)
261 | {
262 | if (frame.Content is Page page)
263 | {
264 | if (_compositor == null)
265 | _compositor = ElementCompositionPreview.GetElementVisual(page).Compositor;
266 |
267 | var visual = ElementCompositionPreview.GetElementVisual(page);
268 |
269 | visual.Opacity = 0f;
270 |
271 |
272 |
273 | KeyFrameAnimation opacityAnimation = _compositor.CreateScalarKeyFrameAnimation();
274 | opacityAnimation.InsertExpressionKeyFrame(1f, "1");
275 | opacityAnimation.Duration = TimeSpan.FromMilliseconds(1000);
276 |
277 | visual.StartAnimation("Opacity", opacityAnimation);
278 | await Task.Delay(opacityAnimation.Duration);
279 | }
280 | }
281 |
282 | internal async static Task ColorTransitionOut(Frame frame)
283 | {
284 | if (frame.Content is Page page)
285 | {
286 | if (page.Background != null)
287 | {
288 | frame.Background = page.Background;
289 | }
290 |
291 | else if (page.Content is Panel panel)
292 | {
293 | if (panel.Background != null)
294 | {
295 | frame.Background = panel.Background;
296 | }
297 | else
298 | {
299 | frame.Background = (SolidColorBrush)Application.Current.Resources[systemBackgroundColourKey];
300 | }
301 | }
302 | var visual = ElementCompositionPreview.GetElementVisual(page);
303 |
304 | KeyFrameAnimation opacityAnimation = _compositor.CreateScalarKeyFrameAnimation();
305 | opacityAnimation.InsertExpressionKeyFrame(1f, "0");
306 | opacityAnimation.Duration = TimeSpan.FromMilliseconds(1000);
307 |
308 | var sv = _compositor.CreateSpriteVisual();
309 | sv.Brush = _compositor.CreateColorBrush(Colors.LimeGreen);
310 |
311 | visual.StartAnimation("Opacity", opacityAnimation);
312 | await Task.Delay(333);
313 |
314 | }
315 |
316 | }
317 |
318 |
319 | }
320 | }
321 |
--------------------------------------------------------------------------------