Ejemplo n.º 1
0
        public void AnimateEntrance()
        {
            var sb = new StoryBoard();
            foreach (var element in Children.Where(e => e.EntranceAnimation != null))
            {
                sb.AddAnimation(element.EntranceAnimation);
            }

            // stub animation for redraw
            sb.AddAnimation(new FunctionBasedAnimation(FunctionBasedAnimation.Functions.Linear)
                                {
                                    From = 0,
                                    To = 100,
                                    Duration = AnimationDuration,
                                    OnAnimation = v => DirectDraw(- _verticalOffset),
                                });
            sb.AnimateSync();

            // not always animation completes good. after animation correct tiles positions.
            foreach (var element in Children)
                element.Location = (element as TileWrapper).GetScreenRect().Location;
            DirectDraw(- _verticalOffset);

            FreezeUpdate = true;
        }
Ejemplo n.º 2
0
        public static void Play(params IAnimation[] animations)
        {
            var sb = new StoryBoard();

            sb.AddAnimations(animations);
            sb.AnimateSync();
        }
Ejemplo n.º 3
0
        public static void Play(IAnimation animation)
        {
            var sb = new StoryBoard();

            sb.AddAnimation(animation);
            sb.AnimateSync();
        }
Ejemplo n.º 4
0
        public static void BeginPlay(params IAnimation[] animations)
        {
            bool processed = false;

            if (sb != null)
            {
                lock (sb)
                {
                    if (sb != null)
                    {
                        sb.AddAnimations(animations);
                        processed = true;
                    }
                }
            }
            if (!processed)
            {
                sb = new StoryBoard();
                sb.AddAnimations(animations);
                sb.BeginAnimate(() => sb = null);
            }
        }
Ejemplo n.º 5
0
        public static void BeginPlay(params IAnimation[] animations)
        {
            bool processed = false;

            if (sb != null)
            {
                lock (sb)
                {
                    if (sb != null)
                    {
                        sb.AddAnimations(animations);
                        processed = true;
                    }
                }
            }
            if (!processed)
            {
                sb = new StoryBoard();
                sb.AddAnimations(animations);
                sb.BeginAnimate(() => sb = null);
            }
        }
Ejemplo n.º 6
0
 public static void Play(params IAnimation[] animations)
 {
     var sb = new StoryBoard();
     sb.AddAnimations(animations);
     sb.AnimateSync();
 }
Ejemplo n.º 7
0
 public static void Play(IAnimation animation)
 {
     var sb = new StoryBoard();
     sb.AddAnimation(animation);
     sb.AnimateSync();
 }
Ejemplo n.º 8
0
        //!! todo - потом переписать не на анимацию каждой плитки, а на централизовано управляемую анимацию
        //!! todo - и не использовать анимацию контрола, а делать все внутри
        public void AnimateExit()
        {
            FreezeUpdate = false;

            var scrollRect = new Rectangle(0, _verticalOffset, Bounds.Width, Bounds.Height);
            var sb = new StoryBoard();

            foreach (var curTile in ChildrenEnumerable)
            {
                var tileWrapper = curTile as TileWrapper;

                if (curTile.Bounds.IntersectsWith(scrollRect))
                {
                    curTile.ExitAnimation = GetExitAnimation(tileWrapper);
                    curTile.EntranceAnimation = GetEntranceAnimation(tileWrapper);

                    sb.AddAnimation(curTile.ExitAnimation);
                }
                else
                {
                    curTile.EntranceAnimation = null;
                    curTile.ExitAnimation = null;
                }
            }

            // stub animation for redraw
            sb.AddAnimation(new FunctionBasedAnimation(FunctionBasedAnimation.Functions.Linear)
                                {
                                    From = 0,
                                    To = 100,
                                    Duration = AnimationDuration,
                                    OnAnimation = v => DirectDraw(- _verticalOffset),
                                });
            sb.AnimateSync();
        }