//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//       LottieGen version:
//           8.1.240821.1+077322fa26
//       
//       Command:
//           LottieGen -Language CSharp -Public -WinUIVersion 2.6 -InputFile synchronization.json
//       
//       Input file:
//           synchronization.json (2404 bytes created 18:54+01:00 Dec 21 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>
//------------------------------------------------------------------------------
// ___________________________________________________________
// |       Object stats       | UAP v15 count | UAP v7 count |
// |__________________________|_______________|______________|
// | All CompositionObjects   |            26 |           26 |
// |--------------------------+---------------+--------------|
// | Expression animators     |             1 |            1 |
// | KeyFrame animators       |             1 |            1 |
// | Reference parameters     |             1 |            1 |
// | Expression operations    |             0 |            0 |
// |--------------------------+---------------+--------------|
// | Animated brushes         |             - |            - |
// | Animated gradient stops  |             - |            - |
// | ExpressionAnimations     |             1 |            1 |
// | PathKeyFrameAnimations   |             - |            - |
// |--------------------------+---------------+--------------|
// | ContainerVisuals         |             1 |            1 |
// | ShapeVisuals             |             1 |            1 |
// |--------------------------+---------------+--------------|
// | ContainerShapes          |             1 |            1 |
// | CompositionSpriteShapes  |             2 |            2 |
// |--------------------------+---------------+--------------|
// | Brushes                  |             1 |            1 |
// | Gradient stops           |             - |            - |
// | CompositionVisualSurface |             - |            - |
// -----------------------------------------------------------
using Microsoft.Graphics.Canvas.Geometry;
using System;
using System.Collections.Generic;
using System.Numerics;
using Windows.Graphics;
using Windows.UI;
using Windows.UI.Composition;

namespace AnimatedVisuals
{
    // Name:        main_libary_shelf_icon_sync
    // Frame rate:  60 fps
    // Frame count: 61
    // Duration:    1016.7 mS
    sealed class Synchronization
        : Microsoft.UI.Xaml.Controls.IAnimatedVisualSource
        , Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2
    {
        // Animation duration: 1.017 seconds.
        internal const long c_durationTicks = 10166666;

        public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compositor compositor)
        {
            object ignored = null;
            return TryCreateAnimatedVisual(compositor, out ignored);
        }

        public Microsoft.UI.Xaml.Controls.IAnimatedVisual TryCreateAnimatedVisual(Compositor compositor, out object diagnostics)
        {
            diagnostics = null;

            if (Synchronization_AnimatedVisual_UAPv15.IsRuntimeCompatible())
            {
                var res = 
                    new Synchronization_AnimatedVisual_UAPv15(
                        compositor
                        );
                    return res;
            }

            if (Synchronization_AnimatedVisual_UAPv7.IsRuntimeCompatible())
            {
                var res = 
                    new Synchronization_AnimatedVisual_UAPv7(
                        compositor
                        );
                    return res;
            }

            return null;
        }

        /// <summary>
        /// Gets the number of frames in the animation.
        /// </summary>
        public double FrameCount => 61d;

        /// <summary>
        /// Gets the frame rate of the animation.
        /// </summary>
        public double Framerate => 60d;

        /// <summary>
        /// Gets the duration of the animation.
        /// </summary>
        public TimeSpan Duration => TimeSpan.FromTicks(10166666);

        /// <summary>
        /// Converts a zero-based frame number to the corresponding progress value denoting the
        /// start of the frame.
        /// </summary>
        public double FrameToProgress(double frameNumber)
        {
            return frameNumber / 61d;
        }

        /// <summary>
        /// Returns a map from marker names to corresponding progress values.
        /// </summary>
        public IReadOnlyDictionary<string, double> Markers =>
            new Dictionary<string, double>
            {
            };

        /// <summary>
        /// Sets the color property with the given name, or does nothing if no such property
        /// exists.
        /// </summary>
        public void SetColorProperty(string propertyName, Color value)
        {
        }

        /// <summary>
        /// Sets the scalar property with the given name, or does nothing if no such property
        /// exists.
        /// </summary>
        public void SetScalarProperty(string propertyName, double value)
        {
        }

