Skip to main content

Value Between

An expression editor function that calculates a value between two numbers based on a percentage.

Updated over 3 weeks ago

Overview

This function returns a number between two values based on a given percentage. It's useful for interpolation and animation calculations.


Parameters

valueBetween(number1, number2, percent, overshoot)

Number 1

The value at the start of the range.

Number 2

The value at the end of the range.

Percent

The percentage between the two values (0.0 to 1.0)

Pro tip: Use a percent Expression Editor property, like stack.scrollPercentY.

Overshoot

Boolean indicating whether values can exceed the range.


For example...

valueBetween(10, 20, 0.5, false)

Returns 15 (50% between 10 and 20).

Did this answer your question?