当前位置: 首页>>代码示例>>C#>>正文


C# EasingType类代码示例

本文整理汇总了C#中EasingType的典型用法代码示例。如果您正苦于以下问题:C# EasingType类的具体用法?C# EasingType怎么用?C# EasingType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EasingType类属于命名空间,在下文中一共展示了EasingType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FunctionFromType

 private static Func<decimal, decimal> FunctionFromType(EasingType easing)
 {
     switch (easing)
     {
         case EasingType.Constant:
             return x => 1;
         case EasingType.Linear:
             return x => x;
         case EasingType.Quadratic:
             return x => DMath.Pow(x, 2);
         case EasingType.Cubic:
             return x => DMath.Pow(x, 3);
         case EasingType.Quartic:
             return x => DMath.Pow(x, 4);
         case EasingType.Quintic:
             return x => DMath.Pow(x, 5);
         case EasingType.Sinusoidal:
             return x => 1 - DMath.Cos(x * DMath.PI / 2); // Wait... That's not Sine!
         case EasingType.Exponential:
             return x => DMath.Pow(x, 5);
         case EasingType.Circular:
             return x => 1 - DMath.Sqrt(1 - x * x);
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
开发者ID:silky,项目名称:sledge,代码行数:26,代码来源:Easing.cs

示例2: Ease

 public Ease(EasingType type, float duration, object toEase, string mask)
 {
     _type = type;
     _startTime = Time.time;
     _value = toEase;
     _mask = mask;
 }
开发者ID:shawnmiller,项目名称:RoomWithTheMoose,代码行数:7,代码来源:Ease.cs

示例3: Ease

    // Adapted from source : http://www.robertpenner.com/easing/

    public static float Ease(double linearStep, float acceleration, EasingType type) {
      float easedStep = acceleration > 0 ? EaseIn(linearStep, type) :
                acceleration < 0 ? EaseOut(linearStep, type) :
                (float) linearStep;

      return MathHelper.Lerp(linearStep, easedStep, Math.Abs(acceleration));
    }
开发者ID:llafuente,项目名称:unity-platformer,代码行数:9,代码来源:Easing.cs

示例4: Interp

 public static Vector3 Interp(Spline.Path pts, float t, EasingType ease, bool easeIn, bool easeOut)
 {
     t = Spline.Ease(t, ease, easeIn, easeOut);
     if (pts.Length == 0)
     {
         return Vector3.zero;
     }
     if (pts.Length == 1)
     {
         return pts[0];
     }
     if (pts.Length == 2)
     {
         return Vector3.Lerp(pts[0], pts[1], t);
     }
     if (pts.Length == 3)
     {
         return QuadBez.Interp(pts[0], pts[2], pts[1], t);
     }
     if (pts.Length == 4)
     {
         return CubicBez.Interp(pts[0], pts[3], pts[1], pts[2], t);
     }
     return CRSpline.Interp(Spline.Wrap(pts), t);
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:25,代码来源:Spline.cs

示例5: EaseOut

 public static float EaseOut(double linearStep, EasingType type)
 {
   switch (type)
   {
     case EasingType.None:
       return 1f;
     case EasingType.Linear:
       return (float) linearStep;
     case EasingType.Sine:
       return Easing.Sine.EaseOut(linearStep);
     case EasingType.Quadratic:
       return Easing.Power.EaseOut(linearStep, 2);
     case EasingType.Cubic:
       return Easing.Power.EaseOut(linearStep, 3);
     case EasingType.Quartic:
       return Easing.Power.EaseOut(linearStep, 4);
     case EasingType.Quintic:
       return Easing.Power.EaseOut(linearStep, 5);
     case EasingType.Sextic:
       return Easing.Power.EaseOut(linearStep, 6);
     case EasingType.Septic:
       return Easing.Power.EaseOut(linearStep, 7);
     case EasingType.Octic:
       return Easing.Power.EaseOut(linearStep, 8);
     case EasingType.Nonic:
       return Easing.Power.EaseOut(linearStep, 9);
     case EasingType.Decic:
       return Easing.Power.EaseOut(linearStep, 10);
     case EasingType.Circular:
       return Easing.Circular.EaseOut(linearStep);
     default:
       throw new NotImplementedException();
   }
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:34,代码来源:Easing.cs

示例6: EaseOut

 public static float EaseOut(double linearStep, EasingType type)
 {
     switch (type)
     {
         case EasingType.Step:       return linearStep < 0.5 ? 0 : 1;
         case EasingType.Linear:     return (float)linearStep;
         case EasingType.Sine:       return Sine.EaseOut(linearStep);
         case EasingType.Quadratic:  return Power.EaseOut(linearStep, 2);
         case EasingType.Circular:   return Circular.EaseOut(linearStep);
     }
     throw new NotImplementedException();
 }
开发者ID:zulis,项目名称:Cubica,代码行数:12,代码来源:Easing.cs

示例7: EaseInOut

        public static float EaseInOut(double linearStep, EasingType type) {

            linearStep = Mathf.Clamp01((float)linearStep);
            switch (type) {
                case EasingType.Step: return linearStep < 0.5 ? 0 : 1;
                case EasingType.Linear: return (float)linearStep;
                case EasingType.Sine: return Sine.EaseInOut(linearStep);
                case EasingType.Quadratic: return Power.EaseInOut(linearStep, 2);
                case EasingType.Cubic: return Power.EaseInOut(linearStep, 3);
                case EasingType.Quartic: return Power.EaseInOut(linearStep, 4);
                case EasingType.Quintic: return Power.EaseInOut(linearStep, 5);
            }
            throw new NotImplementedException();
        }
开发者ID:Maxii,项目名称:UnityEntry,代码行数:14,代码来源:Easing.cs

示例8: GizmoDraw

 public static void GizmoDraw(Vector3[] pts, float t, EasingType ease, bool easeIn, bool easeOut)
 {
     Gizmos.color = Color.white;
     Vector3 to = Spline.Interp(pts, 0f);
     for (int i = 1; i <= 20; i++)
     {
         float t2 = (float)i / 20f;
         Vector3 vector = Spline.Interp(pts, t2, ease, easeIn, easeOut);
         Gizmos.DrawLine(vector, to);
         to = vector;
     }
     Gizmos.color = Color.blue;
     Vector3 vector2 = Spline.Interp(pts, t, ease, easeIn, easeOut);
     Gizmos.DrawLine(vector2, vector2 + Spline.Velocity(pts, t, ease, easeIn, easeOut));
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:15,代码来源:Spline.cs

示例9: MakeInvisible

    // Set this object up to fade-out
    public void MakeInvisible(float t = -1.0f, float alpha = 0.0f, EasingType easingType=EasingType.Linear, bool force = false)
    {
        alphaEaseType = easingType;
        alpha = Mathf.Max(0.0f, alpha);
        alpha = Mathf.Min(1.0f, alpha);

        if( t == 0.0f ) {
            if (transform.renderer.material.HasProperty("_Color") ) {
                if (GetComponent<DynamicText>() != null) {
                    DynamicText dt = GetComponent<DynamicText>();
                    transitionStartColor = dt.color;
                    transitionEndColor = new Color(transparantColor.r, transparantColor.g, transparantColor.b, alpha);
                    oldAlpha = dt.color.a;
                    dt.color = transitionEndColor;
                } else {
                transitionStartColor = renderer.material.color;
                    transitionEndColor = new Color(transparantColor.r, transparantColor.g, transparantColor.b, alpha);
                    oldAlpha = renderer.material.color.a;
                    renderer.material.color = transitionEndColor;
                }
            } else {
                oldAlpha = transform.renderer.material.GetFloat("_alpha_blend");
                transform.renderer.material.SetFloat("_alpha_blend", alpha);
            }
            m_isVisible = alpha > 0.0f;
        //			return;
        }

        duration = (t >= 0.0f ? t : defaultDuration);

        stage = 0F;

        if (transform.renderer.material.HasProperty("_Color") ) {
            if (GetComponent<DynamicText>() != null) {
                transitionStartColor = GetComponent<DynamicText>().color;
                oldAlpha = transitionStartColor.a;
            } else {
                transitionStartColor = renderer.material.color;
                oldAlpha = renderer.material.color.a;
            }
            transitionEndColor = new Color(transparantColor.r, transparantColor.g, transparantColor.b, alpha);
        } else {
            oldAlpha = transform.renderer.material.GetFloat("_alpha_blend");
        }
        targetAlpha = alpha;
        m_isTransitioning = true;
    }
开发者ID:phoenixperry,项目名称:NYHS_1,代码行数:48,代码来源:SmoothAlpha.cs

示例10: Ease

 /// <summary>
 /// Returns the output of an easing function for a specific time.
 /// </summary>
 /// <param name="t">The normalized time</param>
 /// <param name="easingType">The easing function to use</param>
 /// <returns>The eased output</returns>
 public static float Ease(float t, EasingType easingType)
 {
     switch (easingType)
     {
         case EasingType.ExponentialIn: return Functions.ExponentialIn(t);
         case EasingType.ExponentialOut: return Functions.ExponentialOut(t);
         case EasingType.ExponentialInOut: return Functions.ExponentialInOut(t);
         case EasingType.ExponentialOutIn: return Functions.ExponentialOutIn(t);
         case EasingType.SineIn: return Functions.SineIn(t);
         case EasingType.SineOut: return Functions.SineOut(t);
         case EasingType.SineInOut: return Functions.SineInOut(t);
         case EasingType.SineOutIn: return Functions.SineOutIn(t);
         case EasingType.CubicIn: return Functions.CubicIn(t);
         case EasingType.CubicOut: return Functions.CubicOut(t);
         case EasingType.CubicInOut: return Functions.CubicInOut(t);
         case EasingType.CubicOutIn: return Functions.CubicOutIn(t);
         case EasingType.QuinticIn: return Functions.QuinticIn(t);
         case EasingType.QuinticOut: return Functions.QuinticOut(t);
         case EasingType.QuinticInOut: return Functions.QuinticInOut(t);
         case EasingType.QuinticOutIn: return Functions.QuinticOutIn(t);
         case EasingType.CircularIn: return Functions.CircularIn(t);
         case EasingType.CircularOut: return Functions.CircularOut(t);
         case EasingType.CircularInOut: return Functions.CircularInOut(t);
         case EasingType.CircularOutIn: return Functions.CircularOutIn(t);
         case EasingType.ElasticIn: return Functions.ElasticIn(t);
         case EasingType.ElasticOut: return Functions.ElasticOut(t);
         case EasingType.ElasticInOut: return Functions.ElasticInOut(t);
         case EasingType.ElasticOutIn: return Functions.ElasticOutIn(t);
         case EasingType.QuadraticIn: return Functions.QuadraticIn(t);
         case EasingType.QuadraticOut: return Functions.QuadraticOut(t);
         case EasingType.QuadraticInOut: return Functions.QuadraticInOut(t);
         case EasingType.QuadraticOutIn: return Functions.QuadraticOutIn(t);
         case EasingType.QuarticIn: return Functions.QuarticIn(t);
         case EasingType.QuarticOut: return Functions.QuarticOut(t);
         case EasingType.QuarticInOut: return Functions.QuarticInOut(t);
         case EasingType.QuarticOutIn: return Functions.QuarticOutIn(t);
         case EasingType.BackIn: return Functions.BackIn(t);
         case EasingType.BackOut: return Functions.BackOut(t);
         case EasingType.BackInOut: return Functions.BackInOut(t);
         case EasingType.BackOutIn: return Functions.BackOutIn(t);
         case EasingType.BounceIn: return Functions.BounceIn(t);
         case EasingType.BounceOut: return Functions.BounceOut(t);
         case EasingType.BounceInOut: return Functions.BounceInOut(t);
         case EasingType.BounceOutIn: return Functions.BounceOutIn(t);
         default: return Functions.Linear(t);
     }
 }
开发者ID:jjstopforth,项目名称:duelistic,代码行数:53,代码来源:Easing.cs

示例11: Animation

        public Animation(object obj, string propName, float startValue, float endValue, EaseFunctionDelegate easeFunc,
                         EasingType easeType)
        {
            if(propName != null)
            {
                _property = obj.GetType().GetProperty(propName);
            }
            else
            {
                _property = null;
            }

            PropertyName = propName;
            _obj = obj;
            _startValue = startValue;
            _endValue = endValue;
            _easeFunc = easeFunc;
            _easeType = easeType;
        }
开发者ID:hortont424,项目名称:sand,代码行数:19,代码来源:Animation.cs

示例12: Vibrate

 public override void Vibrate(VibrationMotor motor, double amount, float duration, EasingType easingType)
 {
     throw new NotSupportedException();
 }
开发者ID:Collegiennes,项目名称:pico,代码行数:4,代码来源:GamepadsManager.cs

示例13: EaseInOut

 public static float EaseInOut(double linearStep, EasingType easeInType, EasingType easeOutType)
 {
     linearStep = Mathf.Clamp01((float)linearStep);
     return linearStep < 0.5 ? EaseInOut(linearStep, easeInType) : EaseInOut(linearStep, easeOutType);
 }
开发者ID:Maxii,项目名称:POC.ToUnity,代码行数:5,代码来源:Easing.cs

示例14: EaseWithReturn

	public static float EaseWithReturn(double linearStep, EasingType ease)
	{
		linearStep = (double)Mathf.Clamp01((float)linearStep);
		var amount = linearStep > 0.5 ? 1+((0.5-linearStep)*2) : (linearStep * 2);
		return EaseOut(amount, ease);
	}
开发者ID:Maxii,项目名称:POC.ToUnity,代码行数:6,代码来源:Easing.cs

示例15: EaseInOut

 public static float EaseInOut ( double linearStep, EasingType easeInType, EasingType easeOutType )
 {
     return linearStep < 0.5 ? EaseInOut ( linearStep, easeInType ) : EaseInOut ( linearStep, easeOutType );
 }
开发者ID:bbqchickenrobot,项目名称:WPFLight,代码行数:4,代码来源:Easing.cs


注:本文中的EasingType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。