Logic
Intro
Perform simple logic operations (AND, OR, XOR) on boolean (on/off) values.
UI
First - Set the first boolean to be used in the operation. When using input connections, a value less than 0.5 is considered false and a value greater than or equal to 0.5 is true.
Operation - Determine the logical operation:
- AND (both) - The Result is
trueif First and Second are bothtrue. - OR (one or both) - The Result is
trueif First and/or Second aretrue. - XOR (one but not both) - The Result is
trueif either First or Second istruebut not if both aretrue.
Second - Set the second boolean to be used in the operation. When using input connections, a value less than 0.5 is considered false and a value greater than or equal to 0.5 is true.
Result - A read only preview of the output. The Logic Utility will output a value of 1 when the result is true and a value of 0 when the result is false.
- Create an Ellipse.
- Create two Comparison Utilities.
- Set Second to 0 for both.
- Connect ellipse.position.x→comparison1.first.
- Connect ellipse.position.y→comparison2.first.
- Create a Logic Utility.
- Connect comparison1.id→logic.first.
- Connect comparison2.id→logic.second.
- Create a Color Array.
- Using the button add a second index to the Color Array and set a different color.
- Connect logic.id→colorArray.index.
- Connect colorArray.id→ellipse.fill.color.
Using the Select tool, move the Ellipse around the Viewport. When the Ellipse is positioned in the bottom left quadrant of the Viewport it will change color because;
- Its position in both X and Y is less than 0 which means both Comparisons return
true. - This means the Logic also returns
true. - Which sets the Color Array's Index to 1.