Пример #1
0
        /// <summary>
        /// Overriden method to add animations and create gameboard.
        /// </summary>
        protected override async void OnAppearing()
        {
            _gameBoard = await Task.Run(() => GameBoard.CreateAsync(AlternativeIcons));

            base.OnAppearing();

            // Showing animations unless user has chosen to skip starting animations
            // from the app's settings or app is resuming.
            if (!App.AppResumed && !App.SkipStartingAnimations)
            {
                await Task.WhenAll(
                    _gameBoardGrid.FadeTo(1, 1000, Easing.Linear),
                    _gameBoardGrid.RotateTo(360, 1500, Easing.CubicOut),
                    _gameBoardGrid.ScaleTo(1.1, 1500, Easing.Linear)
                    );

                await Task.WhenAny(
                    _gameBoardGrid.ScaleTo(1, 2000, Easing.Linear),
                    AppTitle.FadeTo(1, 1500),
                    AppTitle.ScaleTo(1, 1500, Easing.SinInOut)
                    );

                await Task.WhenAll(
                    SettingsIcon.FadeTo(1, 1000),
                    SettingsIcon.ScaleTo(1, 1500, Easing.SpringOut),
                    SettingsIcon.RotateTo(720, 2000, Easing.SinOut),
                    CalculateButton.FadeTo(1, 1000),
                    CalculateButton.ScaleTo(1, 1500, Easing.SpringOut)
                    );

                // Rotating icon back to 0, so that further animations work as intended.
                SettingsIcon.Rotation = 0;
            }
        }
Пример #2
0
        /// <summary>
        /// Animating settings icon, when icon is pressed.
        /// </summary>
        /// <returns></returns>
        public async void AnimateSettingsIconAsync()
        {
            await Task.WhenAll(
                SettingsIcon.ScaleTo(1.2, 500, Easing.Linear),
                SettingsIcon.RotateTo(180, 500, Easing.SinOut)
                );

            await Task.WhenAll(
                SettingsIcon.ScaleTo(1.0, 500, Easing.Linear),
                SettingsIcon.RotateTo(0, 500, Easing.SinOut)
                );
        }