■ SaturationEffectAnimation 엘리먼트의 Target/From/To 속성을 사용해 채도 효과 애니메이션을 만드는 방법을 보여준다.
▶ 예제 코드 (XAML)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
xmlns:mxic="using:Microsoft.Xaml.Interactions.Core" xmlns:mxi="using:Microsoft.Xaml.Interactivity" xmlns:ctwa="using:CommunityToolkit.WinUI.Animations" xmlns:ctwb="using:CommunityToolkit.WinUI.Behaviors" xmlns:ctwm="using:CommunityToolkit.WinUI.Media" <Button HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" Height="100" Content="Start"> <mxi:Interaction.Behaviors> <mxic:EventTriggerBehavior EventName="Click"> <ctwb:StartAnimationAction Animation="{x:Bind buttonAnimationSet}" /> </mxic:EventTriggerBehavior> </mxi:Interaction.Behaviors> <ctwm:UIElementExtensions.VisualFactory> <ctwm:PipelineVisualFactory Source="{ctwm:BackdropSource}"> <ctwm:BlurEffect x:Name="blurEffect" Amount="0" IsAnimatable="True" /> <ctwm:SaturationEffect x:Name="saturationEffect" Value="1" IsAnimatable="True" /> <ctwm:ExposureEffect x:Name="exposureEffect" Amount="0" IsAnimatable="True"/> </ctwm:PipelineVisualFactory> </ctwm:UIElementExtensions.VisualFactory> <ctwa:Explicit.Animations> <ctwa:AnimationSet x:Name="buttonAnimationSet"> <ctwa:AnimationScope Duration="00:00:01" EasingMode="EaseOut"> <ctwa:ScaleAnimation From="1.1" To="1" /> <ctwa:BlurEffectAnimation Target="{x:Bind blurEffect}" From="32" To="0" /> <ctwa:SaturationEffectAnimation Target="{x:Bind saturationEffect}" From="0" To="1" /> <ctwa:ExposureEffectAnimation Target="{x:Bind exposureEffect}" From="1" To="0" /> </ctwa:AnimationScope> </ctwa:AnimationSet> </ctwa:Explicit.Animations> </Button> |