Пример #1
0
        /// <summary>
        /// The constructor creates a TimePeriod counter for use by an emitter. To
        /// add a TimePeriod counter to an emitter use the emitter's counter property.
        /// </summary>
        /// <param name="numParticles">The number of particles to emit over the full duration
        /// of the time period</param>
        /// <param name="duration">The duration of the time period. After this time is up the
        /// emitter will not release any more particles.</param>
        /// <param name="easeCategory">An easing category used to distribute the emission of the
        /// particles over the time period. If no easing function is passed a simple
        /// linear distribution is used in which particles are emitted at a constant
        /// rate over the time period.</param>
        /// <param name="easeType">An easing type used to distribute the emission of the
        /// particles over the time period. If no easing function is passed a simple
        /// linear distribution is used in which particles are emitted at a constant
        /// rate over the time period.</param>
        public TimePeriod(int numParticles, double duration, EaseCategory easeCategory, EaseType easeType)
        {
            m_particles = numParticles;
            m_duration  = duration;

            Category = easeCategory;
            EaseType = easeType;
        }
Пример #2
0
        public static EasingDelegate GetEasingFunction(EaseCategory easeCategory, EaseType easeType)
        {
            switch (easeCategory)
            {
            case EaseCategory.Linear:
                switch (easeType)
                {
                case EaseType.In:
                    return(new EasingDelegate(Linear.EaseIn));

                case EaseType.Out:
                    return(new EasingDelegate(Linear.EaseOut));

                case EaseType.InOut:
                    return(new EasingDelegate(Linear.EaseInOut));

                case EaseType.None:
                    return(new EasingDelegate(Linear.EaseNone));
                }
                break;

            case EaseCategory.Quadratic:
                switch (easeType)
                {
                case EaseType.In:
                    return(new EasingDelegate(Quadratic.EaseIn));

                case EaseType.Out:
                    return(new EasingDelegate(Quadratic.EaseOut));

                case EaseType.InOut:
                    return(new EasingDelegate(Quadratic.EaseInOut));

                case EaseType.None:
                    break;
                }
                break;

            case EaseCategory.Cubic:
                switch (easeType)
                {
                case EaseType.In:
                    return(new EasingDelegate(Cubic.EaseIn));

                case EaseType.Out:
                    return(new EasingDelegate(Cubic.EaseOut));

                case EaseType.InOut:
                    return(new EasingDelegate(Cubic.EaseInOut));

                case EaseType.None:
                    break;
                }
                break;

            case EaseCategory.Quartic:
                switch (easeType)
                {
                case EaseType.In:
                    return(new EasingDelegate(Quartic.EaseIn));

                case EaseType.Out:
                    return(new EasingDelegate(Quartic.EaseOut));

                case EaseType.InOut:
                    return(new EasingDelegate(Quartic.EaseInOut));

                case EaseType.None:
                    break;
                }
                break;

            case EaseCategory.Quintic:
                switch (easeType)
                {
                case EaseType.In:
                    return(new EasingDelegate(Quintic.EaseIn));

                case EaseType.Out:
                    return(new EasingDelegate(Quintic.EaseOut));

                case EaseType.InOut:
                    return(new EasingDelegate(Quintic.EaseInOut));

                case EaseType.None:
                    break;
                }
                break;

            case EaseCategory.Sine:
                switch (easeType)
                {
                case EaseType.In:
                    return(new EasingDelegate(Sine.EaseIn));

                case EaseType.Out:
                    return(new EasingDelegate(Sine.EaseOut));

                case EaseType.InOut:
                    return(new EasingDelegate(Sine.EaseInOut));

                case EaseType.None:
                    break;
                }
                break;

            case EaseCategory.Exponential:
                switch (easeType)
                {
                case EaseType.In:
                    return(new EasingDelegate(Exponential.EaseIn));

                case EaseType.Out:
                    return(new EasingDelegate(Exponential.EaseOut));

                case EaseType.InOut:
                    return(new EasingDelegate(Exponential.EaseInOut));

                case EaseType.None:
                    break;
                }
                break;

            case EaseCategory.Circular:
                switch (easeType)
                {
                case EaseType.In:
                    return(new EasingDelegate(Circular.EaseIn));

                case EaseType.Out:
                    return(new EasingDelegate(Circular.EaseOut));

                case EaseType.InOut:
                    return(new EasingDelegate(Circular.EaseInOut));

                case EaseType.None:
                    break;
                }
                break;

            case EaseCategory.Elastic:
                switch (easeType)
                {
                case EaseType.In:
                    return(new EasingDelegate(Elastic.EaseIn));

                case EaseType.Out:
                    return(new EasingDelegate(Elastic.EaseOut));

                case EaseType.InOut:
                    return(new EasingDelegate(Elastic.EaseInOut));

                case EaseType.None:
                    break;
                }
                break;

            case EaseCategory.Back:
                switch (easeType)
                {
                case EaseType.In:
                    return(new EasingDelegate(Back.EaseIn));

                case EaseType.Out:
                    return(new EasingDelegate(Back.EaseOut));

                case EaseType.InOut:
                    return(new EasingDelegate(Back.EaseInOut));

                case EaseType.None:
                    break;
                }
                break;

            case EaseCategory.Bounce:
                switch (easeType)
                {
                case EaseType.In:
                    return(new EasingDelegate(Bounce.EaseIn));

                case EaseType.Out:
                    return(new EasingDelegate(Bounce.EaseOut));

                case EaseType.InOut:
                    return(new EasingDelegate(Bounce.EaseInOut));

                case EaseType.None:
                    break;
                }
                break;
            }

            return(new EasingDelegate(Linear.EaseNone));
        }