        sealed class Synchronization_AnimatedVisual_UAPv15
            : Microsoft.UI.Xaml.Controls.IAnimatedVisual
        {
            const long c_durationTicks = 10166666;
            readonly Compositor _c;
            readonly ExpressionAnimation _reusableExpressionAnimation;
            AnimationController _animationController_0;
            CompositionColorBrush _colorBrush_AlmostDarkSlateGray_FF2D3846;
            ContainerVisual _root;

            void BindProperty(
                CompositionObject target,
                string animatedPropertyName,
                string expression,
                string referenceParameterName,
                CompositionObject referencedObject)
            {
                _reusableExpressionAnimation.ClearAllParameters();
                _reusableExpressionAnimation.Expression = expression;
                _reusableExpressionAnimation.SetReferenceParameter(referenceParameterName, referencedObject);
                target.StartAnimation(animatedPropertyName, _reusableExpressionAnimation);
            }

            ScalarKeyFrameAnimation CreateScalarKeyFrameAnimation(float initialProgress, float initialValue, CompositionEasingFunction initialEasingFunction)
            {
                var result = _c.CreateScalarKeyFrameAnimation();
                result.Duration = TimeSpan.FromTicks(c_durationTicks);
                result.InsertKeyFrame(initialProgress, initialValue, initialEasingFunction);
                return result;
            }

            CompositionSpriteShape CreateSpriteShape(CompositionGeometry geometry, Matrix3x2 transformMatrix, CompositionBrush fillBrush)
            {
                var result = _c.CreateSpriteShape(geometry);
                result.TransformMatrix = transformMatrix;
                result.FillBrush = fillBrush;
                return result;
            }

            // - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            AnimationController AnimationController_0()
            {
                var result = _animationController_0 = _c.CreateAnimationController();
                result.Pause();
                BindProperty(result, "Progress", "_.Progress", "_", _root);
                return result;
            }

            // - - - - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // - - ShapeGroup: Group 2 Offset:<28.255, 18.903>
            CanvasGeometry Geometry_0()
            {
                CanvasGeometry result;
                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(11.7449999F, 5.09700012F));
                    builder.AddCubicBezier(new Vector2(11.7449999F, -3.66000009F), new Vector2(4.56699991F, -10.9189997F), new Vector2(-4.25500011F, -10.9189997F));
                    builder.AddCubicBezier(new Vector2(-8.6239996F, -10.9189997F), new Vector2(-12.7040005F, -9.20300007F), new Vector2(-15.7449999F, -6.08900023F));
                    builder.AddLine(new Vector2(-12.8739996F, -3.32599998F));
                    builder.AddCubicBezier(new Vector2(-10.5930004F, -5.66200018F), new Vector2(-7.53200006F, -6.94799995F), new Vector2(-4.25500011F, -6.94799995F));
                    builder.AddCubicBezier(new Vector2(2.36199999F, -6.94799995F), new Vector2(7.74499989F, -1.47099996F), new Vector2(7.74499989F, 5.09700012F));
                    builder.AddLine(new Vector2(3.74499989F, 5.09700012F));
                    builder.AddLine(new Vector2(9.74499989F, 10.9189997F));
                    builder.AddLine(new Vector2(15.7449999F, 5.09700012F));
                    builder.AddLine(new Vector2(11.7449999F, 5.09700012F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return result;
            }

            // - - - - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // - - ShapeGroup: Group 1 Offset:<19.745, 29.096>
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;
                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(4.25500011F, 6.94799995F));
                    builder.AddCubicBezier(new Vector2(-2.36199999F, 6.94799995F), new Vector2(-7.74499989F, 1.472F), new Vector2(-7.74499989F, -5.09499979F));
                    builder.AddLine(new Vector2(-3.74499989F, -5.09499979F));
                    builder.AddLine(new Vector2(-9.74499989F, -10.9189997F));
                    builder.AddLine(new Vector2(-15.7449999F, -5.09499979F));
                    builder.AddLine(new Vector2(-11.7449999F, -5.09499979F));
                    builder.AddCubicBezier(new Vector2(-11.7449999F, 3.66199994F), new Vector2(-4.56699991F, 10.9189997F), new Vector2(4.25500011F, 10.9189997F));
                    builder.AddCubicBezier(new Vector2(8.6260004F, 10.9189997F), new Vector2(12.7060003F, 9.20300007F), new Vector2(15.7449999F, 6.08900023F));
                    builder.AddLine(new Vector2(12.8739996F, 3.32500005F));
                    builder.AddCubicBezier(new Vector2(10.5930004F, 5.66099977F), new Vector2(7.53200006F, 6.94799995F), new Vector2(4.25500011F, 6.94799995F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return result;
            }

            CompositionColorBrush ColorBrush_AlmostDarkSlateGray_FF2D3846()
            {
                return _colorBrush_AlmostDarkSlateGray_FF2D3846 = _c.CreateColorBrush(Color.FromArgb(0xFF, 0x2D, 0x38, 0x46));
            }

            // Shape tree root for layer: main_library_shelf_icon_sync Outlines
            CompositionContainerShape ContainerShape()
            {
                var result = _c.CreateContainerShape();
                result.CenterPoint = new Vector2(24F, 24F);
                var shapes = result.Shapes;
                // ShapeGroup: Group 2 Offset:<28.255, 18.903>
                shapes.Add(SpriteShape_0());
                // ShapeGroup: Group 1 Offset:<19.745, 29.096>
                shapes.Add(SpriteShape_1());
                result.StartAnimation("RotationAngleInDegrees", RotationAngleInDegreesScalarAnimation_0_to_360(), AnimationController_0());
                return result;
            }

            // - - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // ShapeGroup: Group 2 Offset:<28.255, 18.903>
            CompositionPathGeometry PathGeometry_0()
            {
                return _c.CreatePathGeometry(new CompositionPath(Geometry_0()));
            }

            // - - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // ShapeGroup: Group 1 Offset:<19.745, 29.096>
            CompositionPathGeometry PathGeometry_1()
            {
                return _c.CreatePathGeometry(new CompositionPath(Geometry_1()));
            }

            // - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // Path 1
            CompositionSpriteShape SpriteShape_0()
            {
                // Offset:<28.255, 18.903>
                var geometry = PathGeometry_0();
                var result = CreateSpriteShape(geometry, new Matrix3x2(1F, 0F, 0F, 1F, 28.2549992F, 18.9029999F), ColorBrush_AlmostDarkSlateGray_FF2D3846());;
                return result;
            }

            // - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // Path 1
            CompositionSpriteShape SpriteShape_1()
            {
                // Offset:<19.745, 29.096>
                var geometry = PathGeometry_1();
                var result = CreateSpriteShape(geometry, new Matrix3x2(1F, 0F, 0F, 1F, 19.7450008F, 29.0960007F), _colorBrush_AlmostDarkSlateGray_FF2D3846);;
                return result;
            }

            // The root of the composition.
            ContainerVisual Root()
            {
                var result = _root = _c.CreateContainerVisual();
                var propertySet = result.Properties;
                propertySet.InsertScalar("Progress", 0F);
                // Shape tree root for layer: main_library_shelf_icon_sync Outlines
                result.Children.InsertAtTop(ShapeVisual_0());
                return result;
            }

            // - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // Rotation
            ScalarKeyFrameAnimation RotationAngleInDegreesScalarAnimation_0_to_360()
            {
                // Frame 0.
                var result = CreateScalarKeyFrameAnimation(0F, 0F, HoldThenStepEasingFunction());
                // Frame 61.
                result.InsertKeyFrame(1F, 360F, _c.CreateCubicBezierEasingFunction(new Vector2(0.314999998F, 0F), new Vector2(0.465000004F, 0.861999989F)));
                return result;
            }

            // Shape tree root for layer: main_library_shelf_icon_sync Outlines
            ShapeVisual ShapeVisual_0()
            {
                var result = _c.CreateShapeVisual();
                result.Size = new Vector2(48F, 48F);
                result.Shapes.Add(ContainerShape());
                return result;
            }

            // - - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // RotationAngleInDegrees
            StepEasingFunction HoldThenStepEasingFunction()
            {
                var result = _c.CreateStepEasingFunction();
                result.IsFinalStepSingleFrame = true;
                return result;
            }

            internal Synchronization_AnimatedVisual_UAPv15(
                Compositor compositor
                )
            {
                _c = compositor;
                _reusableExpressionAnimation = compositor.CreateExpressionAnimation();
                Root();
            }

            public Visual RootVisual => _root;
            public TimeSpan Duration => TimeSpan.FromTicks(c_durationTicks);
            public Vector2 Size => new Vector2(48F, 48F);
            void IDisposable.Dispose() => _root?.Dispose();

            internal static bool IsRuntimeCompatible()
            {
                return Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 15);
            }
        }

