コード例 #1
0
        public static async Task <Storyboard> FrameSwipe_Base(Frame frame, object content, ExpandDirection direction, bool useFade, bool fadeIn)
        {
            return(await Application.Current.Dispatcher.InvokeAsync(() =>
            {
                AnimationArgs animationArgs = new AnimationArgs();

                SetCurrentPage(animationArgs, frame, content);
                StorePageValues(animationArgs);
                SetPageValuesForAnimation(animationArgs);

                Storyboard storyboard = new Storyboard();
                Duration duration = new Duration(TimeSpan.FromMilliseconds(GetSwipeSpeed()));

                if (useFade)
                {
                    var fadeAnim = GetFadeAnimation(duration, fadeIn);
                    storyboard.Children.Add(fadeAnim);
                    Storyboard.SetTargetProperty(fadeAnim, new PropertyPath(Frame.OpacityProperty));
                    Storyboard.SetTarget(fadeAnim, frame);
                }

                var swipeAnim = GetSwipeAnimation(animationArgs, GetSwipeSize(), duration, direction);
                storyboard.Children.Add(swipeAnim);
                Storyboard.SetTargetProperty(swipeAnim, new PropertyPath(Frame.MarginProperty));
                Storyboard.SetTarget(swipeAnim, frame);
                return storyboard;
            }));
        }
コード例 #2
0
        private static ThicknessAnimation GetSwipeAnimation(AnimationArgs animationArgs, double size, Duration duration, ExpandDirection direction)
        {
            ThicknessAnimation animation0 = new ThicknessAnimation();

            switch (direction)
            {
            case ExpandDirection.Left:
                animation0.From = new Thickness(-size, 0, size, 0);
                break;

            case ExpandDirection.Right:
                animation0.From = new Thickness(size, 0, -size, 0);
                break;

            case ExpandDirection.Up:
                animation0.From = new Thickness(0, -size, 0, size);
                break;

            case ExpandDirection.Down:
                animation0.From = new Thickness(0, size, 0, -size);
                break;
            }

            animation0.To         = new Thickness(0, 0, 0, 0);
            animation0.Completed += (sender, e) =>
            {
                ResetPageValues(animationArgs);
            };
            animation0.Duration       = duration;
            animation0.EasingFunction = GetSwipeAnimationEasingFunction();
            return(animation0);
        }
コード例 #3
0
ファイル: FleetView.cs プロジェクト: ManuelJager/ProjectExa
        private void OnUnitsFull(AnimationArgs args)
        {
            unitCountText.fontSize = args.fontSize.active;
            unitCountText.DOFontSize(args.fontSize.inactive, args.animTime)
            .Replace(ref fontSizeTween);

            unitCountText.color = args.color.active;
            unitCountText.DOColor(args.color.inactive, args.animTime)
            .Replace(ref colorTween);
        }
コード例 #4
0
 private static void ResetPageValues(AnimationArgs args)
 {
     if (args.CurrentContent == null)
     {
         return;
     }
     args.CurrentContent.MinWidth  = args.stored_min_width;
     args.CurrentContent.MinHeight = args.stored_min_height;
     args.CurrentContent.MaxWidth  = args.stored_max_width;
     args.CurrentContent.MaxHeight = args.stored_max_height;
 }
コード例 #5
0
        protected virtual void Animate(AnimationArgs args, Vector2 initialPos, Vector2 targetPos)
        {
            canvasGroup.DOFade(args.targetAlpha, duration)
            .SetEase(args.ease)
            .Replace(ref alphaTween);

            rectTransform.anchoredPosition = initialPos;
            rectTransform.DOAnchorPos(targetPos, duration)
            .SetEase(args.ease)
            .Replace(ref positionTween);
        }
コード例 #6
0
        private static void SetCurrentPage(AnimationArgs animationArgs, Frame frame, object content)
        {
            if (content is Page)
            {
                animationArgs.CurrentContent = content as Page;
            }
            else
            {
                animationArgs.CurrentContent = null;
            }

            animationArgs.stored_width  = frame.ActualWidth;
            animationArgs.stored_height = frame.ActualHeight;
        }
コード例 #7
0
ファイル: AnimationHandler.cs プロジェクト: Trege/PonyTest
 void OnAnimationStart(object sender, AnimationArgs args)
 {
     //Debug.Log(name + ": Starting animation.");
 }
コード例 #8
0
ファイル: AnimationHandler.cs プロジェクト: Trege/PonyTest
 void OnAnimationEnd(object sender, AnimationArgs args)
 {
     //Debug.Log(name + ": Done animating.");
 }