Page 1 of 1

[SOLVED] Animation not working?

Posted: Wed Dec 19, 2018 8:51 am
by Andreas
Hi,

I'm trying to recreate the animation example from the showcase.
I've created an empty cs xaml for html5 project and copied the relevant code.
For some reason the animation doesn't play. The showcase works without any issue.
Any idea what the reason could be?

Thanks,
Andreas

Re: Animation not working?

Posted: Wed Dec 19, 2018 8:59 am
by JS-Support @Userware
Hi,

Could you please attach the test project? (you can delete the bin and obj folders before uploading the ZIP)

Re: Animation not working?

Posted: Thu Dec 20, 2018 12:58 am
by Andreas
Hi Folks,

Pls find the test project attached.

Thanks,
Andreas

Re: Animation not working?

Posted: Mon Jan 14, 2019 1:47 am
by Andreas
Any luck with this?

Re: Animation not working?

Posted: Mon Jan 21, 2019 6:50 am
by JS-Support @Userware
Hi Andreas,

Sorry for the delay to reply.

The issue is caused by the fact that you have inverted the methods "ButtonToStartAnimationClose_Click" and "ButtonToStartAnimationOpen_Click", so that when you click the "Start" button, it launches the wrong animation (it launches the "Close" animation instead of the "Open" one).

To fix the issue, please replace the following code:

Code: Select all

        private void ButtonToStartAnimationClose_Click(object sender, RoutedEventArgs e)
        {
            var storyboard = (Storyboard)CanvasForAnimationsDemo.Resources["AnimationToOpen"];
            storyboard.Begin();
            ButtonToStartAnimationOpen.Visibility = Visibility.Collapsed;
            ButtonToStartAnimationClose.Visibility = Visibility.Visible;
        }

        private void ButtonToStartAnimationOpen_Click(object sender, RoutedEventArgs e)
        {
            var storyboard = (Storyboard)CanvasForAnimationsDemo.Resources["AnimationToClose"];
            storyboard.Begin();
            ButtonToStartAnimationOpen.Visibility = Visibility.Visible;
            ButtonToStartAnimationClose.Visibility = Visibility.Collapsed;
        }


with this one:

Code: Select all

        private void ButtonToStartAnimationOpen_Click(object sender, RoutedEventArgs e)
        {
            var storyboard = (Storyboard)CanvasForAnimationsDemo.Resources["AnimationToOpen"];
            storyboard.Begin();
            ButtonToStartAnimationOpen.Visibility = Visibility.Collapsed;
            ButtonToStartAnimationClose.Visibility = Visibility.Visible;
        }

        private void ButtonToStartAnimationClose_Click(object sender, RoutedEventArgs e)
        {
            var storyboard = (Storyboard)CanvasForAnimationsDemo.Resources["AnimationToClose"];
            storyboard.Begin();
            ButtonToStartAnimationOpen.Visibility = Visibility.Visible;
            ButtonToStartAnimationClose.Visibility = Visibility.Collapsed;
        }


Thanks
Regards

Re: Animation not working?

Posted: Mon Jan 21, 2019 7:29 am
by Andreas
Indeed! Sometimes a second pair of eyes is all that's needed.
Thanks for taking the time to look at this! Stupid mistake....

Re: Animation not working?

Posted: Mon Jan 21, 2019 7:58 am
by JS-Support @Userware
No problem, thanks a lot!