## rex_maxmin

**Introduction**

A variable which clamped between maximum and minimum bound.

It is a small behavior which packs these 3 variables - current value, maximum and minimum bound together.

**Maximum and minimum bound**

Maximum and minimum bound could be set at properties table "Max" , and "Min". Get these value of boundaries by "Expression:Max", and "Expression:Min". These will clamp the current value into boundaries.

Set these boundaries by "Action:Set maximum bound", or "Action:Set minimum bound". These might change current value to clamp it into boundaries.

Use "Condition:Compare bound" to test the value of max bound, or min bound.

**Current value**

Call "Action:Set value", or "Action:Add to", or "Action:Subtract from" will try to change the current value, this value will be clamped in maximum and minimum bound. Get this value by "Expression:Value".

"Condition:On value changing" will be triggered if current value changing. Or use "Condition:Compare value" to test the value.

Get the percentage of current value divide to boundaries by "Expression:Percentage"

Percentage = ( current value - minimum bound ) / ( maximum bound - minimum bound )

**Previous value**

Previous value could be got by "Expression:PreValue", which will be updated after value setting. "Condition:Compare delta value" could be used to test the amount of value changed. The delta value is equal to

Delta value = Current value - Previous value