Example #1
0
        /*
         * =====
         * Private Methods
         * =====
         */

        /*
         *  Starts the next tween in the tweens List
         */
        private void StartNextTween(float delay = 0f)
        {
            //remove any listeners from previous tween
            if (activeTween != null)
            {
                activeTween.OnTweenProgress -= OnTweenProgress;
                activeTween.OnTweenComplete -= OnTweenComplete;
            }

            //grab the next tween step
            NDTweenTimelineStep step = (NDTweenTimelineStep)tweens[currentTween];

            // start the tweem
            if (step.isTo)
            {
                activeTween = NDTween.To(
                    step.target,
                    step.timeInSeconds,
                    step.position,
                    step.scale,
                    step.rotation,
                    step.color,
                    step.colorTarget,
                    step.easing,
                    step.delay + delay,
                    true,
                    true,
                    true,
                    step.isUi
                    );
            }
            else
            {
                activeTween = NDTween.From(
                    step.target,
                    step.timeInSeconds,
                    step.position,
                    step.scale,
                    step.rotation,
                    step.color,
                    step.colorTarget,
                    step.easing,
                    step.delay + delay,
                    true,
                    true,
                    true,
                    step.isUi
                    );
            }

            // listen to tween events for new tween
            activeTween.OnTweenComplete += OnTweenComplete;
            activeTween.OnTweenProgress += OnTweenProgress;

            if (OnTimelineStart != null)
            {
                OnTimelineStart();
            }
        }
Example #2
0
        public void AddFrom(GameObject target, float timeInSeconds, Vector3 position, Vector3 scale, Vector3 rotation, Color color, string colorTarget, Func <float, float> easing = null, float delay = 0f, bool isUI = false)
        {
            NDTweenTimelineStep step = new NDTweenTimelineStep();

            step.isTo          = false;
            step.target        = target;
            step.position      = position;
            step.scale         = scale;
            step.rotation      = rotation;
            step.color         = color;
            step.colorTarget   = colorTarget;
            step.timeInSeconds = timeInSeconds;
            step.easing        = easing;
            step.delay         = delay;
            step.isUi          = isUI;

            totalTweenTime += (timeInSeconds + delay);

            tweens.Add(step);
        }