Phaser API Documentation

  Version: 

Member of: Phaser.Math

<static> SmoothStep(x, min, max)

Description:

Calculate a smooth interpolation percentage of x between min and max.

The function receives the number x as an argument and returns 0 if x is less than or equal to the left edge, 1 if x is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, between 0 and 1 otherwise.

Parameters:

name type description
x number

The input value.

min number

The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'.

max number

The maximum value, also known as the 'right edge', assumed greater than the 'left edge'.

Returns:
Description:

The percentage of interpolation, between 0 and 1.

Type:
  • number
Examples:
Since: 3.0.0
Source: src/math/SmoothStep.js (Line 7)