<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ForzaUI"
                    xmlns:System="clr-namespace:System;assembly=mscorlib">

    <System:Double x:Key="A_Double_NewStarEarned_InitialStarScale">1.8</System:Double>
    <System:Double x:Key="A_Double_NewStarBoomScaleEnd">8</System:Double>

    <System:Double x:Key="A_Double_StarBloomMaxScale">1.08</System:Double>
    <System:Double x:Key="A_Double_StarGlowMaxScale">1.2</System:Double>

    <Color x:Key="A_Color_StarRewards_Gradient_Stop1">#BF6C11</Color>
    <Color x:Key="A_Color_StarRewards_Gradient_Stop2">#ca9731</Color>
    <Color x:Key="A_Color_StarRewards_Gradient_Stop3">#FFE462</Color>
    <Color x:Key="A_Color_StarRewards_Gradient_Stop4">#C2870C</Color>

    <ControlTemplate x:Key="A_Template_StarsGoldBackground">
        <UniformGrid Columns="3">
            <local:FZMaterial Margin="-0.5">
                <local:FZMaterial.Preset>
                    <local:FZMaterialPresetRoundtangle GradientAngle="90"
                                                       GradientColorA="{StaticResource A_Color_StarRewards_Gradient_Stop1}"
                                                       GradientColorB="{StaticResource A_Color_StarRewards_Gradient_Stop2}" />
                </local:FZMaterial.Preset>
            </local:FZMaterial>
            <local:FZMaterial Margin="-0.5">
                <local:FZMaterial.Preset>
                    <local:FZMaterialPresetRoundtangle GradientAngle="90"
                                                       GradientColorA="{StaticResource A_Color_StarRewards_Gradient_Stop2}"
                                                       GradientColorB="{StaticResource A_Color_StarRewards_Gradient_Stop3}" />
                </local:FZMaterial.Preset>
            </local:FZMaterial>
            <local:FZMaterial Margin="-0.5">
                <local:FZMaterial.Preset>
                    <local:FZMaterialPresetRoundtangle GradientAngle="90"
                                                       GradientColorA="{StaticResource A_Color_StarRewards_Gradient_Stop3}"
                                                       GradientColorB="{StaticResource A_Color_StarRewards_Gradient_Stop4}" />
                </local:FZMaterial.Preset>
            </local:FZMaterial>
        </UniformGrid>
    </ControlTemplate>
    
    <local:OffsetKeyTime x:Key="A_KeyTime_Star_Slam_AlphaOn_Begin"
                         KeyTime="0:0:0"
                         Offset="0:0:0" />
    <local:OffsetKeyTime x:Key="A_KeyTime_Star_Slam_AlphaOn_End"
                         KeyTime="{StaticResource A_KeyTime_Star_Slam_AlphaOn_Begin}"
                         Offset="0:0:0.2" />

    <local:OffsetKeyTime x:Key="A_KeyTime_Star_Slam_MotionOn_Begin"
                         KeyTime="{StaticResource A_KeyTime_Star_Slam_AlphaOn_Begin}"
                         Offset="0:0:0.0" />
    <local:OffsetKeyTime x:Key="A_KeyTime_Star_Slam_MotionOn_End"
                         KeyTime="{StaticResource A_KeyTime_Star_Slam_MotionOn_Begin}"
                         Offset="0:0:0.5" />

    <local:OffsetKeyTime x:Key="A_KeyTime_Star_Slam_Bloom_Begin"
                         KeyTime="{StaticResource A_KeyTime_Star_Slam_MotionOn_End}"
                         Offset="0:0:0.0" />
    <local:OffsetKeyTime x:Key="A_KeyTime_Star_Slam_Bloom_Up"
                         KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Begin}"
                         Offset="0:0:0.03" />
    <local:OffsetKeyTime x:Key="A_KeyTime_Star_Slam_Bloom_End"
                         KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Begin}"
                         Offset="0:0:0.5" />

    <local:OffsetKeyTime x:Key="A_KeyTime_Star_FlashOn"
                         KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Up}"
                         Offset="0:0:0.0" />
    <local:OffsetKeyTime x:Key="A_KeyTime_Star_FlashCenter"
                         KeyTime="{StaticResource A_KeyTime_Star_FlashOn}"
                         Offset="{StaticResource A_TimeSpan_FlashToCenter}" />
    <local:OffsetKeyTime x:Key="A_KeyTime_Star_FlashOff"
                         KeyTime="{StaticResource A_KeyTime_Star_FlashCenter}"
                         Offset="{StaticResource A_TimeSpan_FlashCenterToOff}" />
    <local:OffsetKeyTime x:Key="A_KeyTime_Star_FlashOff_Alpha_Begin"
                         KeyTime="{StaticResource A_KeyTime_Star_FlashCenter}"
                         Offset="{StaticResource A_TimeSpan_FlashCenterToAlpha}" />
    <local:OffsetKeyTime x:Key="A_KeyTime_Star_FlashOff_Alpha_End"
                         KeyTime="{StaticResource A_KeyTime_Star_FlashOff_Alpha_Begin}"
                         Offset="{StaticResource A_TimeSpan_FlashAlphaToOff}" />

    <local:UIStoryboard x:Key="A_Storyboard_NewStarEarned">
        <local:UIStoryboard.TriggerAnimation>
            <!--PauseStoryboard BeginStoryboardName="AnimateStar"
                                 local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_Star_Pause}" /-->
            <local:StartAudioTrigger local:TriggerAnimation.KeyTime="0:0:0.1"
                                     EventName="/Master/UI/E3/UI_Forzathon_Success" />
        </local:UIStoryboard.TriggerAnimation>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                       Storyboard.TargetName="StarForeground">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="0" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_AlphaOn_Begin}"
                                    Value="0" />
            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_AlphaOn_End}"
                                  Value="1" />
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
                                       Storyboard.TargetName="StarForeground">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="{StaticResource A_Double_NewStarEarned_InitialStarScale}" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_MotionOn_Begin}"
                                    Value="{StaticResource A_Double_NewStarEarned_InitialStarScale}" />
            <SplineDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_MotionOn_End}"
                                  Value="1"
                                  KeySpline="0.9,0.0,0.9,0.0" />
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)"
                                       Storyboard.TargetName="StarForeground">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="{StaticResource A_Double_NewStarEarned_InitialStarScale}" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_MotionOn_Begin}"
                                    Value="{StaticResource A_Double_NewStarEarned_InitialStarScale}" />

            <SplineDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_MotionOn_End}"
                                  Value="1"
                                  KeySpline="0.9,0.0,0.9,0.0" />
        </DoubleAnimationUsingKeyFrames>

        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                       Storyboard.TargetName="StarBloom">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="0" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Begin}"
                                    Value="0" />
            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Up}"
                                  Value="1.5" />
            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_End}"
                                  Value="0" />
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
                                       Storyboard.TargetName="StarBloom">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="1" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Up}"
                                    Value="1" />
            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_End}"
                                  Value="{StaticResource A_Double_StarBloomMaxScale}" />
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)"
                                       Storyboard.TargetName="StarBloom">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="1" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Up}"
                                    Value="1" />
            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_End}"
                                  Value="{StaticResource A_Double_StarBloomMaxScale}" />
        </DoubleAnimationUsingKeyFrames>

        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                       Storyboard.TargetName="BoomStar">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="0" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Begin}"
                                    Value="0" />
            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Up}"
                                  Value="1" />
            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_End}"
                                  Value="0" />
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
                                       Storyboard.TargetName="BoomStar">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="1" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Up}"
                                    Value="1" />
            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_End}"
                                  Value="{StaticResource A_Double_StarGlowMaxScale}" />
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)"
                                       Storyboard.TargetName="BoomStar">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="1" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Up}"
                                    Value="1" />
            <LinearDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_End}"
                                  Value="{StaticResource A_Double_StarGlowMaxScale}" />
        </DoubleAnimationUsingKeyFrames>

        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity"
                                       Storyboard.TargetName="StarEmpty">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="1" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Up}"
                                    Value="0" />
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity"
                                       Storyboard.TargetName="StarFullBG">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="0" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_Slam_Bloom_Up}"
                                    Value="1" />
        </DoubleAnimationUsingKeyFrames>

        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="StarFlash"
                                       Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="-2500" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_FlashOn}"
                                    Value="-800" />
            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_FlashCenter}"
                                  Value="1000"
                                  EasingFunction="{local:ExponentialEasing EasingMode=EaseIn}" />
            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_FlashOff}"
                                  Value="3500"
                                  EasingFunction="{local:ExponentialEasing EasingMode=EaseOut}" />
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="StarFlash"
                                       Storyboard.TargetProperty="Opacity">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                    Value="0" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_FlashOn}"
                                    Value="{StaticResource A_Double_FlashOpacity}" />
            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_FlashOff_Alpha_Begin}"
                                    Value="{StaticResource A_Double_FlashOpacity}" />
            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Star_FlashOff_Alpha_End}"
                                  Value="0" />
        </DoubleAnimationUsingKeyFrames>
    </local:UIStoryboard>

    <ItemsPanelTemplate x:Key="A_PanelTemplate_BucketListStars">
        <StackPanel Orientation="Horizontal"
                    IsItemsHost="True" />
    </ItemsPanelTemplate>

    <ControlTemplate x:Key="A_Template_BucketListStar">
        <Grid Width="330"
              Height="330"
              Margin="55,0">
            <local:FZMaterial x:Name="StarEmpty"
                              Color="#666"
                              ImageSourceNoPreload="/ForzaUI;component/Textures/Data_Bound/PostRace/Star_Empty.png" />
            <Grid x:Name="StarFullBG"
                  Opacity="0"
                  Width="330"
                  Height="330">
                <local:FZMaterial ImageSource="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"
                                  GetSizeFromTexture="True"
                                  VerticalAlignment="Top"
                                  HorizontalAlignment="Left" />
            </Grid>
            <local:FZMaterial x:Name="StarBloom"
                              Opacity="0"
                              ImageSourceNoPreload="/ForzaUI;component/Textures/Data_Bound/PostRace/Star_Glow.png"
                              Preset="{StaticResource A_FZMaterialPresetAdditive}"
                              RenderTransformOrigin="0.5,0.5">
                <local:FZMaterial.RenderTransform>
                    <ScaleTransform ScaleX="1"
                                    ScaleY="1" />
                </local:FZMaterial.RenderTransform>
            </local:FZMaterial>
            <Decorator x:Name="StarForeground"
                       Opacity="0"
                       RenderTransformOrigin="0.5,0.5">
                <UIElement.RenderTransform>
                    <ScaleTransform ScaleX="1"
                                    ScaleY="1" />
                </UIElement.RenderTransform>
                <Grid Width="{TemplateBinding Width}"
                      Height="{TemplateBinding Height}">

                    <local:FZMaterial  ImageSourceNoPreload="/ForzaUI;component/Textures/Data_Bound/PostRace/Star_Full.png"
                                       Preset="{StaticResource A_FZMaterialPresetAdditive}" />

                    <local:FZMaterial CaptureSubgraph="True"
                                      Preset="{StaticResource A_FZMaterialPresetAdditive}"
                                      Color="{StaticResource A_Color_StarRewards_Gradient_Stop3}">

                        <Grid Width="{TemplateBinding Width}"
                              Height="{TemplateBinding Height}"
                              ClipToBounds="True">
                            <UIElement.OpacityMask>
                                <ImageBrush ImageSource="/ForzaUI;component/Textures/Data_Bound/PostRace/Star_Full.png" />
                            </UIElement.OpacityMask>
                            <Decorator local:ZPanel.TransformOrigin="0.5,0.5">
                                <Decorator>
                                    <UIElement.RenderTransform>
                                        <TranslateTransform X="-2200" />
                                    </UIElement.RenderTransform>
                                    <Control Style="{StaticResource A_Style_RewardFlash}"
                                             x:Name="StarFlash"
                                             Opacity="0" />
                                </Decorator>
                                <local:ZPanel.Transform>
                                    <local:Transform3DGroup>
                                        <ScaleTransform3D ScaleX="0.2" />
                                        <local:ZRotation Angle="30" />
                                    </local:Transform3DGroup>
                                </local:ZPanel.Transform>
                            </Decorator>
                        </Grid>

                    </local:FZMaterial>

                </Grid>
            </Decorator>
            <local:FZMaterial x:Name="BoomStar"
                              Opacity="0"
                              ImageSource="/ForzaUI;component/Textures/Anthem/HUD/SkillsLargeGlow.png"
                              Color="#CDFFFFFF"
                              Preset="{StaticResource A_FZMaterialPresetAdditive}"
                              RenderTransformOrigin="0.5,0.5">
                <local:FZMaterial.RenderTransform>
                    <ScaleTransform ScaleX="1"
                                    ScaleY="1" />
                </local:FZMaterial.RenderTransform>
            </local:FZMaterial>
        </Grid>
        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding Path=(local:TickerItemsControlItem.Reached)}"
                         Value="True">
                <DataTrigger.EnterActions>
                    <local:BeginUIStoryboard x:Name="AnimateStar"
                                             Storyboard="{StaticResource A_Storyboard_NewStarEarned}" />
                </DataTrigger.EnterActions>
            </DataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Path=(local:TickerItemsControlItem.Reached)}"
                               Value="True" />
                    <Condition Binding="{Binding Path=(local:TickerItemsControlItem.IsFinalItem)}"
                               Value="True" />
                </MultiDataTrigger.Conditions>
                <MultiDataTrigger.EnterActions>
                    <local:RaiseFzEvent EventName="FinalStarAnimation" />
                </MultiDataTrigger.EnterActions>
            </MultiDataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="A_Style_Control_BucketListStar"
           TargetType="Control">
        <Setter Property="Tag"
                Value="/ForzaUI;component/Textures/Data_Bound/PostRace/Star_Full_BG.png" />
        <Setter Property="Template"
                Value="{StaticResource A_Template_BucketListStar}" />
    </Style>
</ResourceDictionary>