Пример #3
0
        public static EnergyEasingDelegate GetEasingFunction(EaseCategory easeCategory, EaseType easeType)
        {
            switch (easeCategory)
            {
                case EaseCategory.Linear:
                    switch (easeType)
                    {
                        case EaseType.In:
                            return new EnergyEasingDelegate(Linear.EaseIn);
                        case EaseType.Out:
                            return new EnergyEasingDelegate(Linear.EaseOut);
                        case EaseType.InOut:
                            return new EnergyEasingDelegate(Linear.EaseInOut);
                        case EaseType.None:
                            return new EnergyEasingDelegate(Linear.EaseNone);
                    }
                    break;
                case EaseCategory.Quadratic:
                    switch (easeType)
                    {
                        case EaseType.In:
                            return new EnergyEasingDelegate(Quadratic.EaseIn);
                        case EaseType.Out:
                            return new EnergyEasingDelegate(Quadratic.EaseOut);
                        case EaseType.InOut:
                            return new EnergyEasingDelegate(Quadratic.EaseInOut);
                        case EaseType.None:
                            break;
                    }
                    break;
                case EaseCategory.Cubic:
                    switch (easeType)
                    {
                        case EaseType.In:
                            return new EnergyEasingDelegate(Cubic.EaseIn);
                        case EaseType.Out:
                            return new EnergyEasingDelegate(Cubic.EaseOut);
                        case EaseType.InOut:
                            return new EnergyEasingDelegate(Cubic.EaseInOut);
                        case EaseType.None:
                            break;
                    }
                    break;
                case EaseCategory.Quartic:
                    switch (easeType)
                    {
                        case EaseType.In:
                            return new EnergyEasingDelegate(Quartic.EaseIn);
                        case EaseType.Out:
                            return new EnergyEasingDelegate(Quartic.EaseOut);
                        case EaseType.InOut:
                            return new EnergyEasingDelegate(Quartic.EaseInOut);
                        case EaseType.None:
                            break;
                    }
                    break;
                case EaseCategory.Quintic:
                    switch (easeType)
                    {
                        case EaseType.In:
                            return new EnergyEasingDelegate(Quintic.EaseIn);
                        case EaseType.Out:
                            return new EnergyEasingDelegate(Quintic.EaseOut);
                        case EaseType.InOut:
                            return new EnergyEasingDelegate(Quintic.EaseInOut);
                        case EaseType.None:
                            break;
                    }
                    break;
                case EaseCategory.Sine:
                    switch (easeType)
                    {
                        case EaseType.In:
                            return new EnergyEasingDelegate(Sine.EaseIn);
                        case EaseType.Out:
                            return new EnergyEasingDelegate(Sine.EaseOut);
                        case EaseType.InOut:
                            return new EnergyEasingDelegate(Sine.EaseInOut);
                        case EaseType.None:
                            break;
                    }
                    break;
                case EaseCategory.Exponential:
                    switch (easeType)
                    {
                        case EaseType.In:
                            return new EnergyEasingDelegate(Exponential.EaseIn);
                        case EaseType.Out:
                            return new EnergyEasingDelegate(Exponential.EaseOut);
                        case EaseType.InOut:
                            return new EnergyEasingDelegate(Exponential.EaseInOut);
                        case EaseType.None:
                            break;
                    }
                    break;
                case EaseCategory.Circular:
                    switch (easeType)
                    {
                        case EaseType.In:
                            return new EnergyEasingDelegate(Circular.EaseIn);
                        case EaseType.Out:
                            return new EnergyEasingDelegate(Circular.EaseOut);
                        case EaseType.InOut:
                            return new EnergyEasingDelegate(Circular.EaseInOut);
                        case EaseType.None:
                            break;
                    }
                    break;
                case EaseCategory.Elastic:
                    switch (easeType)
                    {
                        case EaseType.In:
                            return new EnergyEasingDelegate(Elastic.EaseIn);
                        case EaseType.Out:
                            return new EnergyEasingDelegate(Elastic.EaseOut);
                        case EaseType.InOut:
                            return new EnergyEasingDelegate(Elastic.EaseInOut);
                        case EaseType.None:
                            break;
                    }
                    break;
                case EaseCategory.Back:
                    switch (easeType)
                    {
                        case EaseType.In:
                            return new EnergyEasingDelegate(Back.EaseIn);
                        case EaseType.Out:
                            return new EnergyEasingDelegate(Back.EaseOut);
                        case EaseType.InOut:
                            return new EnergyEasingDelegate(Back.EaseInOut);
                        case EaseType.None:
                            break;
                    }
                    break;
                case EaseCategory.Bounce:
                    switch (easeType)
                    {
                        case EaseType.In:
                            return new EnergyEasingDelegate(Bounce.EaseIn);
                        case EaseType.Out:
                            return new EnergyEasingDelegate(Bounce.EaseOut);
                        case EaseType.InOut:
                            return new EnergyEasingDelegate(Bounce.EaseInOut);
                        case EaseType.None:
                            break;
                    }
                    break;
            }

            return new EnergyEasingDelegate(Linear.EaseNone);
        }
