Play animation (storyboard) back

Is there an easy way to play back some StoryBoad(reverse)? Since there is a method Storyboard.Begin(), I would expect that there is a method like "Storyboard.BeginReversed ()", but I can not find it.

If there is no way to play the animation back, I have to write for most of the animations related to the animation. It smells bad to me (duplicating some kind of code).

Basically, I just animate a grid that shows and hides what.

+3
source share
2 answers

Can you flip From and To and play it again?

+1
source

, (. xaml )

var storyboard = this.Resources [ "Storyboard1" ] ;

        var anim = storyboard.Children[0] as DoubleAnimationUsingKeyFrames;

        anim.AutoReverse = true;

        anim.RepeatBehavior = RepeatBehavior.Forever;

<Storyboard x:Key="Storyboard1">
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(FrameworkElement.Width)">
            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="200"/>
            <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="300"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
-1

Source: https://habr.com/ru/post/1747700/


All Articles