Page 1 of 1

In Storyboard, only the last one of several ColorAnimations is executed

Posted: 18 Aug 2024, 11:51
by Demond
Hi!
I wrote a small example of complex animation by color for a regular rectangle. And it seems that only the last animation is played (i.e. after BeginTime="0:0:50"). I checked this behavior in WPF and all animations are performed without problems.
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Rectangle x:Name="Rect" Height="100" Width="100" Fill="LightGreen" VerticalAlignment="Center" HorizontalAlignment="Center">
    <Rectangle.Triggers>
      <EventTrigger RoutedEvent="Loaded">
        <BeginStoryboard>
          <Storyboard TargetName="Rect" TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)">
            <ColorAnimation
              BeginTime="0:0:0"
              Duration="0:0:1" From="LightGreen" To="Red"
              RepeatBehavior="10x" 
              AutoReverse="True" />
            <ColorAnimation
              BeginTime="0:0:10"
              Duration="0:0:0.8" From="LightGreen" To="Red"
              RepeatBehavior="12.5x" 
              AutoReverse="True" />
            <ColorAnimation
              BeginTime="0:0:20"
              Duration="0:0:0.4" From="LightGreen" To="Red"
              RepeatBehavior="25x" 
              AutoReverse="True" />
            <ColorAnimation
              BeginTime="0:0:30"
              Duration="0:0:0.2" From="LightGreen" To="Red"
              RepeatBehavior="50x" 
              AutoReverse="True" />
            <ColorAnimation
              BeginTime="0:0:40"
              Duration="0:0:0.1" From="LightGreen" To="Red"
              RepeatBehavior="100x" 
              AutoReverse="True" />
            <ColorAnimation
              BeginTime="0:0:50"
              Duration="0:0:0.05" From="LightGreen" To="Red"
              RepeatBehavior="200x"
              AutoReverse="True" /> 
          </Storyboard>
        </BeginStoryboard>
      </EventTrigger>
    </Rectangle.Triggers>
  </Rectangle>
</Grid>

Re: In Storyboard, only the last one of several ColorAnimations is executed

Posted: 19 Aug 2024, 12:45
by jsantos
This is a bug. Please file a ticket. Thank you!

Re: In Storyboard, only the last one of several ColorAnimations is executed

Posted: 19 Aug 2024, 13:11
by Demond
This is a bug. Please file a ticket. Thank you!
I created a ticket #3647 )

Re: In Storyboard, only the last one of several ColorAnimations is executed

Posted: 21 Aug 2024, 12:50
by jsantos
Thank you!

Re: In Storyboard, only the last one of several ColorAnimations is executed

Posted: 22 Feb 2025, 19:17
by Demond
I would like to know when this problem will be fixed? Judging by the previous bug tickets, this problem has been around for 10 years since the first bug ticket about this problem was created #694. This solution is vital for creating good object animations. I have several animations that need to be played in sequence, but the last animation is currently running. Is there a temporary workaround at the moment?

Re: In Storyboard, only the last one of several ColorAnimations is executed

Posted: 25 Feb 2025, 18:51
by sfernandez
Using KeyFrame animations has been enough for the majority of our users, so that issue was never a priority. Instead of launching different ColorAnimations with different BeginTime, you can set up a single ColorAnimationUsingKeyFrames with all the different KeyFrames you need.

If you elaborate a bit on what you want to achieve we can help you define an equivalent storyboard using KeyFrame animations.