Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Smooth Step#

Math / Algebra / Smooth Step

  • Can Read

  • Cannot Write

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#

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;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.