Trigger conditions
Hello!
I'm trying to implement a "drain" animation on a health bar, which requires a separate ProgressBar that is rendered one layer below the actual health bar. For brevity's sake, I'll be refering to these as the main and drain bars. The expected behavior is as follows:
The problem here is that the drain bar value update can only happen when two conditions are met, as neither is sufficient on its own:
I'm trying to implement a "drain" animation on a health bar, which requires a separate ProgressBar that is rendered one layer below the actual health bar. For brevity's sake, I'll be refering to these as the main and drain bars. The expected behavior is as follows:
- When health is drained, the main bar is immediately updated to the new value, but the drain bar doesn't have its value updated and instead fades out.
- When the fade-out Storyboard completes, the invisible drain bar can now have its value updated to the new value.
- Afterwards, the drain bar keeps getting updated to the health value.
Code: Select all
<b:Interaction.Triggers>
<!-- This triggers the health bar vanishing animation when the player's
health is being drained -->
<b:DataTrigger Binding="{Binding LocalPlayerCard.Health.IsDraining}" Value="True">
<b:ControlStoryboardAction Storyboard="{StaticResource HealthBarDrainHideAnimation}"/>
</b:DataTrigger>
<b:StoryboardCompletedTrigger Storyboard="{StaticResource HealthBarDrainHideAnimation}">
<b:ControlStoryboardAction Storyboard="{StaticResource HealthBarDrainAnimation}"/>
</b:StoryboardCompletedTrigger>
</b:Interaction.Triggers>
- The health value has changed, requiring a PropertyChangedTrigger.
- The HealthBarDrainHideAnimation has finished playing, requiring a StoryboardCompletedTrigger (assuming it doesn't run just once).
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Trigger conditions
I'm not following exactly which conditions and what actions you need to execute, but there is a way to extend a trigger with more conditions, using the ConditionBehavior. Is this what you're looking for?
Who is online
Users browsing this forum: No registered users and 3 guests