Mix Numbers

https://user-images.githubusercontent.com/14288520/189170552-03896cda-6344-4748-924e-ec779cd76092.png

Functionality

This node mixes two values using a given factor and a selected interpolation and easing functions.

For a factor of 0.0 it outputs the first value while the factor of 1.0 it outputs the last value. For every factor value between 0-1 it will output a value between the first and second input value. (*)

Lite version of Number->Mix Inputs.

Note: (*) The Back and Elastic interpolations will generate outputs that are not strictly confined to the first-second value interval, but they will output values that start at first and end at second value.

Inputs & Parameters

All parameters except for Type, Interpolation and Easing can be given by the node or an external input.

This node has the following parameters:

Parameter

Type

Default

Description

Type

Enum:

Int Float

Float

Type of inputs values to interpolate. When Float is selected the input value1 and value2 expect float values

When Int is selected the input value1 and value2 expect int values.

Interpolation

Enum:

  • Linear

  • Sinusoidal

  • Quadratic

  • Cubic

  • Quadric

  • Quintic

  • Exponential

  • Circular

  • Back

  • Bounce

  • Elastic

Linear

Type of interpolation.

  • f(x) ~ x

  • f(x) ~ sin(x)

  • f(x) ~ x*2

  • f(x) ~ x^3

  • f(x) ~ x^4

  • f(x) ~ x^5

  • f(x) ~ e^x

  • f(x) ~ sqrt(1-x*x)

  • f(x) ~ x*x*x - x*sin(x)

  • f(x) ~ series of geometric progression parabolas

  • f(x) ~ sin(x) * e^x

Easing

Enum

  • Ease In

  • Ease Out

  • Ease In-Out

Ease In-Out

Type of easing.

  • Ease In = slowly departs the starting value

  • Ease Out = slowly approaches the ending value

  • Ease In-Out = slowly departs and approaches values

Value1

Int or Float

0 or 0.0

Starting value

Value2

Int or Float

1 or 1.0

Ending value

Factor

Float

0.5

Mixing factor (between 0.0 and 1.0)

Extra Parameters

For certain interpolation types the node provides extra parameters on the property panel.

  • Exponential Extra parameters to adjust the base and the exponent of the exponential function. The Defaults are 2 and 10.0.

  • Back Extra parameters to adjust the scale of the overshoot. The default is 1.0.

  • Bounce Extra parameters to adjust the attenuation of the bounce and the number of bounces. The defaults are 0.5 and 4.

  • Elastic Extra parameters to adjust the base and the exponent of the damping oscillation as well as the number of bounces (oscillations). The defaults are 1.6, 6.0 and 6.

Outputs

This node has one output: Value.

Inputs and outputs are vectorized, so if series of values is passed to one of inputs, then this node will produce several sequences.

Example of usage

https://user-images.githubusercontent.com/14288520/189172710-31bded10-ad4e-4a2c-8ae0-d580271ec948.png https://user-images.githubusercontent.com/14288520/189172757-4996b307-99d7-4c68-afdb-957af880635f.gif
https://user-images.githubusercontent.com/14288520/189170595-bb67e4ad-7939-416b-ad0b-cea60655ebee.png https://user-images.githubusercontent.com/14288520/189170633-4e6a9ce8-b9a5-4712-983a-4534d1e52812.gif

Given simplest nodes setup:

#

you will have something like:

#