---
tags:
    - "Ease"
    - "Smooth"
    - "Damp"
    - "Interpolate"
    - "Lerp"
    - "Curve"
---

# Smooth Step

[Math](../index.md) / [Algebra](index.md) / **Smooth Step**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

Interpolates between two numbers easing in and out at both ends

## Parameters

| Name | Description |
| :--- | :---------- |
| From | The value returned when the ratio is zero |
| To | The value returned when the ratio is one |
| Ratio | How far the result is between both values |

## Code

```cs
using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Smooth Step")]
    [Category("Math/Algebra/Smooth Step")]

    [Description("Interpolates between two numbers easing in and out at both ends")]
    [Image(typeof(IconCurve), ColorTheme.Type.Yellow)]

    [Parameter("From", "The value returned when the ratio is zero")]
    [Parameter("To", "The value returned when the ratio is one")]
    [Parameter("Ratio", "How far the result is between both values")]

    [Keywords("Ease", "Smooth", "Damp", "Interpolate", "Lerp", "Curve")]

    [Serializable]
    public class TypeNumberMathSmoothStep : TypeNumber
    {
        [SerializeField] private GetNumber m_From = new GetNumber(0f);
        [SerializeField] private GetNumber m_To = new GetNumber(1f);
        [SerializeField] private GetNumber m_Ratio = new GetNumber(0.5f);

        public override double GetPreview(GameObject source) => Mathf.SmoothStep(
            (float) this.m_From.GetPreview(source),
            (float) this.m_To.GetPreview(source),
            (float) this.m_Ratio.GetPreview(source)
        );

        public override double Get(Args args)
        {
            return Mathf.SmoothStep(
                this.m_From.GetFloat(args),
                this.m_To.GetFloat(args),
                this.m_Ratio.GetFloat(args)
            );
        }

        public override string ToString()
        {
            return $"SmoothStep({this.m_From}, {this.m_To}, {this.m_Ratio})";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}

```

