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

RadScaleAndFadeAnimation scale issues after AutoReverse

1 Answer 49 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.
Erik
Top achievements
Rank 1
Erik asked on 17 Jun 2012, 05:41 AM
I have the below code running, when the button finishes growing then shrinking back it then flashes to the endScale sizes and EndOpacity even though AutoReverse is set to true.            

XAML
    <Canvas x:Name="LayoutRoot" Background="Transparent" VerticalAlignment="Top" d:DataContext="{d:DesignData /SampleData/vehicleSampleData.xaml}" >
        <Canvas.Resources>
            <telerikCore:RadScaleAndFadeAnimation x:Key="radScaleAndFadeAnimation" Duration="0:0:1" AutoReverse="True"/>
        </Canvas.Resources>
...
...

C#
Global Variable:
public RadScaleAndFadeAnimation scaleAnimation;

in initialize code:
scaleAnimation = this.LayoutRoot.Resources["radScaleAndFadeAnimation"] as RadScaleAndFadeAnimation;
            scaleAnimation.ScaleAnimation.StartScaleX = 1;
            scaleAnimation.ScaleAnimation.StartScaleY = 1;
            scaleAnimation.ScaleAnimation.EndScaleX = 1.5;
            scaleAnimation.ScaleAnimation.EndScaleY = 1.5;
            scaleAnimation.FadeAnimation.StartOpacity = .8;
            scaleAnimation.FadeAnimation.EndOpacity = .5;
            scaleAnimation.Ended += new EventHandler<EventArgs>(scaleAnimation_Ended);

Then in a button click I call on the button that's clicked:
RadAnimationManager.Play(item1SelectButton, scaleAnimation);

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 20 Jun 2012, 03:07 PM
Hello Erik,

Thank you for the question.
You just need to call the ApplyInitialValues method of the scale animation in the Ended event handler. For example:

void scaleAnimation_Ended(object sender, EventArgs e)
{
    scaleAnimation.ApplyInitialValues(this.button);
}
Please write again if you have other questions.

All the best,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Animation
Asked by
Erik
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or