Add InitialOpacity and PointerOverOpacity for animated button
MODIFY
WalletWasabi.Fluent/Controls/AnimatedButton.axaml
WalletWasabi.Fluent/Controls/AnimatedButton.axaml
xmlns:behaviors="using:WalletWasabi.Fluent.Behaviors"
xmlns:i="using:Avalonia.Xaml.Interactivity"
xmlns:ia="using:Avalonia.Xaml.Interactions.Core"
- xmlns:c="using:WalletWasabi.Fluent.Controls">
+ xmlns:c="clr-namespace:WalletWasabi.Fluent.Controls">
<Design.PreviewWith>
- <c:AnimatedButton />
+ <c:AnimatedButton InitialOpacity="0.5" PointerOverOpacity="0.75" />
</Design.PreviewWith>
<Style Selector="Button > Panel > PathIcon">
- <Setter Property="Opacity" Value="0.5" />
+ <Setter Property="Opacity" Value="{Binding $parent[c:AnimatedButton].InitialOpacity}" />
</Style>
<Style Selector="Button:pointerover > Panel > PathIcon">
- <Setter Property="Opacity" Value="0.75" />
+ <Setter Property="Opacity" Value="{Binding $parent[c:AnimatedButton].PointerOverOpacity}" />
</Style>
<Style Selector="PathIcon.hidden">
<Setter Property="IsVisible" Value="False" />
<Style.Animations>
<Animation Duration="0:0:1.4" Easing="{StaticResource FluentEasing}">
<KeyFrame KeyTime="0:0:0.0">
- <Setter Property="Opacity" Value="0.75" />
+ <Setter Property="Opacity" Value="{Binding $parent[c:AnimatedButton].PointerOverOpacity}" />
</KeyFrame>
<KeyFrame KeyTime="0:0:0.2">
<Setter Property="Opacity" Value="0.0" />
<Setter Property="IsVisible" Value="True" />
</KeyFrame>
<KeyFrame KeyTime="0:0:1.4">
- <Setter Property="Opacity" Value="0.75" />
+ <Setter Property="Opacity" Value="{Binding $parent[c:AnimatedButton].PointerOverOpacity}" />
</KeyFrame>
</Animation>
</Style.Animations>
<Setter Property="IsVisible" Value="True" />
</KeyFrame>
<KeyFrame KeyTime="0:0:0.2">
- <Setter Property="Opacity" Value="0.75" />
+ <Setter Property="Opacity" Value="{Binding $parent[c:AnimatedButton].PointerOverOpacity}" />
</KeyFrame>
<KeyFrame KeyTime="0:0:0.8">
- <Setter Property="Opacity" Value="0.75" />
+ <Setter Property="Opacity" Value="{Binding $parent[c:AnimatedButton].PointerOverOpacity}" />
</KeyFrame>
<KeyFrame KeyTime="0:0:1.0">
<Setter Property="Opacity" Value="0.0" />

MODIFY
WalletWasabi.Fluent/Controls/AnimatedButton.axaml.cs
WalletWasabi.Fluent/Controls/AnimatedButton.axaml.cs
@@ -19,6 +19,12 @@ namespace WalletWasabi.Fluent.Controls
public static readonly StyledProperty<object> CommandParameterProperty =
AvaloniaProperty.Register<AnimatedButton, object>(nameof(CommandParameter));
+ public static readonly StyledProperty<double> InitialOpacityProperty =
+ AvaloniaProperty.Register<AnimatedButton, double>(nameof(InitialOpacity), 0.5);
+
+ public static readonly StyledProperty<double> PointerOverOpacityProperty =
+ AvaloniaProperty.Register<AnimatedButton, double>(nameof(PointerOverOpacity), 0.75);
+
public ICommand Command
{
get => GetValue(CommandProperty);
@@ -42,5 +48,17 @@ namespace WalletWasabi.Fluent.Controls
get => GetValue(ClickIconProperty);
set => SetValue(ClickIconProperty, value);
}
+
+ public double InitialOpacity
+ {
+ get => GetValue(InitialOpacityProperty);
+ set => SetValue(InitialOpacityProperty, value);
+ }
+
+ public double PointerOverOpacity
+ {
+ get => GetValue(PointerOverOpacityProperty);
+ set => SetValue(PointerOverOpacityProperty, value);
+ }
}
}
\ No newline at end of file

Add InitialOpacity and PointerOverOpacity for animated button