Expressions in WATCHOUT 7

Expressions in WATCHOUT 7 provide a powerful way to create dynamic, responsive behaviors throughout your productions. They allow you to use mathematical formulas, logical conditions, and variables to control nearly every aspect of your show.

Expression Syntax

Basic Examples

  • "masterVolume" - Simple variable reference
  • "tweenValue * 2" - Multiply the tween value
  • "1" - Logical conditon that is true
  • "0" - Logical conditon that is false
  • "position > threshold" - Logical condition (true/false)

Formal Definition

Operators

  • () - Parentheses for grouping expressions
  • ^ - Exponentiation (power)
  • % - Modulo (remainder)
  • / - Division
  • * - Multiplication
  • - - Subtraction
  • + - Addition
  • ==, !=, <, <=, >=, > - Comparisons
  • &&, and - Logical AND
  • ||, or - Logical OR

Common Functions

  • sin(radians), cos(radians), tan(radians) - Trigonometry

  • min(val, ...), max(val, ...) - Value comparison

  • abs(val) - Absolute value

  • ceil(val), floor(val), round(val) - Rounding

  • log(base=10, val) - Logarithm

    Constants
  • e() - Euler's number (2.718281...)

  • pi() - π (3.141592...)

Creative Applications

Expressions become most powerful when combined with variables to create dynamic behaviors:

Dynamic Motion

// Horizontal oscillation
"centerX + sin(time * speed) * amplitude"

// Multi-axis floating movement
"baseY + sin(time * 0.5) * 20 + sin(time * 0.7) * 15"

// Rotation that changes based on audio level
"baseRotation + (audioLevel * rotationFactor)"

Interactive Controls

// Convert MIDI controller to position
"minPosition + (midi.ch(0).cc(1) * positionRange)"

// Smooth transition with variable
"currentValue + ((targetValue - currentValue) * smoothingFactor)"

// Cross-fade between two states
"isState1 ? masterOpacity : 0"

Special Effects

// Pulsing effect
"baseValue + (sin(time * pulseRate) * pulseAmount)"

// Progressive reveal
"progress > revealThreshold ? 1 : 0"

// Color temperature adjustment based on time of day
"baseColor + ((timeOfDay - 12) * temperatureShift)"

Best Practices

For optimal results with expressions:

  • Start with simple expressions and gradually add complexity
  • Test expressions with extreme input values to verify behavior
  • Use parentheses to ensure correct order of operations
  • Avoid division by zero by adding small safety offsets

Expressions can help enhance your WATCHOUT productions by adding responsive elements and conditional logic, making your shows more flexible and adaptable to different scenarios and environments.