コード例 #1
0
ファイル: MenuExample.cs プロジェクト: cschladetsch/colib
        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
ファイル: Commands~Tween.cs プロジェクト: cschladetsch/colib
        public static CommandDelegate ChangeBy(Ref <long> single, long offset, double duration, CommandEase ease = null)
        {
            CheckArgumentNonNull(single, "single");

            var reference = ToDoubleRef(single);

            return(Cmd.Sequence(
                       Cmd.Do(() => reference.Value = (double)single.Value),
                       Cmd.ChangeBy(reference, (double)offset, duration, ease)
                       ));
        }
コード例 #3
0
ファイル: MenuExample.cs プロジェクト: cschladetsch/colib
        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)
                );
        }