Exemplo n.º 1
0
        private void CreateRotateAnimation(StrokeCollection strokes, Point centerOffset, Point from, Point to)
        {
            Rect         bound = strokes.GetBounds();
            AnimationObj obj   = AnimationEngine.AddDurationActionAnimation(strokes, AnimationActionType.Rotate, centerOffset, 5, from, to, true);

            obj.Begin();
        }
Exemplo n.º 2
0
        void CreateFlashAnimation(StrokeCollection strokes)
        {
            Rect  bound = strokes.GetBounds();
            Point from  = new Point(bound.Left + bound.Width / 2, bound.Top + bound.Height / 2);

            AnimationLibrary.Current.GetFlashAnimationSync(bound, (to) =>
            {
                AnimationObj obj = AnimationEngine.AddSeriesActionsAnimation(strokes, AnimationActionType.Translate, center, from, to);
                obj.Begin();
            });
        }
Exemplo n.º 3
0
        private void CreateBlinkAnimation(StrokeCollection strokes, AOrientation oritation)
        {
            Rect  bound = strokes.GetBounds();
            Point from  = new Point(1, 1);

            AnimationLibrary.Current.GetBlinkAnimationSync(bound, oritation, 2, 0.2, (to) =>
            {
                AnimationObj obj = AnimationEngine.AddSeriesActionsAnimation(strokes, AnimationActionType.Scale, center, from, to, true);
                obj.Begin();
            });
        }
Exemplo n.º 4
0
        private void CreateSwingAnimation(StrokeCollection strokes, Point centerOffset)
        {
            Rect  bound = strokes.GetBounds();
            Point from  = new Point(0, 0);

            AnimationLibrary.Current.GetSwingAnimationSync(bound, 1, 30, (to) =>
            {
                AnimationObj obj = AnimationEngine.AddSeriesActionsAnimation(strokes, AnimationActionType.Rotate, centerOffset, from, to, true);
                obj.Begin();
            });
        }
Exemplo n.º 5
0
        private void CreateShakeAnimation(StrokeCollection strokes, AOrientation oritation)
        {
            Rect  bound = strokes.GetBounds();
            Point from  = new Point(bound.Left + bound.Width / 2, bound.Top + bound.Height / 2);

            AnimationLibrary.Current.GetShakeAnimationSync(bound, oritation, 5, (to) =>
            {
                AnimationObj obj = AnimationEngine.AddSeriesActionsAnimation(strokes, AnimationActionType.Translate, center, from, to, true);
                obj.Begin();
            });
        }
Exemplo n.º 6
0
        void GoAnimation(StrokeCollection strokes, ATowardto atoward)
        {
            Rect  bound       = strokes.GetBounds();
            Rect  screenBound = new Rect(0, 0, this.ActualWidth, this.ActualHeight);
            Point from        = new Point(bound.Left + bound.Width / 2, bound.Top + bound.Height / 2);

            AnimationLibrary.Current.GetGoAnimationSync(bound, screenBound, atoward, false, (position) =>
            {
                AnimationObj ani1 = AnimationEngine.AddDurationActionAnimation(strokes, AnimationActionType.Translate, center, (int)position[0].Duration, from, position[0].To);
                AnimationObj ani2 = AnimationEngine.AddDurationActionAnimation(strokes, AnimationActionType.Translate, center, (int)position[2].Duration, position[1].To, position[2].To);


                ani1.AnimationCompleted += (sender, ex) =>
                {
                    Matrix maritx  = new Matrix();
                    double tChange = 0;
                    switch (atoward)
                    {
                    case ATowardto.ToLeft:
                    case ATowardto.ToRight:
                        tChange = position[1].To.X - position[0].To.X;
                        maritx.Translate(tChange, 0);
                        break;

                    case ATowardto.ToTop:
                    case ATowardto.ToBottom:
                        tChange = position[1].To.Y - position[0].To.Y;
                        maritx.Translate(0, tChange);
                        break;

                    default:
                        break;
                    }

                    strokes.Transform(maritx, false);
                    ani2.Begin();
                };

                ani2.AnimationCompleted += (sender, ex) =>
                {
                    Matrix maritx  = new Matrix();
                    double tChange = 0;
                    switch (atoward)
                    {
                    case ATowardto.ToLeft:
                    case ATowardto.ToRight:
                        tChange = position[1].To.X - position[0].To.X;
                        maritx.Translate(tChange, 0);
                        break;

                    case ATowardto.ToTop:
                    case ATowardto.ToBottom:
                        tChange = position[1].To.Y - position[0].To.Y;
                        maritx.Translate(0, tChange);
                        break;

                    default:
                        break;
                    }

                    strokes.Transform(maritx, false);
                    ani2.Begin();
                };

                ani1.Begin();
            });
        }