コード例 #1
0
 /// <summary>
 /// Sets the alpha range of this particle type.
 /// </summary>
 /// <param name="start">The starting alpha.</param>
 /// <param name="finish">The finish alpha.</param>
 /// <param name="ease">Optional easer function.</param>
 /// <returns>This ParticleType object.</returns>
 public ParticleType SetAlpha(float start = 1, float finish = 0, Emitter.Easer ease = null)
 {
     start       = start < 0 ? 0 : (start > 1 ? 1 : start);
     finish      = finish < 0 ? 0 : (finish > 1 ? 1 : finish);
     _alpha      = start;
     _alphaRange = finish - start;
     _alphaEase  = ease;
     return(this);
 }
コード例 #2
0
 /// <summary>
 /// Defines the motion range for this particle type based on the vector.
 /// </summary>
 /// <param name="x">X distance to move.</param>
 /// <param name="y">Y distance to move.</param>
 /// <param name="duration">Particle duration.</param>
 /// <param name="durationRange">Random amount to add to the particle's duration.</param>
 /// <param name="ease">Optional easer function.</param>
 /// <returns>This ParticleType object.</returns>
 public ParticleType SetMotionVector(float x, float y, float duration, float durationRange = 0, Emitter.Easer ease = null)
 {
     _angle         = (float)Math.Atan2(y, x);
     _angleRange    = 0;
     _duration      = duration;
     _durationRange = durationRange;
     _ease          = ease;
     return(this);
 }
コード例 #3
0
 /// <summary>
 /// Defines the motion range for this particle type.
 /// </summary>
 /// <param name="angle">Launch Direction.</param>
 /// <param name="distance">Distance to travel.</param>
 /// <param name="duration">Particle duration.</param>
 /// <param name="angleRange">Random amount to add to the particle's direction.</param>
 /// <param name="distanceRange">Random amount to add to the particle's distance.</param>
 /// <param name="durationRange">Random amount to add to the particle's duration.</param>
 /// <param name="ease">Optional easer function.</param>
 /// <returns>This ParticleType object.</returns>
 public ParticleType SetMotion(float angle, float distance, float duration, float angleRange = 0, float distanceRange = 0, float durationRange = 0, Emitter.Easer ease = null)
 {
     _angle         = angle * FP.RAD;
     _distance      = distance;
     _duration      = duration;
     _angleRange    = angleRange * FP.RAD;
     _distanceRange = distanceRange;
     _durationRange = durationRange;
     _ease          = ease;
     return(this);
 }
コード例 #4
0
        /// <summary>
        /// Sets the color range of this particle type.
        /// </summary>
        /// <param name="start">The starting color.</param>
        /// <param name="finish">The finish color.</param>
        /// <param name="ease">Optional easer function.</param>
        /// <returns>This ParticleType object.</returns>
        public ParticleType SetColor(Color start, Color finish, Emitter.Easer ease = null)
        {
            uint s = FP.HexColor(start);
            uint f = FP.HexColor(finish);

            s          &= 0xFFFFFF;
            f          &= 0xFFFFFF;
            _red        = (s >> 16 & 0xFF) / 255.0f;
            _green      = (s >> 8 & 0xFF) / 255.0f;
            _blue       = (s & 0xFF) / 255.0f;
            _redRange   = (f >> 16 & 0xFF) / 255.0f - _red;
            _greenRange = (f >> 8 & 0xFF) / 255.0f - _green;
            _blueRange  = (f & 0xFF) / 255.0f - _blue;

            _colorEase = ease;
            return(this);
        }