-
Notifications
You must be signed in to change notification settings - Fork 79
[DRAFT] Add LottieIsland and LottieWinRT for frameworkless or native applications #557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 33 commits
03637d8
15673a6
f715f7b
7d583f3
2669684
3e107ef
0329c09
9cf356a
567d126
aef4a7c
87525d0
e7a6d2f
381c02d
7263a34
807c32a
8fd5e6b
b41d8fd
66b537b
457d0b7
10d8542
623d418
ddcc1a6
144a389
af22bdc
7201843
95e6616
544cde6
8d9c060
5896c83
9e92f8e
1167c74
b40f53f
9a0ce7c
0840bbb
32e0e81
a542db3
05d2e1f
267afe5
f91bf4d
d8752d4
845f6f3
750f44c
81b8438
eac0dc2
0945863
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#pragma once | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a tool. | ||
// | ||
// LottieGen version: | ||
// 8.0.230813-rc.7+0443b1e789 | ||
// | ||
// Command: | ||
// LottieGen -Language Cppwinrt -WinUIVersion 3.0 -InputFile LottieLogo1.json | ||
// | ||
// Input file: | ||
// LottieLogo1.json (190271 bytes created 0:40-04:00 Mar 13 2024) | ||
// | ||
// LottieGen source: | ||
// http://aka.ms/Lottie | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
#include "AnimatedVisuals.LottieLogo1.g.h" | ||
|
||
namespace winrt::AnimatedVisuals | ||
{ | ||
// Frame rate: 30 fps | ||
// Frame count: 179 | ||
// Duration: 5966.7 mS | ||
namespace implementation | ||
{ | ||
class LottieLogo1 | ||
: public LottieLogo1T<LottieLogo1> | ||
{ | ||
public: | ||
// Animation duration: 5.967 seconds. | ||
static constexpr int64_t c_durationTicks{ 59666666L }; | ||
|
||
winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual TryCreateAnimatedVisual( | ||
winrt::Microsoft::UI::Composition::Compositor const& compositor); | ||
|
||
winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual TryCreateAnimatedVisual( | ||
winrt::Microsoft::UI::Composition::Compositor const& compositor, | ||
winrt::Windows::Foundation::IInspectable& diagnostics); | ||
|
||
// Gets the number of frames in the animation. | ||
double FrameCount(); | ||
|
||
// Gets the framerate of the animation. | ||
double Framerate(); | ||
|
||
// Gets the duration of the animation. | ||
winrt::Windows::Foundation::TimeSpan Duration(); | ||
|
||
// Converts a zero-based frame number to the corresponding progress value denoting the | ||
// start of the frame. | ||
double FrameToProgress(double frameNumber); | ||
|
||
// Returns a map from marker names to corresponding progress values. | ||
winrt::Windows::Foundation::Collections::IMapView<hstring, double> Markers(); | ||
|
||
// Sets the color property with the given name, or does nothing if no such property | ||
// exists. | ||
void SetColorProperty(hstring const& propertyName, winrt::Windows::UI::Color value); | ||
|
||
// Sets the scalar property with the given name, or does nothing if no such property | ||
// exists. | ||
void SetScalarProperty(hstring const& propertyName, double value); | ||
}; | ||
} | ||
|
||
namespace factory_implementation | ||
{ | ||
struct LottieLogo1 : LottieLogo1T<LottieLogo1, implementation::LottieLogo1> | ||
{ | ||
}; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a tool. | ||
// | ||
// LottieGen version: | ||
// 8.0.230813-rc.7+0443b1e789 | ||
// | ||
// Command: | ||
// LottieGen -Language Cppwinrt -WinUIVersion 3.0 -InputFile LottieLogo1.json | ||
// | ||
// Input file: | ||
// LottieLogo1.json (190271 bytes created 0:40-04:00 Mar 13 2024) | ||
// | ||
// LottieGen source: | ||
// http://aka.ms/Lottie | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
namespace AnimatedVisuals | ||
{ | ||
runtimeclass LottieLogo1 | ||
: [default] Microsoft.UI.Xaml.Controls.IAnimatedVisualSource | ||
, Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2 | ||
{ | ||
LottieLogo1(); | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
EXPORTS | ||
DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE | ||
DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
namespace CommunityToolkit.WinAppSDK.LottieIsland | ||
{ | ||
interface IAnimatedVisualFrameworkless | ||
{ | ||
Windows.Foundation.TimeSpan Duration{ get; }; | ||
Microsoft.UI.Composition.Visual RootVisual{ get; }; | ||
Windows.Foundation.Numerics.Vector2 Size{ get; }; | ||
}; | ||
|
||
runtimeclass LottieContentIsland | ||
{ | ||
static LottieContentIsland Create(Microsoft.UI.Composition.Compositor compositor); | ||
|
||
Microsoft.UI.Content.ContentIsland Island{ get; }; | ||
|
||
IAnimatedVisualFrameworkless AnimatedVisual; | ||
|
||
Windows.Foundation.TimeSpan Duration{ get; }; | ||
|
||
Boolean IsAnimationLoaded{ get; }; | ||
|
||
Boolean IsPlaying{ get; }; | ||
|
||
Single PlaybackRate; | ||
|
||
event Windows.Foundation.TypedEventHandler<LottieContentIsland, Microsoft.UI.Input.PointerEventArgs> PointerEntered; | ||
|
||
event Windows.Foundation.TypedEventHandler<LottieContentIsland, Microsoft.UI.Input.PointerEventArgs> PointerExited; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can these just be configured on the ContentIsland directly? Why does it need to be exposed from this object? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to allow a hosting application to hook into input to configure e.g. click to pause. We didn't want to have the hosting application directly calling InputPointerSource.GetForIsland There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No really, I'd like to remove it for now. We're already passing the ContentIsland out as a property. The app can call InputPointerSource.GetForIsland. Unless there's an important reason to wrap and re-expose all of this (e.g., something about object destruction), it's much better to not need to duplicate all of these APIs. |
||
|
||
event Windows.Foundation.TypedEventHandler<LottieContentIsland, Microsoft.UI.Input.PointerEventArgs> PointerMoved; | ||
|
||
event Windows.Foundation.TypedEventHandler<LottieContentIsland, Microsoft.UI.Input.PointerEventArgs> PointerPressed; | ||
|
||
event Windows.Foundation.TypedEventHandler<LottieContentIsland, Microsoft.UI.Input.PointerEventArgs> PointerReleased; | ||
|
||
void Pause(); | ||
|
||
Windows.Foundation.IAsyncAction PlayAsync(Single fromProgress, Single toProgress, Boolean looped); | ||
|
||
void Resume(); | ||
|
||
void Stop(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<BuildOutDir>$([MSBuild]::NormalizeDirectory('$(SolutionDir)', '_build', '$(Platform)', '$(Configuration)'))</BuildOutDir> | ||
<OutDir>$([MSBuild]::NormalizeDirectory('$(BuildOutDir)', '$(MSBuildProjectName)', 'bin'))</OutDir> | ||
<IntDir>$([MSBuild]::NormalizeDirectory('$(BuildOutDir)', '$(MSBuildProjectName)', 'obj'))</IntDir> | ||
</PropertyGroup> | ||
</Project> |
Uh oh!
There was an error while loading. Please reload this page.