Пример #4
0
        /// <summary>
        /// The constructor creates a TimePeriod counter for use by an emitter. To
        /// add a TimePeriod counter to an emitter use the emitter's counter property.
        /// </summary>
        /// <param name="numParticles">The number of particles to emit over the full duration
        /// of the time period</param>
        /// <param name="duration">The duration of the time period. After this time is up the
        /// emitter will not release any more particles.</param>
        /// <param name="easeCategory">An easing category used to distribute the emission of the
        /// particles over the time period. If no easing function is passed a simple
        /// linear distribution is used in which particles are emitted at a constant
        /// rate over the time period.</param>
        /// <param name="easeType">An easing type used to distribute the emission of the
        /// particles over the time period. If no easing function is passed a simple
        /// linear distribution is used in which particles are emitted at a constant
        /// rate over the time period.</param>
        public TimePeriod(int numParticles, double duration, EaseCategory easeCategory, EaseType easeType)
        {
            m_particles = numParticles;
            m_duration = duration;

            Category = easeCategory;
            EaseType = easeType;
        }
Пример #5
0
 /// <summary>
 /// The constructor creates an Age action for use by
 /// an emitter. To add an Age to all particles created by an emitter, use the
 /// emitter's addAction method.
 ///
 /// @see org.flintparticles.emitters.Emitter#addAction()
 ///
 /// </summary>
 /// <param name="easeCategory">The easing category to use to modify the energy
 /// curve over the lifetime of the particle</param>
 /// <param name="easeType">The easing type to use to modify the energy
 /// curve over the lifetime of the particle</param>
 public Age(EaseCategory easeCategory, EaseType easeType)
 {
     IsAutoDead = true;
     Category   = easeCategory;
     EaseType   = easeType;
 }