Logic
对布尔(开/关)值执行简单的逻辑运算(AND、OR、XOR)。
First - 设置要在运算中使用的第一个布尔值。当使用输入连接时,小于 0.5 的值被视为 false,大于或等于 0.5 的值被视为 true。
Operation - 确定逻辑运算:
- AND (both) - 如果 First 和 Second 都为
true,则 Result 为true。 - OR (one or both) - 如果 First 和/或 Second 为
true,则 Result 为true。 - XOR (one but not both) - 如果 First 或 Second 中的一个为
true,但两者不同时为true,则 Result 为true。
Second - 设置要在运算中使用的第二个布尔值。当使用输入连接时,小于 0.5 的值被视为 false,大于或等于 0.5 的值被视为 true。
Result - 输出的只读预览。当结果为 true 时,Logic Utility 将输出 1,当结果为 false 时,输出 0。
- 创建一个 Ellipse。
- 创建两个 Comparison Utilities。
- 将两者的 Second 都设置为 0。
- 连接 ellipse.position.x→comparison1.first。
- 连接 ellipse.position.y→comparison2.first。
- 创建一个 Logic Utility。
- 连接 comparison1.id→logic.first。
- 连接 comparison2.id→logic.second。
- 创建一个 Color Array。
- 使用
Add 按钮向 Color Array 添加第二个索引,并设置不同的颜色。
- 连接 logic.id→colorArray.index。
- 连接 colorArray.id→ellipse.fill.color。
使用 Select 工具在 Viewport 中移动 Ellipse。当 Ellipse 定位在 Viewport 的左下象限时,它将改变颜色,因为:
- 它在 X 和 Y 上的位置都小于 0,这意味着两个 Comparisons 都返回
true。 - 这意味着 Logic 也返回
true。 - 这将 Color Array 的 Index 设置为 1。