示例#1
0
        /// <summary>
        /// Creates a new FROM tween and returns the <see cref="Tweener"/> representing it,
        /// or <c>null</c> if the tween was invalid (no valid property to tween was given).
        /// </summary>
        /// <param name="p_target">
        /// The tweening target (must be the object containing the properties or fields to tween).
        /// </param>
        /// <param name="p_duration">
        /// The duration in seconds of the tween.
        /// </param>
        /// <param name="p_parms">
        /// A <see cref="TweenParms"/> representing the tween parameters.
        /// You can pass an existing one, or create a new one inline via method chaining,
        /// like <c>new TweenParms().Prop("x",10).Loops(2).OnComplete(myFunction)</c>
        /// </param>
        /// <returns>
        /// The newly created <see cref="Tweener"/>,
        /// or <c>null</c> if the parameters were invalid.
        /// </returns>
        public static Tweener From(object p_target, float p_duration, TweenParms p_parms)
        {
            if (!initialized) Init();

            p_parms = p_parms.IsFrom();
            Tweener tw = new Tweener(p_target, p_duration, p_parms);

            // Check if tween is valid.
            if (tw.isEmpty) {
                return null;
            }

            AddTween(tw);
            // Immediately jump to position 0 to avoid flickering of objects before they're punched to FROM position.
            // p_isStartupIteration is set to FALSE to ignore callbacks.
            if (!tw._isPaused) {
                tw.Update(0, true, true, false, true);
            }
            return tw;
        }