This is a migrated thread and some comments may be shown as answers.

Animating multiple items or repeating the same thing

1 Answer 58 Views
Animation
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chandra
Top achievements
Rank 1
Chandra asked on 08 Sep 2013, 08:01 AM
I am animating my text right now, in this manner.  

I want to do couple of things :

1) play animation repeatedly until user action    --> this didnt work when I called the animate(), one after another.  
2) animate different text strings one after another. - when I tried to animate 3 textblocks one after another, they all played at same time. Also, with sleep 500 secs between them, they still started same time.

Is there any sample code you can provide here ?

In XAML:

        <Grid.Resources>
            <telerikCore:RadScaleAnimation x:Key="radScaleAnimation" Duration="0:0:2" AutoReverse="True"/>
        </Grid.Resources>
                        <TextBlock Name="target1"  Text="Congratulations !" Margin="10" TextWrapping="Wrap" 
                                   HorizontalAlignment="Center"
                               FontSize="{StaticResource PhoneFontSizeMedium}" Foreground="Red" />

In CS file : 

void animate()
{              scaleAnimation = this.LayoutRoot.Resources["radScaleAnimation"] as RadScaleAnimation;
                scaleAnimation.StartScaleX = 0.5;
                scaleAnimation.EndScaleX = 4;
                scaleAnimation.StartScaleY = 0.5;
                scaleAnimation.EndScaleY = 4;
                EasingFunctionBase ease = new QuadraticEase();
                ease.EasingMode = EasingMode.EaseInOut;
                scaleAnimation.Easing = ease;
                 RadAnimationManager.Play(this.target1, scaleAnimation);
}

1 Answer, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 12 Sep 2013, 06:38 AM
Hi Chandra,

Thanks for writing.

1. To play an animation repeatedly you need to set the RepeatBehavior property to RepeatBehavior.Forever. This will play the animation until you manually stop it.

2. To animate elements one after another you need to prepare animation for each element and set the InitialDelay property for each animation so that it starts right after the duration of the previous one is over.
 You do not need to use timers and sleep the UI thread. Just play all animations simultaneously by defining different InitialDelay values for each animation.

I hope this helps.

Regards,
Deyan
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Animation
Asked by
Chandra
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Share this question
or