Пример #1
0
        private void AnimateIn()
        {
            List <CommandDelegate> _moves = new List <CommandDelegate>();

            Vector2 offset = new Vector2(
                Screen.width / 2f,
                Screen.height / 2f - RECT_HEIGHT * 1.5f * _buttons.Count / 2
                );

            float duration = 0.7f;
            float rotation = 360f;

            foreach (var button in _buttons)
            {
                _moves.Add(
                    Cmd.Parallel(
                        Cmd.ChangeBy(button.ToRotationRef(), rotation, duration, Ease.Smooth()),
                        Cmd.ChangeTo(button.ToPositionRef(), offset, duration, Ease.OutBounce())
                        )
                    );
                offset.y += RECT_HEIGHT * 1.5f;
                duration += 0.1f;
                rotation  = -rotation;
            }

            _queue.Sequence(
                Cmd.ChangeTo(_backButton.ToPositionRef(), new Vector2(-RECT_WIDTH / 2, RECT_HEIGHT / 2), 0.3f,
                             Ease.Smooth()),
                Cmd.Parallel(_moves.ToArray())
                );
        }
Пример #2
0
        IEnumerator <CommandDelegate> AnimateRects()
        {
            List <CommandDelegate> commands = new List <CommandDelegate>();

            commands.Add(
                Cmd.Sequence(
                    Cmd.ChangeTo(_rectRef, new Rect(50.0f, 100.0f, 300.0f, 200.0f), 4.0f, new Vector2(1.0f, 1.0f),
                                 Ease.OutBack(0.4)),
                    Cmd.WaitForSeconds(1.0f),
                    Cmd.ChangeTo(_rectRef, new Rect(150.0f, 50.0f, 450.0f, 400.0f), 2.0f, new Vector2(1.0f, 1.0f),
                                 Ease.InHermite()),
                    Cmd.ChangeTo(_rectRef, new Rect(0.0f, 0.0f, 350.0f, 300.0f), 1.0f, Ease.InCirc())
                    )
                );

            commands.Add(
                Cmd.Sequence(
                    Cmd.ChangeTo(_secondRectRef, new Rect(350.0f, 100.0f, 300.0f, 200.0f), 4.0f,
                                 new Vector2(0.0f, 0.0f), Ease.OutQuad()),
                    Cmd.ChangeTo(_secondRectRef, new Rect(Screen.width, Screen.height, 0.0f, 0.0f), 3.0f,
                                 Ease.OutElastic())
                    )
                );

            yield return(Cmd.Parallel(commands.ToArray()));
        }
Пример #3
0
        public static CommandDelegate ChangeTo(Ref <int> single, int endValue, double duration, CommandEase ease = null)
        {
            CheckArgumentNonNull(single, "single");

            var reference = ToDoubleRef(single);

            return(Cmd.Sequence(
                       Cmd.Do(() => reference.Value = (double)single.Value),
                       Cmd.ChangeTo(reference, (double)endValue, duration, ease)
                       ));
        }
Пример #4
0
        private void AnimateOut()
        {
            if (_hidingMenu)
            {
                return;
            }

            _hidingMenu = true;
            Vector2 origin = new Vector2(Screen.width / 2f, -RECT_HEIGHT);

            List <CommandDelegate> _moves = new List <CommandDelegate>();

            foreach (var button in _buttons)
            {
                _moves.Add(Cmd.ChangeTo(button.ToPositionRef(), origin, 0.7f, Ease.Smooth()));
            }

            _queue.Sequence(
                Cmd.Parallel(_moves.ToArray()),
                Cmd.ChangeBy(_backButton.ToPositionRef(), new Vector2(RECT_WIDTH, 0f), 0.3f, Ease.Smooth()),
                Cmd.Do(() => _hidingMenu = false)
                );
        }