コード例 #1
0
        public static async Task SlideAndFadeInFromDirection(this FrameworkElement frameworkElement, eDirection direction, float seconds = _DEFAULT_SECONDS, float decelerationRatio = _DEFAULT_DECELERATION_RATIO, bool keepMargin = true, IEasingFunction easingFunction = null, double width = 0, double height = 0)
        {
            // Create the animation.
            Storyboard storyboard = new Storyboard();

            switch (direction)
            {
            case eDirection.None:
                break;

            case eDirection.Left:
            case eDirection.Right:
                storyboard.AddSlideFromDirection(direction, seconds, width == 0 ? frameworkElement.ActualWidth : width, decelerationRatio, keepMargin, easingFunction);
                break;

            case eDirection.Top:
            case eDirection.Bottom:
                storyboard.AddSlideFromDirection(direction, seconds, height == 0 ? frameworkElement.ActualHeight : height, decelerationRatio, keepMargin, easingFunction);
                break;

            default:
                break;
            }
            storyboard.AddFadeIn(seconds, decelerationRatio, easingFunction);

            await PlayStoryboard(frameworkElement, storyboard, seconds);
        }