DEF Example_1 Script { |
field SFColor currentColor 0 0 0 |
eventIn SFColor colorIn |
eventOut SFBool isRed |
url "javascript: |
function colorIn(newColor, ts) { |
// This method is called when a colorIn event is received |
currentColor = newColor; |
} |
function eventsProcessed( ) { |
if (currentColor[0] >= 0.5) // if red is at or above 50% |
isRed = true; |
}" |
} |