jsuarezruiz / Xamanimation

Xamarin Forms Animation Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ShakeAnimation with RepeatForever and Triggers

matteopiccioni opened this issue · comments

Hello,
I try to use ShakeAnimation with repeatForever and Trigger in this way

<Label x:Name="AllarmeBox" Text="text to show" FontSize="Large" IsVisible="{Binding IsLabelVisible}"
                   HorizontalTextAlignment="Center" VerticalTextAlignment="Center">

                <Label.Triggers>

                        <Trigger TargetType="Label" Property="IsVisible" Value="True">
                            <Trigger.EnterActions>
                                <xamanimation:BeginAnimation Animation="{StaticResource ShakeAnimationIn}" />
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <xamanimation:BeginAnimation Animation="{StaticResource ShakeAnimationOut}" />
                            </Trigger.ExitActions>
                        </Trigger>

                </Label.Triggers>
            </Label>

having in the resources:

            <xamanimation:ShakeAnimation
                x:Key="ShakeAnimationIn"
                RepeatForever="True"
                Target="{x:Reference AllarmeBox}"/>

            <xamanimation:ShakeAnimation
                x:Key="ShakeAnimationOut"
                Target="{x:Reference AllarmeBox}"/>

The problem is that using RepeatForever="True" the label is not shown...
maybe multiple shake animation starts on the same label, without waiting the previous animation ends?

ps
Using only ShakeAnimationOut (without RepeatForever) the single animation is shown

Update:
In your sample, if you add RepeatForever="True" on ShakeAnimation, you can see the box moving out of screen
Maybe the 'next animation' should starts after the animation previous animation ends ('Duration' parameter)

Thanks

I am currently trying to use a HeartAnimation with RepeatForever and a DataTrigger. When I add RepeatForever the animation never starts.

If i do not use Repeat Forever the animation does start but of course that's no good as I want it to run until the DataTrigger is negated