Exemplo n.º 1
0
        /// <summary>
        /// Performs a squash and stretch animation, while changing from a target scale.
        /// </summary>
        /// <param name="scale">The value to animate.</param>
        /// <param name="startScale">The scale to animate from.</param>
        /// <param name="amplitude">The amplitude of a squash and strech</param>
        /// <param name="duration">The duration of the animation</param>
        /// <param name="normal"> The normal of the animation. </param>
        /// <param name="tangent"> The tangent of the animation. </param>
        public static CommandDelegate ScaleSquashAndStretchFrom(Ref <Vector3> scale, Vector3 startScale, float amplitude,
                                                                double duration, Vector3 normal, Vector3 tangent)
        {
            CheckArgumentNonNull(scale, "scale");
            Vector3 targetScale = Vector3.zero;

            return(Cmd.Sequence(
                       Cmd.Do(() =>
            {
                targetScale = scale.Value;
                scale.Value = startScale;
            }),
                       Cmd.Defer(() => Cmd.ScaleSquashAndStretchTo(scale, targetScale, amplitude, duration, normal, tangent))
                       ));
        }