Kodtrolshow control app [alpha]

View on GitHub

Scripting

Helpers

Helpers are useful functions that you can use anywhere in your scripts.


clamp ( value, min, max )

Ensures that an input value is within the range of minimum and maximum values.

Arguments
  • value ( Number )

    The number to clamp

  • min ( Number )

    The minimum value possible

  • max ( Number )

    The maximum value possible

Return value Number

If value is smaller than min, return min. If value is greater than max, return max. Otherwise, returns value.

Example clamp(1, 2, 6) // Returns 2 clamp(10, 2, 6) // Returns 6 clamp(-42, -100, 0) // Return -42
cmykColor ( c, m, y, k )

Creates an object with keys containing the values of CMYK color components.

Arguments
  • c ( Number )

    The cyan value

  • m ( Number )

    The magenta value

  • y ( Number )

    The yellow value

  • k ( Number )

    The black value

Return value Object

An object containing the matching c, m, y and k keys from the parameters.

easeInBack ( progress )

Generates a "back overshoot" easing at start of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInBounce ( progress )

Generates a "bouncing" easing at start of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInCirc ( progress )

Generates a circular easing at start of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInCubic ( progress )

Generates a cubic easing at start of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInElastic ( progress )

Generates a "elastic" easing at start of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInExpo ( progress )

Generates a exponential easing at start of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInOutBack ( progress )

Generates a "back overshoot" easing at both start and end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInOutBounce ( progress )

Generates a "bouncing" easing at both start and end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInOutCirc ( progress )

Generates a circular easing at both start and end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInOutCubic ( progress )

Generates a cubic easing at both start and end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInOutElastic ( progress )

Generates a "elastic" easing at both start and end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInOutExpo ( progress )

Generates a exponential easing at both start and end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInOutQuad ( progress )

Generates a quad easing at both start and end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInOutQuart ( progress )

Generates a quart easing at both start and end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInOutQuint ( progress )

Generates a quint easing at both start and end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInOutSine ( progress )

Generates a sine easing at both start and end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInQuad ( progress )

Generates a quad easing at start of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInQuart ( progress )

Generates a quart easing at start of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInQuint ( progress )

Generates a quint easing at start of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeInSine ( progress )

Generates a sine easing at start of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeOutBack ( progress )

Generates a "back overshoot" easing at end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeOutBounce ( progress )

Generates a "bouncing" easing at end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeOutCirc ( progress )

Generates a circular easing at end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeOutCubic ( progress )

Generates a cubic easing at end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeOutElastic ( progress )

Generates a "elastic" easing at end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeOutExpo ( progress )

Generates a exponential easing at end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeOutQuad ( progress )

Generates a quad easing at end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeOutQuart ( progress )

Generates a quart easing at end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeOutQuint ( progress )

Generates a quint easing at end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

easeOutSine ( progress )

Generates a sine easing at end of period.

Arguments
  • progress ( Number )

    The normalized progress value, from 0 to 1

Return value Number

An eased, normalized value from 0 to 1.

highByte ( value )

Extracts the value of the higher byte of a 16-bit value. Useful for getting the "coarse" value of a 16-bit DMX parameter.

Arguments
  • value ( Number )

    The input value

Return value Number

The higher byte value of the input value

isEven ( value )
Arguments
  • value ( Number )

    The number to check

Return value Boolean

Returns true if value is even, false otherwise.

Example isEven(1) // Returns false isEven(2) // Returns true
isOdd ( value )
Arguments
  • value ( Number )

    The number to check

Return value Boolean

Returns true if value is odd, false otherwise.

Example isEven(1) // Returns true isEven(2) // Returns false
log ( args )

Sends data to Kodtrol's console window.

Arguments
  • args ( * )

    The data to log; each argument will be cast to a string.

Example log("Hello World") // Displays "Hello World" in the console window log(1, 2, 3, "four", 5) // Displays "1 2 3 four 5" in the console window
lowByte ( value )

Extracts the value of the lower byte of a 16-bit value. Useful for getting the "fine" value of a 16-bit DMX parameter.

Arguments
  • value ( Number )

    The input value

Return value Number

The lower byte value of the input value

radToDeg ( radians )

Converts a value in radians to a value in degrees.

Arguments
  • radians ( Number )

    The input value in radians

Return value Number

The corresponding value in degrees

randomTrueFalse ( bias )
Arguments
  • bias ( Number )

    Adjust probability bias; a value closer to 0 will result in more trues a value close to 1 will result in more falses.

Return value Boolean

A random true or false.