        sealed class Synchronization_AnimatedVisual_UAPv7
            : Microsoft.UI.Xaml.Controls.IAnimatedVisual
        {
            const long c_durationTicks = 10166666;
            readonly Compositor _c;
            readonly ExpressionAnimation _reusableExpressionAnimation;
            CompositionColorBrush _colorBrush_AlmostDarkSlateGray_FF2D3846;
            ContainerVisual _root;

            void BindProperty(
                CompositionObject target,
                string animatedPropertyName,
                string expression,
                string referenceParameterName,
                CompositionObject referencedObject)
            {
                _reusableExpressionAnimation.ClearAllParameters();
                _reusableExpressionAnimation.Expression = expression;
                _reusableExpressionAnimation.SetReferenceParameter(referenceParameterName, referencedObject);
                target.StartAnimation(animatedPropertyName, _reusableExpressionAnimation);
            }

            ScalarKeyFrameAnimation CreateScalarKeyFrameAnimation(float initialProgress, float initialValue, CompositionEasingFunction initialEasingFunction)
            {
                var result = _c.CreateScalarKeyFrameAnimation();
                result.Duration = TimeSpan.FromTicks(c_durationTicks);
                result.InsertKeyFrame(initialProgress, initialValue, initialEasingFunction);
                return result;
            }

            CompositionSpriteShape CreateSpriteShape(CompositionGeometry geometry, Matrix3x2 transformMatrix, CompositionBrush fillBrush)
            {
                var result = _c.CreateSpriteShape(geometry);
                result.TransformMatrix = transformMatrix;
                result.FillBrush = fillBrush;
                return result;
            }

            // - - - - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // - - ShapeGroup: Group 2 Offset:<28.255, 18.903>
            CanvasGeometry Geometry_0()
            {
                CanvasGeometry result;
                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(11.7449999F, 5.09700012F));
                    builder.AddCubicBezier(new Vector2(11.7449999F, -3.66000009F), new Vector2(4.56699991F, -10.9189997F), new Vector2(-4.25500011F, -10.9189997F));
                    builder.AddCubicBezier(new Vector2(-8.6239996F, -10.9189997F), new Vector2(-12.7040005F, -9.20300007F), new Vector2(-15.7449999F, -6.08900023F));
                    builder.AddLine(new Vector2(-12.8739996F, -3.32599998F));
                    builder.AddCubicBezier(new Vector2(-10.5930004F, -5.66200018F), new Vector2(-7.53200006F, -6.94799995F), new Vector2(-4.25500011F, -6.94799995F));
                    builder.AddCubicBezier(new Vector2(2.36199999F, -6.94799995F), new Vector2(7.74499989F, -1.47099996F), new Vector2(7.74499989F, 5.09700012F));
                    builder.AddLine(new Vector2(3.74499989F, 5.09700012F));
                    builder.AddLine(new Vector2(9.74499989F, 10.9189997F));
                    builder.AddLine(new Vector2(15.7449999F, 5.09700012F));
                    builder.AddLine(new Vector2(11.7449999F, 5.09700012F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return result;
            }

            // - - - - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // - - ShapeGroup: Group 1 Offset:<19.745, 29.096>
            CanvasGeometry Geometry_1()
            {
                CanvasGeometry result;
                using (var builder = new CanvasPathBuilder(null))
                {
                    builder.SetFilledRegionDetermination(CanvasFilledRegionDetermination.Winding);
                    builder.BeginFigure(new Vector2(4.25500011F, 6.94799995F));
                    builder.AddCubicBezier(new Vector2(-2.36199999F, 6.94799995F), new Vector2(-7.74499989F, 1.472F), new Vector2(-7.74499989F, -5.09499979F));
                    builder.AddLine(new Vector2(-3.74499989F, -5.09499979F));
                    builder.AddLine(new Vector2(-9.74499989F, -10.9189997F));
                    builder.AddLine(new Vector2(-15.7449999F, -5.09499979F));
                    builder.AddLine(new Vector2(-11.7449999F, -5.09499979F));
                    builder.AddCubicBezier(new Vector2(-11.7449999F, 3.66199994F), new Vector2(-4.56699991F, 10.9189997F), new Vector2(4.25500011F, 10.9189997F));
                    builder.AddCubicBezier(new Vector2(8.6260004F, 10.9189997F), new Vector2(12.7060003F, 9.20300007F), new Vector2(15.7449999F, 6.08900023F));
                    builder.AddLine(new Vector2(12.8739996F, 3.32500005F));
                    builder.AddCubicBezier(new Vector2(10.5930004F, 5.66099977F), new Vector2(7.53200006F, 6.94799995F), new Vector2(4.25500011F, 6.94799995F));
                    builder.EndFigure(CanvasFigureLoop.Closed);
                    result = CanvasGeometry.CreatePath(builder);
                }
                return result;
            }

            CompositionColorBrush ColorBrush_AlmostDarkSlateGray_FF2D3846()
            {
                return _colorBrush_AlmostDarkSlateGray_FF2D3846 = _c.CreateColorBrush(Color.FromArgb(0xFF, 0x2D, 0x38, 0x46));
            }

            // Shape tree root for layer: main_library_shelf_icon_sync Outlines
            CompositionContainerShape ContainerShape()
            {
                var result = _c.CreateContainerShape();
                result.CenterPoint = new Vector2(24F, 24F);
                var shapes = result.Shapes;
                // ShapeGroup: Group 2 Offset:<28.255, 18.903>
                shapes.Add(SpriteShape_0());
                // ShapeGroup: Group 1 Offset:<19.745, 29.096>
                shapes.Add(SpriteShape_1());
                result.StartAnimation("RotationAngleInDegrees", RotationAngleInDegreesScalarAnimation_0_to_360());
                var controller = result.TryGetAnimationController("RotationAngleInDegrees");
                controller.Pause();
                BindProperty(controller, "Progress", "_.Progress", "_", _root);
                return result;
            }

            // - - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // ShapeGroup: Group 2 Offset:<28.255, 18.903>
            CompositionPathGeometry PathGeometry_0()
            {
                return _c.CreatePathGeometry(new CompositionPath(Geometry_0()));
            }

            // - - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // ShapeGroup: Group 1 Offset:<19.745, 29.096>
            CompositionPathGeometry PathGeometry_1()
            {
                return _c.CreatePathGeometry(new CompositionPath(Geometry_1()));
            }

            // - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // Path 1
            CompositionSpriteShape SpriteShape_0()
            {
                // Offset:<28.255, 18.903>
                var geometry = PathGeometry_0();
                var result = CreateSpriteShape(geometry, new Matrix3x2(1F, 0F, 0F, 1F, 28.2549992F, 18.9029999F), ColorBrush_AlmostDarkSlateGray_FF2D3846());;
                return result;
            }

            // - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // Path 1
            CompositionSpriteShape SpriteShape_1()
            {
                // Offset:<19.745, 29.096>
                var geometry = PathGeometry_1();
                var result = CreateSpriteShape(geometry, new Matrix3x2(1F, 0F, 0F, 1F, 19.7450008F, 29.0960007F), _colorBrush_AlmostDarkSlateGray_FF2D3846);;
                return result;
            }

            // The root of the composition.
            ContainerVisual Root()
            {
                var result = _root = _c.CreateContainerVisual();
                var propertySet = result.Properties;
                propertySet.InsertScalar("Progress", 0F);
                // Shape tree root for layer: main_library_shelf_icon_sync Outlines
                result.Children.InsertAtTop(ShapeVisual_0());
                return result;
            }

            // - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // Rotation
            ScalarKeyFrameAnimation RotationAngleInDegreesScalarAnimation_0_to_360()
            {
                // Frame 0.
                var result = CreateScalarKeyFrameAnimation(0F, 0F, HoldThenStepEasingFunction());
                // Frame 61.
                result.InsertKeyFrame(1F, 360F, _c.CreateCubicBezierEasingFunction(new Vector2(0.314999998F, 0F), new Vector2(0.465000004F, 0.861999989F)));
                return result;
            }

            // Shape tree root for layer: main_library_shelf_icon_sync Outlines
            ShapeVisual ShapeVisual_0()
            {
                var result = _c.CreateShapeVisual();
                result.Size = new Vector2(48F, 48F);
                result.Shapes.Add(ContainerShape());
                return result;
            }

            // - - Shape tree root for layer: main_library_shelf_icon_sync Outlines
            // RotationAngleInDegrees
            StepEasingFunction HoldThenStepEasingFunction()
            {
                var result = _c.CreateStepEasingFunction();
                result.IsFinalStepSingleFrame = true;
                return result;
            }

            internal Synchronization_AnimatedVisual_UAPv7(
                Compositor compositor
                )
            {
                _c = compositor;
                _reusableExpressionAnimation = compositor.CreateExpressionAnimation();
                Root();
            }

            public Visual RootVisual => _root;
            public TimeSpan Duration => TimeSpan.FromTicks(c_durationTicks);
            public Vector2 Size => new Vector2(48F, 48F);
            void IDisposable.Dispose() => _root?.Dispose();

            internal static bool IsRuntimeCompatible()
            {
                return Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7);
            }
        }
    }
}
